@graphty/webgpu-graph-algorithms 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -21
- package/dist/browser.js +1 -1
- package/dist/chunks/{context-CRbw2Wyo.js → context-BR7fx3vR.js} +47 -5
- package/dist/chunks/context-BR7fx3vR.js.map +1 -0
- package/dist/node.js +1 -1
- package/dist/src/accelerator.d.ts +12 -10
- package/dist/src/accelerator.d.ts.map +1 -1
- package/dist/src/accelerator.js +32 -10
- package/dist/src/accelerator.js.map +1 -1
- package/dist/src/constants.d.ts +47 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +47 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/index.d.ts +7 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/kernel/prelude.d.ts.map +1 -1
- package/dist/src/kernel/prelude.js +4 -1
- package/dist/src/kernel/prelude.js.map +1 -1
- package/dist/src/kernels.d.ts +3 -3
- package/dist/src/kernels.d.ts.map +1 -1
- package/dist/src/kernels.js +27 -11
- package/dist/src/kernels.js.map +1 -1
- package/dist/src/layouts/force-simulation.d.ts +3 -1
- package/dist/src/layouts/force-simulation.d.ts.map +1 -1
- package/dist/src/layouts/force-simulation.js +13 -3
- package/dist/src/layouts/force-simulation.js.map +1 -1
- package/dist/src/layouts/forceatlas2.d.ts +1 -3
- package/dist/src/layouts/forceatlas2.d.ts.map +1 -1
- package/dist/src/layouts/forceatlas2.js +2 -191
- package/dist/src/layouts/forceatlas2.js.map +1 -1
- package/dist/src/layouts/fruchterman-reingold.d.ts +195 -0
- package/dist/src/layouts/fruchterman-reingold.d.ts.map +1 -0
- package/dist/src/layouts/fruchterman-reingold.js +579 -0
- package/dist/src/layouts/fruchterman-reingold.js.map +1 -0
- package/dist/src/layouts/model-common.d.ts +102 -0
- package/dist/src/layouts/model-common.d.ts.map +1 -0
- package/dist/src/layouts/model-common.js +198 -0
- package/dist/src/layouts/model-common.js.map +1 -0
- package/dist/src/layouts/spring-electrical.d.ts +179 -0
- package/dist/src/layouts/spring-electrical.d.ts.map +1 -0
- package/dist/src/layouts/spring-electrical.js +508 -0
- package/dist/src/layouts/spring-electrical.js.map +1 -0
- package/dist/src/types/accelerator.d.ts +7 -3
- package/dist/src/types/accelerator.d.ts.map +1 -1
- package/dist/src/types/layout.d.ts +32 -0
- package/dist/src/types/layout.d.ts.map +1 -1
- package/dist/src/types/options.d.ts +43 -1
- package/dist/src/types/options.d.ts.map +1 -1
- package/dist/src/wgsl/fa2-attraction.wgsl.d.ts +5 -2
- package/dist/src/wgsl/fa2-attraction.wgsl.d.ts.map +1 -1
- package/dist/src/wgsl/fa2-attraction.wgsl.js +6 -1
- package/dist/src/wgsl/fa2-attraction.wgsl.js.map +1 -1
- package/dist/src/wgsl/fa2-integrate.wgsl.d.ts +7 -2
- package/dist/src/wgsl/fa2-integrate.wgsl.d.ts.map +1 -1
- package/dist/src/wgsl/fa2-integrate.wgsl.js +28 -2
- package/dist/src/wgsl/fa2-integrate.wgsl.js.map +1 -1
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts +4 -2
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts.map +1 -1
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js +14 -5
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js.map +1 -1
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts +8 -1
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts.map +1 -1
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.js +33 -0
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/webgpu-graph-algorithms.js +1358 -284
- package/dist/webgpu-graph-algorithms.js.map +1 -1
- package/package.json +6 -4
- package/src/accelerator.ts +46 -12
- package/src/constants.ts +70 -0
- package/src/index.ts +15 -5
- package/src/kernel/prelude.ts +6 -0
- package/src/kernels.ts +27 -11
- package/src/layouts/force-simulation.ts +20 -3
- package/src/layouts/forceatlas2.ts +17 -220
- package/src/layouts/fruchterman-reingold.ts +737 -0
- package/src/layouts/model-common.ts +228 -0
- package/src/layouts/spring-electrical.ts +666 -0
- package/src/types/accelerator.ts +15 -3
- package/src/types/layout.ts +36 -0
- package/src/types/options.ts +45 -1
- package/src/wgsl/fa2-attraction.wgsl.ts +6 -1
- package/src/wgsl/fa2-integrate.wgsl.ts +28 -2
- package/src/wgsl/fa2-repulsion-exact.wgsl.ts +14 -5
- package/src/wgsl/fa2-stats-finalize.wgsl.ts +33 -0
- package/dist/chunks/context-CRbw2Wyo.js.map +0 -1
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as WebGpuGraphError, G as GpuContext } from "./chunks/context-
|
|
1
|
+
import { W as WebGpuGraphError, G as GpuContext } from "./chunks/context-BR7fx3vR.js";
|
|
2
2
|
const INSTALL_HINT = "install the optional peer dependency webgpu@0.4.0";
|
|
3
3
|
function isDawnModule(loaded) {
|
|
4
4
|
return typeof loaded === "object" && loaded !== null && typeof loaded.create === "function";
|
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
* AlgorithmAccelerator and LayoutAccelerator interfaces (spec 9.2, 9.3). Both are the REAL declarations,
|
|
4
4
|
* `LayoutAccelerator` from `@graphty/layout` (W1b, layout half) and `AlgorithmAccelerator` from
|
|
5
5
|
* `@graphty/algorithms` (W1b, algorithms half), `import type`d by src/types/accelerator.ts, so the object built
|
|
6
|
-
* here is checked against the CPU packages' own contracts. It carries P3's `forceAtlas2`, `release` and `dispose
|
|
7
|
-
*
|
|
8
|
-
* algorithm members (spec 8.2, 8.3; M8b-T8, PD-14) and nothing
|
|
9
|
-
* `createSimulation()`) test `acc.betweennessCentrality !== undefined`
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
6
|
+
* here is checked against the CPU packages' own contracts. It carries P3's `forceAtlas2`, `release` and `dispose`,
|
|
7
|
+
* P5's `fruchtermanReingold` and `springElectrical` (the two other layout members of spec 9.3, landed together once
|
|
8
|
+
* both models were green, P5 PD-19) and P7's seven algorithm members (spec 8.2, 8.3; M8b-T8, PD-14) and nothing
|
|
9
|
+
* else: the CPU-side dispatchers (`accelerated()`, `createSimulation()`) test `acc.betweennessCentrality !== undefined`
|
|
10
|
+
* / `acc.fruchtermanReingold !== undefined` and route to the CPU when the member is absent (spec 2.4 row "method
|
|
11
|
+
* missing"), so a method the GPU does not implement must not exist here -- never a throwing stub. The remaining
|
|
12
|
+
* algorithm members arrive one per shipped algorithm from P8.
|
|
13
13
|
*/
|
|
14
14
|
import { type GpuContext } from "./context.js";
|
|
15
15
|
import { type AcceleratorOptions, type GpuAccelerator } from "./types/accelerator.js";
|
|
16
16
|
/**
|
|
17
17
|
* Spec 3.3 createAccelerator, verbatim: the object implementing AlgorithmAccelerator & LayoutAccelerator
|
|
18
|
-
* structurally; P3's forceAtlas2, release and dispose
|
|
18
|
+
* structurally; P3's forceAtlas2, release and dispose, P5's fruchtermanReingold and springElectrical (the same
|
|
19
|
+
* `{ ...o, ...options.layout }` shape as forceAtlas2) plus P7's seven algorithm members, each a delegation to
|
|
19
20
|
* its algorithm with `ctx.assertReady()` first. The accelerator's algorithm defaults are not consulted by any of
|
|
20
21
|
* them: only `betweenness` has any, and it belongs to P9. One per call (the app creates one and injects
|
|
21
22
|
* it, spec 2.4); `kind` is "webgpu"; `options` is a frozen deep copy; `forceAtlas2(o)` is
|
|
@@ -25,8 +26,9 @@ import { type AcceleratorOptions, type GpuAccelerator } from "./types/accelerato
|
|
|
25
26
|
* @param ctx - the context every simulation the accelerator creates runs on
|
|
26
27
|
* @param options - GPU-only defaults inherited by every simulation (`layout`) and, from P9, the algorithm defaults
|
|
27
28
|
* @returns the injectable accelerator
|
|
28
|
-
* @throws E_DISPOSED / E_DEVICE_LOST from `ctx.assertReady()` (here and inside
|
|
29
|
-
* also throws what createForceAtlas2 throws (E_UNSUPPORTED for `nodeSize`, E_INVALID_ARGUMENT for a bad range)
|
|
29
|
+
* @throws E_DISPOSED / E_DEVICE_LOST from `ctx.assertReady()` (here and inside every creating member); `forceAtlas2()`
|
|
30
|
+
* also throws what createForceAtlas2 throws (E_UNSUPPORTED for `nodeSize`, E_INVALID_ARGUMENT for a bad range), and
|
|
31
|
+
* `fruchtermanReingold()` / `springElectrical()` what their factories throw (E_INVALID_ARGUMENT for a bad range)
|
|
30
32
|
*/
|
|
31
33
|
export declare function createAccelerator(ctx: GpuContext, options?: AcceleratorOptions): GpuAccelerator;
|
|
32
34
|
//# sourceMappingURL=accelerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accelerator.d.ts","sourceRoot":"","sources":["../../src/accelerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"accelerator.d.ts","sourceRoot":"","sources":["../../src/accelerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/C,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAgFtF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,cAAc,CA+H/F"}
|
package/dist/src/accelerator.js
CHANGED
|
@@ -3,18 +3,20 @@
|
|
|
3
3
|
* AlgorithmAccelerator and LayoutAccelerator interfaces (spec 9.2, 9.3). Both are the REAL declarations,
|
|
4
4
|
* `LayoutAccelerator` from `@graphty/layout` (W1b, layout half) and `AlgorithmAccelerator` from
|
|
5
5
|
* `@graphty/algorithms` (W1b, algorithms half), `import type`d by src/types/accelerator.ts, so the object built
|
|
6
|
-
* here is checked against the CPU packages' own contracts. It carries P3's `forceAtlas2`, `release` and `dispose
|
|
7
|
-
*
|
|
8
|
-
* algorithm members (spec 8.2, 8.3; M8b-T8, PD-14) and nothing
|
|
9
|
-
* `createSimulation()`) test `acc.betweennessCentrality !== undefined`
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
6
|
+
* here is checked against the CPU packages' own contracts. It carries P3's `forceAtlas2`, `release` and `dispose`,
|
|
7
|
+
* P5's `fruchtermanReingold` and `springElectrical` (the two other layout members of spec 9.3, landed together once
|
|
8
|
+
* both models were green, P5 PD-19) and P7's seven algorithm members (spec 8.2, 8.3; M8b-T8, PD-14) and nothing
|
|
9
|
+
* else: the CPU-side dispatchers (`accelerated()`, `createSimulation()`) test `acc.betweennessCentrality !== undefined`
|
|
10
|
+
* / `acc.fruchtermanReingold !== undefined` and route to the CPU when the member is absent (spec 2.4 row "method
|
|
11
|
+
* missing"), so a method the GPU does not implement must not exist here -- never a throwing stub. The remaining
|
|
12
|
+
* algorithm members arrive one per shipped algorithm from P8.
|
|
13
13
|
*/
|
|
14
14
|
import { connectedComponents } from "./algorithms/components.js";
|
|
15
15
|
import { pageRank, personalizedPageRank } from "./algorithms/pagerank.js";
|
|
16
16
|
import { eigenvectorCentrality, hits, katzCentrality } from "./algorithms/spectral.js";
|
|
17
17
|
import { createForceAtlas2 } from "./layouts/forceatlas2.js";
|
|
18
|
+
import { createFruchtermanReingold } from "./layouts/fruchterman-reingold.js";
|
|
19
|
+
import { createSpringElectrical } from "./layouts/spring-electrical.js";
|
|
18
20
|
/**
|
|
19
21
|
* Frozen copy of the betweenness defaults; `sources` is copied into a fresh frozen array so a later mutation of
|
|
20
22
|
* the caller's list is never seen by the accelerator.
|
|
@@ -63,7 +65,8 @@ function freezeOptions(options) {
|
|
|
63
65
|
}
|
|
64
66
|
/**
|
|
65
67
|
* Spec 3.3 createAccelerator, verbatim: the object implementing AlgorithmAccelerator & LayoutAccelerator
|
|
66
|
-
* structurally; P3's forceAtlas2, release and dispose
|
|
68
|
+
* structurally; P3's forceAtlas2, release and dispose, P5's fruchtermanReingold and springElectrical (the same
|
|
69
|
+
* `{ ...o, ...options.layout }` shape as forceAtlas2) plus P7's seven algorithm members, each a delegation to
|
|
67
70
|
* its algorithm with `ctx.assertReady()` first. The accelerator's algorithm defaults are not consulted by any of
|
|
68
71
|
* them: only `betweenness` has any, and it belongs to P9. One per call (the app creates one and injects
|
|
69
72
|
* it, spec 2.4); `kind` is "webgpu"; `options` is a frozen deep copy; `forceAtlas2(o)` is
|
|
@@ -73,8 +76,9 @@ function freezeOptions(options) {
|
|
|
73
76
|
* @param ctx - the context every simulation the accelerator creates runs on
|
|
74
77
|
* @param options - GPU-only defaults inherited by every simulation (`layout`) and, from P9, the algorithm defaults
|
|
75
78
|
* @returns the injectable accelerator
|
|
76
|
-
* @throws E_DISPOSED / E_DEVICE_LOST from `ctx.assertReady()` (here and inside
|
|
77
|
-
* also throws what createForceAtlas2 throws (E_UNSUPPORTED for `nodeSize`, E_INVALID_ARGUMENT for a bad range)
|
|
79
|
+
* @throws E_DISPOSED / E_DEVICE_LOST from `ctx.assertReady()` (here and inside every creating member); `forceAtlas2()`
|
|
80
|
+
* also throws what createForceAtlas2 throws (E_UNSUPPORTED for `nodeSize`, E_INVALID_ARGUMENT for a bad range), and
|
|
81
|
+
* `fruchtermanReingold()` / `springElectrical()` what their factories throw (E_INVALID_ARGUMENT for a bad range)
|
|
78
82
|
*/
|
|
79
83
|
export function createAccelerator(ctx, options) {
|
|
80
84
|
ctx.assertReady();
|
|
@@ -92,6 +96,24 @@ export function createAccelerator(ctx, options) {
|
|
|
92
96
|
ctx.assertReady();
|
|
93
97
|
return createForceAtlas2(ctx, { ...o, ...frozen.layout });
|
|
94
98
|
},
|
|
99
|
+
/**
|
|
100
|
+
* The Fruchterman-Reingold simulation with this accelerator's layout tuning (spec 3.3, 7.20; P5).
|
|
101
|
+
* @param o - the CPU option type (spec 9.3 FruchtermanReingoldOptions); GPU tuning keys come from `options.layout`
|
|
102
|
+
* @returns a fresh simulation in state "created"
|
|
103
|
+
*/
|
|
104
|
+
fruchtermanReingold(o) {
|
|
105
|
+
ctx.assertReady();
|
|
106
|
+
return createFruchtermanReingold(ctx, { ...o, ...frozen.layout });
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* The spring-electrical preset with this accelerator's layout tuning (spec 3.3, 7.20; P5).
|
|
110
|
+
* @param o - the CPU option type (spec 9.3 SpringElectricalOptions, ngraph's names)
|
|
111
|
+
* @returns a fresh simulation in state "created"
|
|
112
|
+
*/
|
|
113
|
+
springElectrical(o) {
|
|
114
|
+
ctx.assertReady();
|
|
115
|
+
return createSpringElectrical(ctx, { ...o, ...frozen.layout });
|
|
116
|
+
},
|
|
95
117
|
/**
|
|
96
118
|
* PageRank on the device (spec 8.2; contract 3.14).
|
|
97
119
|
* @param gs - the snapshot
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accelerator.js","sourceRoot":"","sources":["../../src/accelerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"accelerator.js","sourceRoot":"","sources":["../../src/accelerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAA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BAAmB,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACjD,CAAC;QACD;;;WAGG;QACH,OAAO,CAAC,CAAgB;YACpB,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;QACD;;WAEG;QACH,OAAO;YACH,GAAG,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -89,4 +89,51 @@ export declare const FA2_DISTANCE_FLOOR_SQ = 0.0001;
|
|
|
89
89
|
export declare const FA2_COINCIDENT_SQ = 1e-8;
|
|
90
90
|
/** Bits of Fa2Params.flags (contract 4.4). */
|
|
91
91
|
export declare const FA2_FLAG_FIRST = 1;
|
|
92
|
+
/** Fa2Params.flags bit: the Fruchterman-Reingold temperature is the adaptive one in the state block, not the uniform's (the `cooling: "adaptive"` option). */
|
|
93
|
+
export declare const FA2_FLAG_ADAPTIVE = 2;
|
|
94
|
+
/** The Fruchterman-Reingold loop's starting temperature (spec 7.20; `layout/src/simulation/fruchterman-reingold.ts:30`). */
|
|
95
|
+
export declare const FR_START_TEMPERATURE = 0.1;
|
|
96
|
+
/** The reheat point of spec 7.20: the temperature index a reheat restarts at, as a fraction of `iterations`. */
|
|
97
|
+
export declare const FR_REHEAT_FRACTION = 0.7;
|
|
98
|
+
/** Adaptive cooling (Yifan Hu 2005, section 3.2): the temperature is multiplied by this when the force energy rose, divided by it after FR_COOLING_PATIENCE consecutive falls. */
|
|
99
|
+
export declare const FR_COOLING_STEP = 0.9;
|
|
100
|
+
/** Adaptive cooling: consecutive iterations of falling energy before the temperature grows. */
|
|
101
|
+
export declare const FR_COOLING_PATIENCE = 5;
|
|
102
|
+
/** Adaptive cooling: the iteration budget when `iterations` is not given (the schedule no longer needs one; this is the cap on a run that never settles). */
|
|
103
|
+
export declare const FR_ADAPTIVE_MAX_ITERATIONS = 10000;
|
|
104
|
+
/** Fruchterman-Reingold defaults (spec 7.20, 9.3; the CPU simulation's, `layout/src/simulation/fruchterman-reingold.ts:32`): `k` null = `1 / sqrt(n)`. */
|
|
105
|
+
export declare const FR_DEFAULTS: Readonly<{
|
|
106
|
+
k: null;
|
|
107
|
+
iterations: 50;
|
|
108
|
+
fixed: null;
|
|
109
|
+
dim: 2;
|
|
110
|
+
scale: 1;
|
|
111
|
+
settleThreshold: 0.001;
|
|
112
|
+
settleWindow: 10;
|
|
113
|
+
iterationsPerStep: 1;
|
|
114
|
+
maxInFlight: 2;
|
|
115
|
+
cooling: "linear";
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Spring-electrical size scaling: when `gravity` or `springCoefficient` is left to its default, ngraph's constant is
|
|
119
|
+
* multiplied by min(1, SE_SCALE_REFERENCE_NODES / n). ngraph's values were tuned for graphs of a few hundred nodes;
|
|
120
|
+
* on tens of thousands the per-node forces are so large that every node moves at the unit speed clamp and the layout
|
|
121
|
+
* never comes to rest (measured on the 58k-node Brightkite graph: 3,350 iterations to the settle rule with the
|
|
122
|
+
* kinetic energy still at the clamp; a uniform 1/1000 factor settled in 1,000 with the energy decayed 25x).
|
|
123
|
+
*/
|
|
124
|
+
export declare const SE_SCALE_REFERENCE_NODES = 300;
|
|
125
|
+
/** Spring-electrical defaults: ngraph.forcelayout 3.3.1's (`lib/createPhysicsSimulator.js:29,34,40,54,59`; spec 7.20), plus the shared simulation defaults. `gravity` is ngraph's Coulomb constant: negative repels. */
|
|
126
|
+
export declare const SE_DEFAULTS: Readonly<{
|
|
127
|
+
springLength: 10;
|
|
128
|
+
springCoefficient: 0.8;
|
|
129
|
+
gravity: -12;
|
|
130
|
+
dragCoefficient: 0.9;
|
|
131
|
+
timeStep: 0.5;
|
|
132
|
+
dim: 2;
|
|
133
|
+
scale: 1;
|
|
134
|
+
settleThreshold: 0.001;
|
|
135
|
+
settleWindow: 10;
|
|
136
|
+
iterationsPerStep: 1;
|
|
137
|
+
maxInFlight: 2;
|
|
138
|
+
}>;
|
|
92
139
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0IAA0I;AAC1I,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,4HAA4H;AAC5H,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAC5C,sGAAsG;AACtG,eAAO,MAAM,YAAY,QAA0C,CAAC;AACpE,sJAAsJ;AACtJ,eAAO,MAAM,OAAO,aAAa,CAAC;AAClC,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,qHAAqH;AACrH,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,8HAA8H;AAC9H,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,yGAAyG;AACzG,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,gGAAgG;AAChG,eAAO,MAAM,yBAAyB,QAAmB,CAAC;AAC1D,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,mDAAmD;AACnD,eAAO,MAAM,oBAAoB,QAAW,CAAC;AAC7C,sFAAsF;AACtF,eAAO,MAAM,yBAAyB,QAAmB,CAAC;AAC1D,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,QAAmB,CAAC;AACvD,yDAAyD;AACzD,eAAO,MAAM,iCAAiC,IAAI,CAAC;AACnD,yKAAyK;AACzK,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,gEAAgE;AAChE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,wOAAwO;AACxO,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,2EAA2E;AAC3E,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,oDAAo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ACP,KAAK,EAAE,CAAC,CAAC;IACT,eAAe,EAAE,KAAK,CAAC;IACvB,YAAY,EAAE,EAAE,CAAC;IACjB,iBAAiB,EAAE,CAAC,CAAC;IACrB,WAAW,EAAE,CAAC,CAAC;IACf,OAAO,EAAE,QAAQ,CAAC;CACrB,CAWC,CAAC;AACH;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,wNAAwN;AACxN,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC;IAC/B,YAAY,EAAE,EAAE,CAAC;IACjB,iBAAiB,EAAE,GAAG,CAAC;IACvB,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,eAAe,EAAE,GAAG,CAAC;IACrB,QAAQ,EAAE,GAAG,CAAC;IACd,GAAG,EAAE,CAAC,CAAC;IACP,KAAK,EAAE,CAAC,CAAC;IACT,eAAe,EAAE,KAAK,CAAC;IACvB,YAAY,EAAE,EAAE,CAAC;IACjB,iBAAiB,EAAE,CAAC,CAAC;IACrB,WAAW,EAAE,CAAC,CAAC;CAClB,CAYC,CAAC"}
|
package/dist/src/constants.js
CHANGED
|
@@ -89,4 +89,51 @@ export const FA2_DISTANCE_FLOOR_SQ = 0.0001;
|
|
|
89
89
|
export const FA2_COINCIDENT_SQ = 1e-8;
|
|
90
90
|
/** Bits of Fa2Params.flags (contract 4.4). */
|
|
91
91
|
export const FA2_FLAG_FIRST = 1;
|
|
92
|
+
/** Fa2Params.flags bit: the Fruchterman-Reingold temperature is the adaptive one in the state block, not the uniform's (the `cooling: "adaptive"` option). */
|
|
93
|
+
export const FA2_FLAG_ADAPTIVE = 2;
|
|
94
|
+
/** The Fruchterman-Reingold loop's starting temperature (spec 7.20; `layout/src/simulation/fruchterman-reingold.ts:30`). */
|
|
95
|
+
export const FR_START_TEMPERATURE = 0.1;
|
|
96
|
+
/** The reheat point of spec 7.20: the temperature index a reheat restarts at, as a fraction of `iterations`. */
|
|
97
|
+
export const FR_REHEAT_FRACTION = 0.7;
|
|
98
|
+
/** Adaptive cooling (Yifan Hu 2005, section 3.2): the temperature is multiplied by this when the force energy rose, divided by it after FR_COOLING_PATIENCE consecutive falls. */
|
|
99
|
+
export const FR_COOLING_STEP = 0.9;
|
|
100
|
+
/** Adaptive cooling: consecutive iterations of falling energy before the temperature grows. */
|
|
101
|
+
export const FR_COOLING_PATIENCE = 5;
|
|
102
|
+
/** Adaptive cooling: the iteration budget when `iterations` is not given (the schedule no longer needs one; this is the cap on a run that never settles). */
|
|
103
|
+
export const FR_ADAPTIVE_MAX_ITERATIONS = 10000;
|
|
104
|
+
/** Fruchterman-Reingold defaults (spec 7.20, 9.3; the CPU simulation's, `layout/src/simulation/fruchterman-reingold.ts:32`): `k` null = `1 / sqrt(n)`. */
|
|
105
|
+
export const FR_DEFAULTS = Object.freeze({
|
|
106
|
+
k: null,
|
|
107
|
+
iterations: 50,
|
|
108
|
+
fixed: null,
|
|
109
|
+
dim: 2,
|
|
110
|
+
scale: 1,
|
|
111
|
+
settleThreshold: 0.001,
|
|
112
|
+
settleWindow: 10,
|
|
113
|
+
iterationsPerStep: 1,
|
|
114
|
+
maxInFlight: 2,
|
|
115
|
+
cooling: "linear",
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* Spring-electrical size scaling: when `gravity` or `springCoefficient` is left to its default, ngraph's constant is
|
|
119
|
+
* multiplied by min(1, SE_SCALE_REFERENCE_NODES / n). ngraph's values were tuned for graphs of a few hundred nodes;
|
|
120
|
+
* on tens of thousands the per-node forces are so large that every node moves at the unit speed clamp and the layout
|
|
121
|
+
* never comes to rest (measured on the 58k-node Brightkite graph: 3,350 iterations to the settle rule with the
|
|
122
|
+
* kinetic energy still at the clamp; a uniform 1/1000 factor settled in 1,000 with the energy decayed 25x).
|
|
123
|
+
*/
|
|
124
|
+
export const SE_SCALE_REFERENCE_NODES = 300;
|
|
125
|
+
/** Spring-electrical defaults: ngraph.forcelayout 3.3.1's (`lib/createPhysicsSimulator.js:29,34,40,54,59`; spec 7.20), plus the shared simulation defaults. `gravity` is ngraph's Coulomb constant: negative repels. */
|
|
126
|
+
export const SE_DEFAULTS = Object.freeze({
|
|
127
|
+
springLength: 10,
|
|
128
|
+
springCoefficient: 0.8,
|
|
129
|
+
gravity: -12,
|
|
130
|
+
dragCoefficient: 0.9,
|
|
131
|
+
timeStep: 0.5,
|
|
132
|
+
dim: 2,
|
|
133
|
+
scale: 1,
|
|
134
|
+
settleThreshold: 0.001,
|
|
135
|
+
settleWindow: 10,
|
|
136
|
+
iterationsPerStep: 1,
|
|
137
|
+
maxInFlight: 2,
|
|
138
|
+
});
|
|
92
139
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0IAA0I;AAC1I,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAClC,4HAA4H;AAC5H,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAC5C,sGAAsG;AACtG,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,GAAG,cAAc,CAAC;AACpE,sJAAsJ;AACtJ,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,qHAAqH;AACrH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AACjC,8HAA8H;AAC9H,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AACrC,kFAAkF;AAClF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AACvC,yGAAyG;AACzG,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACxC,gGAAgG;AAChG,MAAM,CAAC,MAAM,yBAAyB,GAA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N,MAAM,CAAC,MAAM,WAAW,GAYnB,MAAM,CAAC,MAAM,CAAC;IACf,YAAY,EAAE,EAAE;IAChB,iBAAiB,EAAE,GAAG;IACtB,OAAO,EAAE,CAAC,EAAE;IACZ,eAAe,EAAE,GAAG;IACpB,QAAQ,EAAE,GAAG;IACb,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,CAAC;IACR,eAAe,EAAE,KAAK;IACtB,YAAY,EAAE,EAAE;IAChB,iBAAiB,EAAE,CAAC;IACpB,WAAW,EAAE,CAAC;CACjB,CAAC,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
* ForceSimulation, ForceAtlas2Model: tests import them from their files). P0: the error class, the constants and
|
|
7
7
|
* isSoftwareAdapter. P1 adds GpuContext and degree (values) and the context / run / profiler types. P2 adds nothing
|
|
8
8
|
* (Lease, CommandBatch, UniformRing are internal). P3 adds the layout factory, the accelerator, the two default
|
|
9
|
-
* tables, the seeder and the layout / accelerator types.
|
|
10
|
-
* test/types/public-api.test-d.ts the type list; P4+
|
|
9
|
+
* tables, the seeder and the layout / accelerator types. P5 adds the two factories, the two default tables and the
|
|
10
|
+
* two stats records. test/index.test.ts pins the value list and test/types/public-api.test-d.ts the type list; P4+
|
|
11
|
+
* extends both. This comment must never spell the internal
|
|
11
12
|
* JSDoc tag: it is the leading comment of the first export statement, and stripInternal would drop that statement
|
|
12
13
|
* from the emitted declarations.
|
|
13
14
|
*/
|
|
14
15
|
/// <reference types="@webgpu/types" preserve="true" />
|
|
15
|
-
export { ARC_WINDOW_ALIGN, EXACT_MAX_NODES, FA2_DEFAULTS, LAYOUT_TUNING_DEFAULTS, MAX_1D_ITEMS, MAX_WORKGROUPS_PER_DIM, STORAGE_ALIGN, WORKGROUP_SIZE, } from "./constants.js";
|
|
16
|
+
export { ARC_WINDOW_ALIGN, EXACT_MAX_NODES, FA2_DEFAULTS, FR_DEFAULTS, LAYOUT_TUNING_DEFAULTS, MAX_1D_ITEMS, MAX_WORKGROUPS_PER_DIM, SE_DEFAULTS, STORAGE_ALIGN, WORKGROUP_SIZE, } from "./constants.js";
|
|
16
17
|
export { hasErrorCode, isWebGpuGraphError, PASSTHROUGH_FORMAT_CODES, WebGpuGraphError, type WebGpuGraphErrorCode, } from "./errors.js";
|
|
17
18
|
export { GpuContext } from "./context.js";
|
|
18
19
|
export { isSoftwareAdapter } from "./device/acquire.js";
|
|
@@ -23,11 +24,13 @@ export { pageRank, personalizedPageRank } from "./algorithms/pagerank.js";
|
|
|
23
24
|
export { eigenvectorCentrality, hits, katzCentrality } from "./algorithms/spectral.js";
|
|
24
25
|
export { createAccelerator } from "./accelerator.js";
|
|
25
26
|
export { createForceAtlas2 } from "./layouts/forceatlas2.js";
|
|
27
|
+
export { createFruchtermanReingold } from "./layouts/fruchterman-reingold.js";
|
|
26
28
|
export { seedPositions } from "./layouts/seed.js";
|
|
29
|
+
export { createSpringElectrical } from "./layouts/spring-electrical.js";
|
|
27
30
|
export type { AcceleratorOptions, AlgorithmAccelerator, ApspResultLike, BellmanFordResultLike, BetweennessAcceleratorOptions, BfsResultLike, CommunityResultLike, CorenessResultLike, EdgeScoresResultLike, GpuAccelerator, HitsOptionsLike, HitsResultLike, LabelResultLike, LayoutAccelerator, LayoutSimulation, MstResultLike, PageRankResultLike, ScoresResultLike, SsspResultLike, } from "./types/accelerator.js";
|
|
28
31
|
export type { ComponentsOptions, EigenvectorOptions, GpuHitsResult, GpuLabelResult, GpuPageRankResult, GpuScoresResult, HitsOptions, KatzOptions, PageRankOptions, } from "./types/algorithms.js";
|
|
29
32
|
export type { AdapterInfoLike, AdapterSummary, GpuCaps, GpuContextOptions, LimitPolicy, PlanCaps, PlanLimits, ProbeOptions, ProbeResult, RaisableLimit, } from "./types/context.js";
|
|
30
|
-
export type { ForceAtlas2Stats, ForceAtlas2TraceRecord, GpuLayoutSimulation, GpuLayoutTuning, LayoutStatsBase, RunOptions, } from "./types/layout.js";
|
|
33
|
+
export type { ForceAtlas2Stats, ForceAtlas2TraceRecord, FruchtermanReingoldStats, FruchtermanReingoldTraceRecord, GpuLayoutSimulation, GpuLayoutTuning, LayoutStatsBase, RunOptions, SpringElectricalStats, SpringElectricalTraceRecord, } from "./types/layout.js";
|
|
31
34
|
export type { CommonLayoutOptions, ForceAtlas2Options, FruchtermanReingoldOptions, SimulationOptions, SpringElectricalOptions, } from "./types/options.js";
|
|
32
35
|
export type { GpuRunOptions } from "./types/run.js";
|
|
33
36
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;;AAIH,OAAO,EACH,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,cAAc,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,YAAY,EACZ,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,KAAK,oBAAoB,GAC5B,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGjE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,0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|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
* ForceSimulation, ForceAtlas2Model: tests import them from their files). P0: the error class, the constants and
|
|
8
8
|
* isSoftwareAdapter. P1 adds GpuContext and degree (values) and the context / run / profiler types. P2 adds nothing
|
|
9
9
|
* (Lease, CommandBatch, UniformRing are internal). P3 adds the layout factory, the accelerator, the two default
|
|
10
|
-
* tables, the seeder and the layout / accelerator types.
|
|
11
|
-
* test/types/public-api.test-d.ts the type list; P4+
|
|
10
|
+
* tables, the seeder and the layout / accelerator types. P5 adds the two factories, the two default tables and the
|
|
11
|
+
* two stats records. test/index.test.ts pins the value list and test/types/public-api.test-d.ts the type list; P4+
|
|
12
|
+
* extends both. This comment must never spell the internal
|
|
12
13
|
* JSDoc tag: it is the leading comment of the first export statement, and stripInternal would drop that statement
|
|
13
14
|
* from the emitted declarations.
|
|
14
15
|
*/
|
|
15
|
-
// ==================== constants and errors (P0; FA2_DEFAULTS / LAYOUT_TUNING_DEFAULTS public from P3
|
|
16
|
-
|
|
16
|
+
// ==================== constants and errors (P0; FA2_DEFAULTS / LAYOUT_TUNING_DEFAULTS public from P3, FR_DEFAULTS /
|
|
17
|
+
// SE_DEFAULTS from P5)
|
|
18
|
+
export { ARC_WINDOW_ALIGN, EXACT_MAX_NODES, FA2_DEFAULTS, FR_DEFAULTS, LAYOUT_TUNING_DEFAULTS, MAX_1D_ITEMS, MAX_WORKGROUPS_PER_DIM, SE_DEFAULTS, STORAGE_ALIGN, WORKGROUP_SIZE, } from "./constants.js";
|
|
17
19
|
export { hasErrorCode, isWebGpuGraphError, PASSTHROUGH_FORMAT_CODES, WebGpuGraphError, } from "./errors.js";
|
|
18
20
|
// ==================== context, adapter classifier, profiler (P0 / P1)
|
|
19
21
|
export { GpuContext } from "./context.js";
|
|
@@ -24,8 +26,10 @@ export { degree } from "./algorithms/degree.js";
|
|
|
24
26
|
export { connectedComponents } from "./algorithms/components.js";
|
|
25
27
|
export { pageRank, personalizedPageRank } from "./algorithms/pagerank.js";
|
|
26
28
|
export { eigenvectorCentrality, hits, katzCentrality } from "./algorithms/spectral.js";
|
|
27
|
-
// ==================== layouts and the accelerator (P3)
|
|
29
|
+
// ==================== layouts and the accelerator (P3; the two P5 factories)
|
|
28
30
|
export { createAccelerator } from "./accelerator.js";
|
|
29
31
|
export { createForceAtlas2 } from "./layouts/forceatlas2.js";
|
|
32
|
+
export { createFruchtermanReingold } from "./layouts/fruchterman-reingold.js";
|
|
30
33
|
export { seedPositions } from "./layouts/seed.js";
|
|
34
|
+
export { createSpringElectrical } from "./layouts/spring-electrical.js";
|
|
31
35
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD;;;;;;;;;;;;;GAaG;AAEH,qHAAqH;AACrH,uBAAuB;AACvB,OAAO,EACH,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,cAAc,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,YAAY,EACZ,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,GAEnB,MAAM,aAAa,CAAC;AAErB,uEAAuE;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,kFAAkF;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,+EAA+E;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEvF,8EAA8E;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prelude.d.ts","sourceRoot":"","sources":["../../../src/kernel/prelude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"prelude.d.ts","sourceRoot":"","sources":["../../../src/kernel/prelude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAkBH;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUpD;AAED,iHAAiH;AACjH,eAAO,MAAM,YAAY,EAAE,MA2CzB,CAAC;AAEH,8GAA8G;AAC9G,eAAO,MAAM,aAAa,EAAE,MAAwC,CAAC;AAErE,+DAA+D;AAC/D,eAAO,MAAM,6BAA6B,EAAE,MAoCsE,CAAC;AAEnH,mFAAmF;AACnF,eAAO,MAAM,4BAA4B,EAAE,MA2EuE,CAAC;AAEnH,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,+DAAgE,CAAC;AAEjG;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAchD,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* covers this file's template, so no u32 sentinel or workgroup-size literal is ever typed here.
|
|
10
10
|
*/
|
|
11
11
|
import { INVALID_INDEX } from "@graphty/graph-format";
|
|
12
|
-
import { FA2_COINCIDENT_SQ, FA2_DISTANCE_FLOOR, FA2_DISTANCE_FLOOR_SQ, FA2_FLAG_FIRST, MAX_WORKGROUPS_PER_DIM, U32_MAX, WORKGROUP_SIZE, } from "../constants.js";
|
|
12
|
+
import { FA2_COINCIDENT_SQ, FA2_DISTANCE_FLOOR, FA2_DISTANCE_FLOOR_SQ, FA2_FLAG_ADAPTIVE, FA2_FLAG_FIRST, FR_COOLING_PATIENCE, FR_COOLING_STEP, MAX_WORKGROUPS_PER_DIM, U32_MAX, WORKGROUP_SIZE, } from "../constants.js";
|
|
13
13
|
import { WebGpuGraphError } from "../errors.js";
|
|
14
14
|
/**
|
|
15
15
|
* Formats a finite number as a WGSL f32 literal that always carries a decimal point or an exponent (`0.01`,
|
|
@@ -37,6 +37,9 @@ const FA2_DIST_FLOOR: f32 = ${wgslF32Literal(FA2_DISTANCE_FLOOR)};
|
|
|
37
37
|
const FA2_DIST_FLOOR_SQ: f32 = ${wgslF32Literal(FA2_DISTANCE_FLOOR_SQ)};
|
|
38
38
|
const FA2_COINCIDENT_SQ: f32 = ${wgslF32Literal(FA2_COINCIDENT_SQ)};
|
|
39
39
|
const FA2_FLAG_FIRST: u32 = ${FA2_FLAG_FIRST}u;
|
|
40
|
+
const FA2_FLAG_ADAPTIVE: u32 = ${FA2_FLAG_ADAPTIVE}u;
|
|
41
|
+
const FR_COOLING_STEP: f32 = ${wgslF32Literal(FR_COOLING_STEP)};
|
|
42
|
+
const FR_COOLING_PATIENCE: u32 = ${FR_COOLING_PATIENCE}u;
|
|
40
43
|
const F32_MAX: f32 = 0x1.fffffep+127;
|
|
41
44
|
override WG: u32 = ${WORKGROUP_SIZE}u;
|
|
42
45
|
override USE_PERM: bool = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prelude.js","sourceRoot":"","sources":["../../../src/kernel/prelude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EACH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F;AAC1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAEjG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB,MAAM,CAAC,MAAM,CAC/D;;;;;;;;;;6CAUyC;KACpC,IAAI,EAAE;KACN,KAAK,CAAC,KAAK,CAAC,CACpB,CAAC"}
|
package/dist/src/kernels.d.ts
CHANGED
|
@@ -37,11 +37,11 @@ export declare const RANGE_PARAMS: UniformBlock;
|
|
|
37
37
|
export declare const REDUCE_PARAMS: UniformBlock;
|
|
38
38
|
/** `FillParams` (uniform, 16 B): `count` @0 words, `value` @4, `mode` @8 (0 = the constant `value`, 1 = iota `i + value`), `pad0` @12. */
|
|
39
39
|
export declare const FILL_PARAMS: UniformBlock;
|
|
40
|
-
/** `Fa2Params` (uniform,
|
|
40
|
+
/** `Fa2Params` (uniform, 128 B; spec 7.3): the per-iteration ForceAtlas2 parameters -- `n` @0, `dim` @4, `flags` @8 (bit 0 = FA2_FLAG_FIRST), `tierStart` @12, `tierEnd` @16, `iterationIndex` @20, `seed` @24, `nearMax` @28, `scalingRatio` @32, `gravity` @36, `jitterTolerance` @40, `scale` @44, `center` @48 (xyz, w 0), `settleThreshold` @64, `extentFactor` @68, `gridMax` @72, `levels` @76, `pad` @80 (reserved for the P4 GridSpec); the P5 model fields (PD-3): `frK` @96 (the FR optimal distance), `temperature` @100 (the FR temperature of this iteration), `springLength` @104, `springCoefficient` @108, `coulomb` @112 (ngraph's `gravity`, negative repels), `dragCoefficient` @116, `timeStep` @120, `pad1` @124; 128 B. */
|
|
41
41
|
export declare const FA2_PARAMS: UniformBlock;
|
|
42
|
-
/** `Fa2State` (storage, padded to STATE_HEADER_BYTES = 256; spec 7.3): the device-resident controller state the finalize kernels write and the host reads back for stats -- `speed` @0, `speedEfficiency` @4, `swing` @8, `traction` @12, `centroid` @16, `rmsRadius` @32, `radius` @36, `meanDisplacement` @40, `iteration` @44, `min` @48, `max` @64, `gridMin` @80 (P4), `eps` @96 (P4), `settledCount` @100, `outsideGrid` @104 (P4), `maxCellOccupancy` @108 (P4), `reserved0` .. `reserved8` @
|
|
42
|
+
/** `Fa2State` (storage, padded to STATE_HEADER_BYTES = 256; spec 7.3): the device-resident controller state the finalize kernels write and the host reads back for stats -- `speed` @0, `speedEfficiency` @4, `swing` @8, `traction` @12, `centroid` @16, `rmsRadius` @32, `radius` @36, `meanDisplacement` @40, `iteration` @44, `min` @48, `max` @64, `gridMin` @80 (P4), `eps` @96 (P4), `settledCount` @100, `outsideGrid` @104 (P4), `maxCellOccupancy` @108 (P4), `temperature` @112 (FR, written by K1 under STATS_MODE 1), `kineticEnergy` @116 (the preset, K1 under STATS_MODE 2), `reserved0` @120 (vec2f), `reserved1` .. `reserved8` @128 .. @240. */
|
|
43
43
|
export declare const FA2_STATE: UniformBlock;
|
|
44
|
-
/** `Fa2Trace` (storage record, 32 B; spec 7.3): one per-iteration trace record -- `swing` @0, `traction` @4, `speed` @8, `speedEfficiency` @12 (written by K4), `meanDisplacement` @16, `settledCount` @20, `iteration` @24 (written by K1), `
|
|
44
|
+
/** `Fa2Trace` (storage record, 32 B; spec 7.3): one per-iteration trace record -- `swing` @0, `traction` @4, `speed` @8, `speedEfficiency` @12 (written by K4), `meanDisplacement` @16, `settledCount` @20, `iteration` @24 (written by K1), `modelScalar` @28 (K1: the temperature under STATS_MODE 1, the kinetic energy under 2, 0 under 0); the trace region is `array<Fa2Trace>` at byte offset STATE_HEADER_BYTES of the state buffer. */
|
|
45
45
|
export declare const FA2_TRACE: UniformBlock;
|
|
46
46
|
/** `Fa2Partial` (storage record, 64 B; spec 7.3): one per-workgroup partial -- `sum` @0 (xyz = sum of positions, w = sum of |p - centroid|^2), `min` @16, `max` @32 (w = max of |p - centroid|^2, the exact layoutRadius source), written by K5; `swingTraction` @48 (written by K3's epilogue); `dispFree` @56 (x = sum |dp| over free rows, y = the free count as an f32 <= 256, written by K5). */
|
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aAAa,CACzB,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,OAAO,GAAG,IAAI,EACpB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GACzB,QAAQ,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,CASrE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC1B,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,OAAO,GAAG,IAAI,EACpB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GACzB,QAAQ,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAAC,CAGvD"}
|
package/dist/src/kernels.js
CHANGED
|
@@ -56,7 +56,7 @@ export const FILL_PARAMS = UniformBlock.define("FillParams", [
|
|
|
56
56
|
["mode", "u32"],
|
|
57
57
|
["pad0", "u32"],
|
|
58
58
|
]);
|
|
59
|
-
/** `Fa2Params` (uniform,
|
|
59
|
+
/** `Fa2Params` (uniform, 128 B; spec 7.3): the per-iteration ForceAtlas2 parameters -- `n` @0, `dim` @4, `flags` @8 (bit 0 = FA2_FLAG_FIRST), `tierStart` @12, `tierEnd` @16, `iterationIndex` @20, `seed` @24, `nearMax` @28, `scalingRatio` @32, `gravity` @36, `jitterTolerance` @40, `scale` @44, `center` @48 (xyz, w 0), `settleThreshold` @64, `extentFactor` @68, `gridMax` @72, `levels` @76, `pad` @80 (reserved for the P4 GridSpec); the P5 model fields (PD-3): `frK` @96 (the FR optimal distance), `temperature` @100 (the FR temperature of this iteration), `springLength` @104, `springCoefficient` @108, `coulomb` @112 (ngraph's `gravity`, negative repels), `dragCoefficient` @116, `timeStep` @120, `pad1` @124; 128 B. */
|
|
60
60
|
export const FA2_PARAMS = UniformBlock.define("Fa2Params", [
|
|
61
61
|
["n", "u32"],
|
|
62
62
|
["dim", "u32"],
|
|
@@ -76,8 +76,16 @@ export const FA2_PARAMS = UniformBlock.define("Fa2Params", [
|
|
|
76
76
|
["gridMax", "u32"],
|
|
77
77
|
["levels", "u32"],
|
|
78
78
|
["pad", "vec4f"],
|
|
79
|
+
["frK", "f32"],
|
|
80
|
+
["temperature", "f32"],
|
|
81
|
+
["springLength", "f32"],
|
|
82
|
+
["springCoefficient", "f32"],
|
|
83
|
+
["coulomb", "f32"],
|
|
84
|
+
["dragCoefficient", "f32"],
|
|
85
|
+
["timeStep", "f32"],
|
|
86
|
+
["pad1", "f32"],
|
|
79
87
|
]);
|
|
80
|
-
/** `Fa2State` (storage, padded to STATE_HEADER_BYTES = 256; spec 7.3): the device-resident controller state the finalize kernels write and the host reads back for stats -- `speed` @0, `speedEfficiency` @4, `swing` @8, `traction` @12, `centroid` @16, `rmsRadius` @32, `radius` @36, `meanDisplacement` @40, `iteration` @44, `min` @48, `max` @64, `gridMin` @80 (P4), `eps` @96 (P4), `settledCount` @100, `outsideGrid` @104 (P4), `maxCellOccupancy` @108 (P4), `reserved0` .. `reserved8` @
|
|
88
|
+
/** `Fa2State` (storage, padded to STATE_HEADER_BYTES = 256; spec 7.3): the device-resident controller state the finalize kernels write and the host reads back for stats -- `speed` @0, `speedEfficiency` @4, `swing` @8, `traction` @12, `centroid` @16, `rmsRadius` @32, `radius` @36, `meanDisplacement` @40, `iteration` @44, `min` @48, `max` @64, `gridMin` @80 (P4), `eps` @96 (P4), `settledCount` @100, `outsideGrid` @104 (P4), `maxCellOccupancy` @108 (P4), `temperature` @112 (FR, written by K1 under STATS_MODE 1), `kineticEnergy` @116 (the preset, K1 under STATS_MODE 2), `reserved0` @120 (vec2f), `reserved1` .. `reserved8` @128 .. @240. */
|
|
81
89
|
export const FA2_STATE = UniformBlock.define("Fa2State", [
|
|
82
90
|
["speed", "f32"],
|
|
83
91
|
["speedEfficiency", "f32"],
|
|
@@ -95,7 +103,10 @@ export const FA2_STATE = UniformBlock.define("Fa2State", [
|
|
|
95
103
|
["settledCount", "u32"],
|
|
96
104
|
["outsideGrid", "u32"],
|
|
97
105
|
["maxCellOccupancy", "u32"],
|
|
98
|
-
["
|
|
106
|
+
["temperature", "f32"],
|
|
107
|
+
["kineticEnergy", "f32"],
|
|
108
|
+
["frEnergy", "f32"],
|
|
109
|
+
["frProgress", "u32"],
|
|
99
110
|
["reserved1", "vec4f"],
|
|
100
111
|
["reserved2", "vec4f"],
|
|
101
112
|
["reserved3", "vec4f"],
|
|
@@ -105,7 +116,7 @@ export const FA2_STATE = UniformBlock.define("Fa2State", [
|
|
|
105
116
|
["reserved7", "vec4f"],
|
|
106
117
|
["reserved8", "vec4f"],
|
|
107
118
|
], { layout: "storage", padTo: STATE_HEADER_BYTES });
|
|
108
|
-
/** `Fa2Trace` (storage record, 32 B; spec 7.3): one per-iteration trace record -- `swing` @0, `traction` @4, `speed` @8, `speedEfficiency` @12 (written by K4), `meanDisplacement` @16, `settledCount` @20, `iteration` @24 (written by K1), `
|
|
119
|
+
/** `Fa2Trace` (storage record, 32 B; spec 7.3): one per-iteration trace record -- `swing` @0, `traction` @4, `speed` @8, `speedEfficiency` @12 (written by K4), `meanDisplacement` @16, `settledCount` @20, `iteration` @24 (written by K1), `modelScalar` @28 (K1: the temperature under STATS_MODE 1, the kinetic energy under 2, 0 under 0); the trace region is `array<Fa2Trace>` at byte offset STATE_HEADER_BYTES of the state buffer. */
|
|
109
120
|
export const FA2_TRACE = UniformBlock.define("Fa2Trace", [
|
|
110
121
|
["swing", "f32"],
|
|
111
122
|
["traction", "f32"],
|
|
@@ -114,7 +125,7 @@ export const FA2_TRACE = UniformBlock.define("Fa2Trace", [
|
|
|
114
125
|
["meanDisplacement", "f32"],
|
|
115
126
|
["settledCount", "u32"],
|
|
116
127
|
["iteration", "u32"],
|
|
117
|
-
["
|
|
128
|
+
["modelScalar", "f32"],
|
|
118
129
|
], { layout: "storage" });
|
|
119
130
|
/** `Fa2Partial` (storage record, 64 B; spec 7.3): one per-workgroup partial -- `sum` @0 (xyz = sum of positions, w = sum of |p - centroid|^2), `min` @16, `max` @32 (w = max of |p - centroid|^2, the exact layoutRadius source), written by K5; `swingTraction` @48 (written by K3's epilogue); `dispFree` @56 (x = sum |dp| over free rows, y = the free count as an f32 <= 256, written by K5). */
|
|
120
131
|
export const FA2_PARTIAL = UniformBlock.define("Fa2Partial", [
|
|
@@ -253,7 +264,7 @@ const SEGMENTED_REDUCE = {
|
|
|
253
264
|
snippetSlots: ["VALUE"],
|
|
254
265
|
phase: "P2",
|
|
255
266
|
};
|
|
256
|
-
/** `fa2-stats-finalize` (K1, 3.10.1): the one-workgroup fold of the previous integrate's partials into the state block and the K1 half of the trace record; 3 storage bindings; calls the reduction helpers. */
|
|
267
|
+
/** `fa2-stats-finalize` (K1, 3.10.1): the one-workgroup fold of the previous integrate's partials into the state block and the K1 half of the trace record; STATS_MODE 0 FA2 / 1 FR temperature / 2 kinetic energy (P5); 3 storage bindings; calls the reduction helpers. */
|
|
257
268
|
const FA2_STATS_FINALIZE = {
|
|
258
269
|
id: "fa2-stats-finalize",
|
|
259
270
|
body: fa2StatsFinalizeWgsl,
|
|
@@ -264,13 +275,13 @@ const FA2_STATS_FINALIZE = {
|
|
|
264
275
|
decl(1, 2, "T", "storage", "array<Fa2Trace>"),
|
|
265
276
|
decl(2, 0, "P", "uniform", "Fa2Params"),
|
|
266
277
|
],
|
|
267
|
-
overrideDecls: [],
|
|
278
|
+
overrideDecls: [{ name: "STATS_MODE", type: "u32", default: 0 }],
|
|
268
279
|
uniforms: [FA2_PARAMS, FA2_STATE, FA2_TRACE, FA2_PARTIAL],
|
|
269
280
|
needs: ["subgroups"],
|
|
270
281
|
snippetSlots: [],
|
|
271
282
|
phase: "P3",
|
|
272
283
|
};
|
|
273
|
-
/** `fa2-attraction` (K2, 3.10.1): the thread-per-row attraction gather over the CSR rows (the first writer of `force` each iteration); LINLOG / DISTRIBUTED / TIER 0 plus the standard USE_PERM / HAS_WEIGHTS; 6 storage bindings. */
|
|
284
|
+
/** `fa2-attraction` (K2, 3.10.1): the thread-per-row attraction gather over the CSR rows (the first writer of `force` each iteration); LINLOG / DISTRIBUTED / TIER 0 plus the standard USE_PERM / HAS_WEIGHTS; LAW 0 FA2 / 1 FR / 2 spring (P5); 6 storage bindings. */
|
|
274
285
|
const FA2_ATTRACTION = {
|
|
275
286
|
id: "fa2-attraction",
|
|
276
287
|
body: fa2AttractionWgsl,
|
|
@@ -280,13 +291,14 @@ const FA2_ATTRACTION = {
|
|
|
280
291
|
{ name: "LINLOG", type: "bool", default: false },
|
|
281
292
|
{ name: "DISTRIBUTED", type: "bool", default: false },
|
|
282
293
|
{ name: "TIER", type: "u32", default: 0 },
|
|
294
|
+
{ name: "LAW", type: "u32", default: 0 },
|
|
283
295
|
],
|
|
284
296
|
uniforms: [FA2_PARAMS],
|
|
285
297
|
needs: [],
|
|
286
298
|
snippetSlots: [],
|
|
287
299
|
phase: "P3",
|
|
288
300
|
};
|
|
289
|
-
/** `fa2-repulsion-exact` (K3, 3.10.1): the tiled all-pairs repulsion with the gravity and swing / traction epilogue; 6 storage bindings (`oldForce` read-only: it only calls load_old); calls the reduction helpers. */
|
|
301
|
+
/** `fa2-repulsion-exact` (K3, 3.10.1): the tiled all-pairs repulsion with the gravity and swing / traction epilogue; LAW 0 FA2 / 1 FR / 2 coulomb (P5); 6 storage bindings (`oldForce` read-only: it only calls load_old); calls the reduction helpers. */
|
|
290
302
|
const FA2_REPULSION_EXACT = {
|
|
291
303
|
id: "fa2-repulsion-exact",
|
|
292
304
|
body: fa2RepulsionExactWgsl,
|
|
@@ -304,6 +316,7 @@ const FA2_REPULSION_EXACT = {
|
|
|
304
316
|
{ name: "SWING_MODE", type: "u32", default: 0 },
|
|
305
317
|
{ name: "STRONG_GRAVITY", type: "bool", default: false },
|
|
306
318
|
{ name: "GRAVITY_CENTER", type: "u32", default: 0 },
|
|
319
|
+
{ name: "LAW", type: "u32", default: 0 },
|
|
307
320
|
],
|
|
308
321
|
uniforms: [FA2_PARAMS, FA2_STATE, FA2_PARTIAL],
|
|
309
322
|
needs: ["subgroups"],
|
|
@@ -327,7 +340,7 @@ const FA2_SPEED_FINALIZE = {
|
|
|
327
340
|
snippetSlots: [],
|
|
328
341
|
phase: "P1",
|
|
329
342
|
};
|
|
330
|
-
/** `fa2-integrate` (K5, 3.10.1): the per-node speed factor and position update (no clamp, D25), `oldForce` stored in SWING_MODE 0, and the partials A / C of the next K1; 6 storage bindings; calls the reduction helpers. */
|
|
343
|
+
/** `fa2-integrate` (K5, 3.10.1): the per-node speed factor and position update (no clamp, D25), `oldForce` stored in SWING_MODE 0, and the partials A / C of the next K1; APPLY 0 FA2 / 1 FR temperature cap / 2 ngraph Euler (P5); 6 storage bindings; calls the reduction helpers. */
|
|
331
344
|
const FA2_INTEGRATE = {
|
|
332
345
|
id: "fa2-integrate",
|
|
333
346
|
body: fa2IntegrateWgsl,
|
|
@@ -341,7 +354,10 @@ const FA2_INTEGRATE = {
|
|
|
341
354
|
decl(1, 5, "partials", "storage", "array<Fa2Partial>"),
|
|
342
355
|
decl(2, 0, "P", "uniform", "Fa2Params"),
|
|
343
356
|
],
|
|
344
|
-
overrideDecls: [
|
|
357
|
+
overrideDecls: [
|
|
358
|
+
{ name: "SWING_MODE", type: "u32", default: 0 },
|
|
359
|
+
{ name: "APPLY", type: "u32", default: 0 },
|
|
360
|
+
],
|
|
345
361
|
uniforms: [FA2_PARAMS, FA2_STATE, FA2_PARTIAL],
|
|
346
362
|
needs: ["subgroups"],
|
|
347
363
|
snippetSlots: [],
|