@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.
Files changed (88) hide show
  1. package/README.md +27 -21
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{context-CRbw2Wyo.js → context-BR7fx3vR.js} +47 -5
  4. package/dist/chunks/context-BR7fx3vR.js.map +1 -0
  5. package/dist/node.js +1 -1
  6. package/dist/src/accelerator.d.ts +12 -10
  7. package/dist/src/accelerator.d.ts.map +1 -1
  8. package/dist/src/accelerator.js +32 -10
  9. package/dist/src/accelerator.js.map +1 -1
  10. package/dist/src/constants.d.ts +47 -0
  11. package/dist/src/constants.d.ts.map +1 -1
  12. package/dist/src/constants.js +47 -0
  13. package/dist/src/constants.js.map +1 -1
  14. package/dist/src/index.d.ts +7 -4
  15. package/dist/src/index.d.ts.map +1 -1
  16. package/dist/src/index.js +9 -5
  17. package/dist/src/index.js.map +1 -1
  18. package/dist/src/kernel/prelude.d.ts.map +1 -1
  19. package/dist/src/kernel/prelude.js +4 -1
  20. package/dist/src/kernel/prelude.js.map +1 -1
  21. package/dist/src/kernels.d.ts +3 -3
  22. package/dist/src/kernels.d.ts.map +1 -1
  23. package/dist/src/kernels.js +27 -11
  24. package/dist/src/kernels.js.map +1 -1
  25. package/dist/src/layouts/force-simulation.d.ts +3 -1
  26. package/dist/src/layouts/force-simulation.d.ts.map +1 -1
  27. package/dist/src/layouts/force-simulation.js +13 -3
  28. package/dist/src/layouts/force-simulation.js.map +1 -1
  29. package/dist/src/layouts/forceatlas2.d.ts +1 -3
  30. package/dist/src/layouts/forceatlas2.d.ts.map +1 -1
  31. package/dist/src/layouts/forceatlas2.js +2 -191
  32. package/dist/src/layouts/forceatlas2.js.map +1 -1
  33. package/dist/src/layouts/fruchterman-reingold.d.ts +195 -0
  34. package/dist/src/layouts/fruchterman-reingold.d.ts.map +1 -0
  35. package/dist/src/layouts/fruchterman-reingold.js +579 -0
  36. package/dist/src/layouts/fruchterman-reingold.js.map +1 -0
  37. package/dist/src/layouts/model-common.d.ts +102 -0
  38. package/dist/src/layouts/model-common.d.ts.map +1 -0
  39. package/dist/src/layouts/model-common.js +198 -0
  40. package/dist/src/layouts/model-common.js.map +1 -0
  41. package/dist/src/layouts/spring-electrical.d.ts +179 -0
  42. package/dist/src/layouts/spring-electrical.d.ts.map +1 -0
  43. package/dist/src/layouts/spring-electrical.js +508 -0
  44. package/dist/src/layouts/spring-electrical.js.map +1 -0
  45. package/dist/src/types/accelerator.d.ts +7 -3
  46. package/dist/src/types/accelerator.d.ts.map +1 -1
  47. package/dist/src/types/layout.d.ts +32 -0
  48. package/dist/src/types/layout.d.ts.map +1 -1
  49. package/dist/src/types/options.d.ts +43 -1
  50. package/dist/src/types/options.d.ts.map +1 -1
  51. package/dist/src/wgsl/fa2-attraction.wgsl.d.ts +5 -2
  52. package/dist/src/wgsl/fa2-attraction.wgsl.d.ts.map +1 -1
  53. package/dist/src/wgsl/fa2-attraction.wgsl.js +6 -1
  54. package/dist/src/wgsl/fa2-attraction.wgsl.js.map +1 -1
  55. package/dist/src/wgsl/fa2-integrate.wgsl.d.ts +7 -2
  56. package/dist/src/wgsl/fa2-integrate.wgsl.d.ts.map +1 -1
  57. package/dist/src/wgsl/fa2-integrate.wgsl.js +28 -2
  58. package/dist/src/wgsl/fa2-integrate.wgsl.js.map +1 -1
  59. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts +4 -2
  60. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts.map +1 -1
  61. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js +14 -5
  62. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js.map +1 -1
  63. package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts +8 -1
  64. package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts.map +1 -1
  65. package/dist/src/wgsl/fa2-stats-finalize.wgsl.js +33 -0
  66. package/dist/src/wgsl/fa2-stats-finalize.wgsl.js.map +1 -1
  67. package/dist/tsconfig.build.tsbuildinfo +1 -1
  68. package/dist/webgpu-graph-algorithms.js +1358 -284
  69. package/dist/webgpu-graph-algorithms.js.map +1 -1
  70. package/package.json +6 -4
  71. package/src/accelerator.ts +46 -12
  72. package/src/constants.ts +70 -0
  73. package/src/index.ts +15 -5
  74. package/src/kernel/prelude.ts +6 -0
  75. package/src/kernels.ts +27 -11
  76. package/src/layouts/force-simulation.ts +20 -3
  77. package/src/layouts/forceatlas2.ts +17 -220
  78. package/src/layouts/fruchterman-reingold.ts +737 -0
  79. package/src/layouts/model-common.ts +228 -0
  80. package/src/layouts/spring-electrical.ts +666 -0
  81. package/src/types/accelerator.ts +15 -3
  82. package/src/types/layout.ts +36 -0
  83. package/src/types/options.ts +45 -1
  84. package/src/wgsl/fa2-attraction.wgsl.ts +6 -1
  85. package/src/wgsl/fa2-integrate.wgsl.ts +28 -2
  86. package/src/wgsl/fa2-repulsion-exact.wgsl.ts +14 -5
  87. package/src/wgsl/fa2-stats-finalize.wgsl.ts +33 -0
  88. package/dist/chunks/context-CRbw2Wyo.js.map +0 -1
@@ -0,0 +1,579 @@
1
+ /**
2
+ * Fruchterman-Reingold on the exact repulsion tier (spec 7.20; contract 3.13): the ForceModel that ForceSimulation
3
+ * drives -- the K1 K2 K3 K5 sequence per iteration and toScene per batch (no K4: no speed controller), the constant
4
+ * override set (`LAW` 1 on K2 / K3, `APPLY` 1 on K5, `STATS_MODE` 1 on K1, PD-1), the per-iteration Fa2Params values
5
+ * with the cooling schedule's temperature (PD-5), the controller resets and the stats decoder -- plus the option
6
+ * resolver and `createFruchtermanReingold`. The model shares FA2's four kernels, buffers and blocks: `oldForce` is
7
+ * allocated, bound and never read (K5 compiles `SWING_MODE = 1`, PD-2 / PD-20); the mass lane is 1 for every node
8
+ * and weights are ignored (PD-11); the `fixed` option resolves at load through ModelInputs.fixed (PD-6); a
9
+ * `setParams({ fixed })` patch is E_INVALID_ARGUMENT (PD-16).
10
+ *
11
+ * The temperature index (PD-5): the simulation hands paramsFor the GLOBAL iteration index, which load() restarts at 0
12
+ * and reheat() does not touch. The model keeps `tempOrigin` (the global index at which the temperature index is 0):
13
+ * onLoad sets it to 0; onReheat arms `pendingReheat`; the first paramsFor(global) after it sets
14
+ * `tempOrigin = global - floor(0.7 * iterations)`, so the temperature restarts at floor(0.7 * iterations) exactly as
15
+ * the CPU's reheat() does. The temperature is `max(0, 0.1 - dt * (global - tempOrigin))`, dt = 0.1 / (iterations + 1);
16
+ * at 0 nothing moves and the settle window closes the run (DEP-P5-C: the budget restarts at 0, the temperature does
17
+ * not).
18
+ */
19
+ import { FA2_FLAG_ADAPTIVE, FR_ADAPTIVE_MAX_ITERATIONS, FR_DEFAULTS, FR_REHEAT_FRACTION, FR_START_TEMPERATURE, MAX_ITERATIONS_PER_STEP, TRACE_RECORD_BYTES, UNIFORM_SLOT_BYTES, } from "../constants.js";
20
+ import { BufferUsage } from "../device/webgpu-constants.js";
21
+ import { WebGpuGraphError } from "../errors.js";
22
+ import { plan1d } from "../kernel/dispatch.js";
23
+ import { FA2_PARAMS, FA2_STATE, FA2_TRACE, FILL_PARAMS, graphBindings, kernelSpec } from "../kernels.js";
24
+ import { ForceSimulation, } from "./force-simulation.js";
25
+ import { resolveLayoutTuning } from "./forceatlas2.js";
26
+ import { describeValue, FILL_PARAMS_BUFFER, FORCE_BYTES_PER_NODE, invalid, isPositiveInteger, pickCenter, pickDim, pickNumber, pickSeed, scalar, seedWord, subset, vector, } from "./model-common.js";
27
+ // ============================================================ constants
28
+ /** The stage names of one iteration in dispatch order plus the per-batch toScene (spec 7.20: no K4). */
29
+ const FR_STAGES = ["K1", "K2", "K3", "K5", "toScene"];
30
+ /** The one-workgroup dispatch of K1 (spec 7.4). */
31
+ const ONE_WORKGROUP = { x: 1, y: 1, z: 1, items: 1, stride: null };
32
+ /** The model's override set, constant for every option record (PD-1, PD-20). */
33
+ const FR_OVERRIDES = Object.freeze({
34
+ LINLOG: false,
35
+ DISTRIBUTED: false,
36
+ TIER: 0,
37
+ SWING_MODE: 1,
38
+ STRONG_GRAVITY: false,
39
+ GRAVITY_CENTER: 0,
40
+ LAW: 1,
41
+ APPLY: 1,
42
+ STATS_MODE: 1,
43
+ });
44
+ /** Every override each kernel accepts, with its default (the names its registry entry declares). */
45
+ const K1_DEFAULTS = { STATS_MODE: 0 };
46
+ const K2_DEFAULTS = {
47
+ LINLOG: false,
48
+ DISTRIBUTED: false,
49
+ TIER: 0,
50
+ USE_PERM: false,
51
+ HAS_WEIGHTS: false,
52
+ LAW: 0,
53
+ };
54
+ const K3_DEFAULTS = { SWING_MODE: 0, STRONG_GRAVITY: false, GRAVITY_CENTER: 0, LAW: 0 };
55
+ const K5_DEFAULTS = { SWING_MODE: 0, APPLY: 0 };
56
+ /** The resolved record with no option given: FR_DEFAULTS plus the null / origin defaults. */
57
+ const DEFAULT_RESOLVED = Object.freeze({
58
+ ...FR_DEFAULTS,
59
+ center: [0, 0, 0],
60
+ seed: null,
61
+ });
62
+ // ============================================================ the resolver
63
+ /**
64
+ * The `k` option: undefined keeps the fallback; null, 0 and NaN mean the auto default (null); else a finite
65
+ * number > 0.
66
+ * @param given - the value given
67
+ * @param fallback - the previous record's value or the default
68
+ * @returns k or null
69
+ */
70
+ function resolveK(given, fallback) {
71
+ if (given === undefined) {
72
+ return fallback;
73
+ }
74
+ if (given === null || given === 0 || Number.isNaN(given)) {
75
+ return null;
76
+ }
77
+ return pickNumber("k", given, 1, (v) => v > 0, "> 0 or null");
78
+ }
79
+ /**
80
+ * The `cooling` option: undefined keeps the fallback; else one of the two schedule names.
81
+ * @param given - the value given
82
+ * @param fallback - the previous record's value or the default
83
+ * @returns the schedule
84
+ */
85
+ function pickCooling(given, fallback) {
86
+ if (given === undefined) {
87
+ return fallback;
88
+ }
89
+ if (given === "linear" || given === "adaptive") {
90
+ return given;
91
+ }
92
+ throw invalid("cooling", given, '"linear" | "adaptive"');
93
+ }
94
+ /**
95
+ * Applies FR_DEFAULTS to the option record and validates every range (spec 7.20, 9.3). `k`: null, 0 and NaN mean the
96
+ * auto default `1 / sqrt(n)` (the CPU's `if (!k)`, `layout/src/simulation/fruchterman-reingold.ts:140-152`); a
97
+ * negative or infinite k is E_INVALID_ARGUMENT. `iterations` is an integer >= 0 (0: settled at load); under
98
+ * `cooling: "adaptive"` it is only the run's cap and a fresh record without one gets FR_ADAPTIVE_MAX_ITERATIONS. `fixed` is a
99
+ * NodeMask, a bool node column name or null. With `previous` the record is a PATCH over it and `maxInFlight` may not
100
+ * change (the uniform ring is sized by it at construction).
101
+ * @param options - the caller's options (or a setParams patch)
102
+ * @param previous - the current resolved record when resolving a patch
103
+ * @returns the frozen resolved record
104
+ */
105
+ export function resolveFruchtermanReingoldOptions(options, previous) {
106
+ const o = options ?? {};
107
+ const base = previous ?? DEFAULT_RESOLVED;
108
+ if (previous !== undefined && o.maxInFlight !== undefined && o.maxInFlight !== previous.maxInFlight) {
109
+ throw new WebGpuGraphError("E_INVALID_ARGUMENT", `maxInFlight cannot change after creation (the uniform ring is sized by it): got ${describeValue(o.maxInFlight)}, current ${previous.maxInFlight}`, { argument: "maxInFlight", value: o.maxInFlight, expected: previous.maxInFlight });
110
+ }
111
+ const fixed = o.fixed === undefined ? base.fixed : o.fixed;
112
+ if (fixed !== null && typeof fixed !== "string" && !(fixed instanceof Uint32Array)) {
113
+ throw invalid("fixed", fixed, "a NodeMask (Uint32Array), the name of a bool node column, or null");
114
+ }
115
+ const cooling = pickCooling(o.cooling, base.cooling);
116
+ // under adaptive cooling `iterations` is only a cap: a fresh record without one gets the adaptive budget, not the schedule's 50
117
+ const iterationsFallback = previous === undefined && cooling === "adaptive" && o.iterations === undefined
118
+ ? FR_ADAPTIVE_MAX_ITERATIONS
119
+ : base.iterations;
120
+ const resolved = {
121
+ k: resolveK(o.k, base.k),
122
+ iterations: pickNumber("iterations", o.iterations, iterationsFallback, (v) => Number.isInteger(v) && v >= 0, "an integer >= 0"),
123
+ cooling,
124
+ fixed: fixed,
125
+ dim: pickDim(o.dim, base.dim),
126
+ scale: pickNumber("scale", o.scale, base.scale, (v) => v > 0, "> 0"),
127
+ center: pickCenter(o.center, base.center),
128
+ seed: pickSeed(o.seed, base.seed),
129
+ settleThreshold: pickNumber("settleThreshold", o.settleThreshold, base.settleThreshold, (v) => v >= 0, ">= 0"),
130
+ settleWindow: pickNumber("settleWindow", o.settleWindow, base.settleWindow, isPositiveInteger, "an integer >= 1"),
131
+ iterationsPerStep: pickNumber("iterationsPerStep", o.iterationsPerStep, base.iterationsPerStep, (v) => isPositiveInteger(v) && v <= MAX_ITERATIONS_PER_STEP, `an integer in [1, ${MAX_ITERATIONS_PER_STEP}]`),
132
+ maxInFlight: pickNumber("maxInFlight", o.maxInFlight, base.maxInFlight, isPositiveInteger, "an integer >= 1"),
133
+ };
134
+ return Object.freeze(resolved);
135
+ }
136
+ /**
137
+ * The fixed mask of a load (spec 7.12; the rule of `layout/src/simulation/fruchterman-reingold.ts:576-606` minus its
138
+ * "previous pins" clause, which ForceSimulation.load() implements by keeping the words on a same-size reload): a
139
+ * string names a bool node column (E_INVALID_ARGUMENT when absent or not bool); a mask is copied; null takes the
140
+ * role-"fixed" bool column when present, else null (leave the words as they are).
141
+ * @param s - the snapshot being loaded
142
+ * @param spec - the resolved `fixed` option
143
+ * @returns the mask words to apply at load, or null
144
+ */
145
+ function resolveFixed(s, spec) {
146
+ const words = Math.ceil(s.nodeCount / 32);
147
+ if (typeof spec === "string") {
148
+ const column = s.nodes.get(spec);
149
+ if (column === null) {
150
+ throw invalid("fixed", spec, `the name of a bool node column (the snapshot holds no node column "${spec}")`);
151
+ }
152
+ if (column.dtype !== "bool") {
153
+ throw invalid("fixed", spec, `the name of a bool node column ("${spec}" is ${column.dtype})`);
154
+ }
155
+ return new Uint32Array(column.data.subarray(0, words));
156
+ }
157
+ if (spec !== null) {
158
+ if (spec.length < words) {
159
+ throw invalid("fixed", spec.length, `a mask of at least ${words} words for ${s.nodeCount} nodes`);
160
+ }
161
+ return new Uint32Array(spec.subarray(0, words));
162
+ }
163
+ const byRole = s.nodes.byRole("fixed");
164
+ if (byRole !== null && byRole.dtype === "bool") {
165
+ return new Uint32Array(byRole.data.subarray(0, words));
166
+ }
167
+ return null;
168
+ }
169
+ /** The Fruchterman-Reingold model (spec 7.20: K1 K2 K3 K5 per iteration; toScene once per batch). Stages: ["K1", "K2", "K3", "K5", "toScene"]. */
170
+ export class FruchtermanReingoldModel {
171
+ /**
172
+ * Creates the model for one simulation.
173
+ * @param tuning - the resolved GPU-only tuning (the tier rule; compat has no effect on this model)
174
+ * @param resolved - the resolved option record at creation
175
+ */
176
+ constructor(tuning, resolved) {
177
+ /** The model kind of spec 7.19. */
178
+ this.kind = "fruchtermanReingold";
179
+ /** The stage names in dispatch order (the `upTo` vocabulary of recordIteration and debugRunStages). */
180
+ this.stages = FR_STAGES;
181
+ /** Fa2Params: the per-iteration uniform block (the simulation writes the shared fields into it). */
182
+ this.params = FA2_PARAMS;
183
+ /** Fa2State: the state header block. */
184
+ this.state = FA2_STATE;
185
+ /** Fa2Trace: one record per iteration of a batch. */
186
+ this.trace = FA2_TRACE;
187
+ /** The global iteration index at which the temperature index is 0 (PD-5). */
188
+ this.tempOrigin = 0;
189
+ /** Armed by onReheat(); consumed by the next paramsFor(), which re-anchors tempOrigin (PD-5). */
190
+ this.pendingReheat = false;
191
+ this.resources = null;
192
+ this.bound = null;
193
+ /** The K1-K5 compute pass of the batch being recorded, keyed by CommandBatch.id (one pass per batch, contract 4.4). */
194
+ this.openPass = null;
195
+ this.tuning = tuning;
196
+ this.current = resolved;
197
+ }
198
+ /**
199
+ * force 12n and oldForce 12n (zeroed; bound and never read, PD-2) plus the 256-byte FillParams uniform buffer the
200
+ * fill dispatch reads. n = 0 reports one node's worth of bytes so no zero-length buffer is ever created.
201
+ * @param n - the node count
202
+ * @param _dim - the layout dimension (the force arrays are stride 3 in both)
203
+ * @returns the three model-owned buffer specs
204
+ */
205
+ buffers(n, _dim) {
206
+ const bytes = Math.max(1, n) * FORCE_BYTES_PER_NODE;
207
+ const usage = BufferUsage.STORAGE | BufferUsage.COPY_SRC | BufferUsage.COPY_DST;
208
+ return [
209
+ { name: "force", byteLength: bytes, usage, zero: true },
210
+ { name: "oldForce", byteLength: bytes, usage, zero: true },
211
+ {
212
+ name: FILL_PARAMS_BUFFER,
213
+ byteLength: UNIFORM_SLOT_BYTES,
214
+ usage: BufferUsage.UNIFORM | BufferUsage.COPY_DST,
215
+ zero: false,
216
+ },
217
+ ];
218
+ }
219
+ /**
220
+ * Mass 1 for every node and no weights (PD-11: FR has no mass and ignores weights), the fixed mask of the
221
+ * `fixed` option applied at load (PD-6). The tier rule is the simulation's (load() throws for the grid tier
222
+ * before calling this).
223
+ * @param s - the snapshot being loaded
224
+ * @param options - the simulation's current option record
225
+ * @returns the per-load inputs
226
+ */
227
+ inputs(s, options) {
228
+ const resolved = resolveFruchtermanReingoldOptions(options, this.current);
229
+ return {
230
+ mass: new Float32Array(s.nodeCount).fill(1),
231
+ weights: { data: null, source: "none", column: null },
232
+ fixed: resolveFixed(s, resolved.fixed),
233
+ };
234
+ }
235
+ /**
236
+ * The constant FR override set (PD-1): no option changes a law, so setParams never recompiles.
237
+ * @param _options - an option record (unused: the set is constant)
238
+ * @returns the model's own override set
239
+ */
240
+ overrides(_options) {
241
+ return FR_OVERRIDES;
242
+ }
243
+ /**
244
+ * The six module specs of an override set in dispatch order -- K1, K2, K3, K5, toScene, fill -- each with only the
245
+ * override names its entry declares (K2 also USE_PERM / HAS_WEIGHTS), for warm() and the compile matrix.
246
+ * @param overrides - the merged override set (the model's plus USE_PERM / HAS_WEIGHTS)
247
+ * @param _subgroups - accepted for the ForceModel interface and unused (the composer picks the twin from caps)
248
+ * @returns the specs
249
+ */
250
+ specs(overrides, _subgroups) {
251
+ return [
252
+ kernelSpec("fa2-stats-finalize", subset(overrides, K1_DEFAULTS)),
253
+ kernelSpec("fa2-attraction", subset(overrides, K2_DEFAULTS)),
254
+ kernelSpec("fa2-repulsion-exact", subset(overrides, K3_DEFAULTS)),
255
+ kernelSpec("fa2-integrate", subset(overrides, K5_DEFAULTS)),
256
+ kernelSpec("fa2-to-scene"),
257
+ kernelSpec("fill"),
258
+ ];
259
+ }
260
+ /**
261
+ * Compiles (through the cache) and binds every kernel against the buffers of this load(): K1, K2 (or the fill of
262
+ * force when arcCount === 0), K3, K5, toScene; writes the FillParams { count: 3n, value: 0, mode: 0 } into the
263
+ * model's uniform buffer. With n === 0 nothing is bound.
264
+ * @param resources - the graph, the shared and model buffers, the ring and the cache
265
+ * @param overrides - the merged override set
266
+ */
267
+ async bind(resources, overrides) {
268
+ this.dropBound();
269
+ this.resources = resources;
270
+ const { n, pipelines, caps, core, perm, ring, device } = resources;
271
+ if (n === 0) {
272
+ return;
273
+ }
274
+ // sequential on purpose: PipelineCache.get compiles inside a validation scope, one stack per device
275
+ const k1 = await pipelines.kernel(kernelSpec("fa2-stats-finalize", subset(overrides, K1_DEFAULTS)));
276
+ const k2 = await pipelines.kernel(kernelSpec("fa2-attraction", subset(overrides, K2_DEFAULTS)));
277
+ const k3 = await pipelines.kernel(kernelSpec("fa2-repulsion-exact", subset(overrides, K3_DEFAULTS)));
278
+ const k5 = await pipelines.kernel(kernelSpec("fa2-integrate", subset(overrides, K5_DEFAULTS)));
279
+ const toScene = await pipelines.kernel(kernelSpec("fa2-to-scene"));
280
+ const fill = await pipelines.kernel(kernelSpec("fill"));
281
+ if (this.resources !== resources) {
282
+ // a newer bind() superseded this one while the pipelines compiled; its own bind groups stand
283
+ return;
284
+ }
285
+ const pos = resources.buffer("positions");
286
+ const scene = resources.buffer("scenePositions");
287
+ const fixed = resources.buffer("fixed");
288
+ const partials = resources.buffer("partials");
289
+ const state = resources.buffer("state");
290
+ const trace = resources.buffer("trace");
291
+ const force = resources.buffer("force");
292
+ const oldForce = resources.buffer("oldForce");
293
+ const fillParamsBuffer = resources.buffer(FILL_PARAMS_BUFFER);
294
+ const params = ring.binding(FA2_PARAMS);
295
+ const fillParams = {
296
+ buffer: fillParamsBuffer.buffer,
297
+ offset: fillParamsBuffer.offset,
298
+ size: FILL_PARAMS.byteLength,
299
+ window: null,
300
+ };
301
+ const fillBytes = new ArrayBuffer(FILL_PARAMS.byteLength);
302
+ FILL_PARAMS.write(new DataView(fillBytes), { count: 3 * n, value: 0, mode: 0 });
303
+ device.queue.writeBuffer(fillParamsBuffer.buffer, fillParamsBuffer.offset, fillBytes);
304
+ const hasArcs = core.colIdx !== null;
305
+ const wg = k1.workgroupSize;
306
+ this.bound = {
307
+ n,
308
+ plan: plan1d(n, wg, caps),
309
+ fillPlan: plan1d(3 * n, wg, caps),
310
+ k1,
311
+ k1Bound: k1.bind({ partials, S: state, T: trace, P: params }),
312
+ k2,
313
+ k2Bound: hasArcs
314
+ ? k2.bind({ ...graphBindings(core, perm, resources.weights), pos, force, P: params })
315
+ : null,
316
+ k3,
317
+ k3Bound: k3.bind({ pos, S: state, force, oldForce, fixedMask: fixed, partials, P: params }),
318
+ k5,
319
+ k5Bound: k5.bind({ force, oldForce, fixedMask: fixed, S: state, pos, partials, P: params }),
320
+ toScene,
321
+ toSceneBound: toScene.bind({ pos, scene, P: params }),
322
+ fill,
323
+ fillForceBound: hasArcs ? null : fill.bind({ dst: force, P: fillParams }),
324
+ };
325
+ }
326
+ /**
327
+ * The Fa2Params values of one iteration: the FA2 fields at their neutral values (scalingRatio, gravity and
328
+ * jitterTolerance 0), `frK` = k or 1 / sqrt(n), and this iteration's temperature (PD-5 anchors here). Under
329
+ * `cooling: "adaptive"` the flags carry FA2_FLAG_ADAPTIVE and the kernels take the temperature from the state
330
+ * block instead (K1 updates it, K5 reads it); the uniform's value is then the start temperature and unused. The
331
+ * simulation overwrites the shared fields with the same values and OR-s in its own flags.
332
+ * @param iteration - the GLOBAL iteration index
333
+ * @param options - the simulation's current option record
334
+ * @returns the uniform values
335
+ */
336
+ paramsFor(iteration, options) {
337
+ const { n } = this.requireResources();
338
+ const resolved = resolveFruchtermanReingoldOptions(options, this.current);
339
+ const { nearMax, extentFactor } = this.tuning;
340
+ const adaptive = resolved.cooling === "adaptive";
341
+ return {
342
+ n,
343
+ dim: resolved.dim,
344
+ flags: adaptive ? FA2_FLAG_ADAPTIVE : 0,
345
+ tierStart: 0,
346
+ tierEnd: n,
347
+ iterationIndex: iteration,
348
+ seed: seedWord(resolved.seed),
349
+ nearMax,
350
+ scalingRatio: 0,
351
+ gravity: 0,
352
+ jitterTolerance: 0,
353
+ scale: resolved.scale,
354
+ center: [resolved.center[0], resolved.center[1], resolved.center[2], 0],
355
+ settleThreshold: resolved.settleThreshold,
356
+ extentFactor,
357
+ gridMax: 0,
358
+ levels: 0,
359
+ pad: [0, 0, 0, 0],
360
+ frK: resolved.k ?? 1 / Math.sqrt(n),
361
+ temperature: adaptive ? FR_START_TEMPERATURE : this.temperatureAt(iteration, resolved),
362
+ };
363
+ }
364
+ /**
365
+ * Records one iteration into the batch: K1, K2 (or the fill of force when arcCount === 0), K3, K5 in the batch's
366
+ * ONE compute pass (opened by the first call of a batch and reused by every later call with the same batch.id),
367
+ * then toScene in a second pass that ends it, stopping after stage `upTo` when given. With n === 0 nothing is
368
+ * recorded; a call before bind() completed is E_NOT_LOADED (never a silent no-op).
369
+ * @param batch - the batch being recorded
370
+ * @param slot - the UniformRing slot holding this iteration's Fa2Params
371
+ * @param tier - "exact" (the grid tier is E_UNSUPPORTED until P4)
372
+ * @param upTo - a stage name to stop after; undefined records every stage including toScene
373
+ */
374
+ recordIteration(batch, slot, tier, upTo) {
375
+ if (tier === "grid") {
376
+ throw new WebGpuGraphError("E_UNSUPPORTED", "the grid repulsion tier lands in P4", {
377
+ feature: "repulsion.grid",
378
+ hint: 'pass repulsion: "exact"',
379
+ });
380
+ }
381
+ const resources = this.requireResources();
382
+ const stop = upTo === undefined ? FR_STAGES.length - 1 : this.stageIndex(upTo);
383
+ const { bound } = this;
384
+ if (bound === null) {
385
+ if (resources.n === 0) {
386
+ return;
387
+ }
388
+ throw new WebGpuGraphError("E_NOT_LOADED", "the Fruchterman-Reingold model is not bound (bind() has not completed)", { state: "loaded" });
389
+ }
390
+ const offset = resources.ring.offsetOf(slot);
391
+ const pass = this.openPass !== null && this.openPass.id === batch.id ? this.openPass.pass : batch.pass("fr");
392
+ this.openPass = { id: batch.id, pass };
393
+ bound.k1.dispatch(pass, bound.k1Bound, ONE_WORKGROUP, [offset]);
394
+ if (stop < 1) {
395
+ return;
396
+ }
397
+ if (bound.k2Bound !== null) {
398
+ bound.k2.dispatch(pass, bound.k2Bound, bound.plan, [offset]);
399
+ }
400
+ else if (bound.fillForceBound !== null) {
401
+ bound.fill.dispatch(pass, bound.fillForceBound, bound.fillPlan, [0]);
402
+ }
403
+ if (stop < 2) {
404
+ return;
405
+ }
406
+ bound.k3.dispatch(pass, bound.k3Bound, bound.plan, [offset]);
407
+ if (stop < 3) {
408
+ return;
409
+ }
410
+ bound.k5.dispatch(pass, bound.k5Bound, bound.plan, [offset]);
411
+ if (stop < 4) {
412
+ return;
413
+ }
414
+ this.openPass = null;
415
+ const scenePass = batch.pass("fa2-to-scene");
416
+ bound.toScene.dispatch(scenePass, bound.toSceneBound, bound.plan, [offset]);
417
+ }
418
+ /**
419
+ * temperature = 0.1 (what stats reads before the first batch lands), kineticEnergy = 0; the temperature index
420
+ * restarts at 0 (PD-5).
421
+ * @param state - the state writer of the simulation
422
+ */
423
+ onLoad(state) {
424
+ this.resetAdaptive(state);
425
+ state.set("kineticEnergy", 0);
426
+ this.tempOrigin = 0;
427
+ this.pendingReheat = false;
428
+ }
429
+ /**
430
+ * temperature = 0.1, the adaptive controller's energy = +infinity (the first fold always counts as a fall) and
431
+ * its progress counter = 0: the state K1 reads under `cooling: "adaptive"`, and what stats reads before the first
432
+ * batch lands under either schedule.
433
+ * @param state - the state writer of the simulation
434
+ */
435
+ resetAdaptive(state) {
436
+ state.set("temperature", FR_START_TEMPERATURE);
437
+ state.set("frEnergy", Number.POSITIVE_INFINITY);
438
+ state.set("frProgress", 0);
439
+ }
440
+ /**
441
+ * Arms the re-anchoring of the temperature index at floor(0.7 * iterations), placed by the next paramsFor (PD-5);
442
+ * under `cooling: "adaptive"` restarts the controller at the start temperature instead.
443
+ * @param state - the state writer of the simulation
444
+ */
445
+ onReheat(state) {
446
+ this.pendingReheat = true;
447
+ if (this.current.cooling === "adaptive") {
448
+ this.resetAdaptive(state);
449
+ }
450
+ }
451
+ /**
452
+ * Replaces the record (a new k or budget takes effect at the next paramsFor: a new dt, a new frK; no recompile).
453
+ * The PD-16 `fixed` check already ran in the simulation's resolve callback.
454
+ * @param patch - the setParams patch
455
+ * @param _state - the state writer of the simulation (nothing to write)
456
+ */
457
+ onSetParams(patch, _state) {
458
+ this.current = resolveFruchtermanReingoldOptions(patch, this.current);
459
+ }
460
+ /**
461
+ * Decodes the state header and the k trace records of a completed batch into FruchtermanReingoldStats: the exact
462
+ * tier with null grid fields, msPerIteration null (the simulation owns the clock), the temperature K1 wrote.
463
+ * @param state - a DataView over the 256-byte state header
464
+ * @param trace - a DataView over the k Fa2Trace records of the batch
465
+ * @returns the stats
466
+ */
467
+ readStats(state, trace) {
468
+ const header = FA2_STATE.read(state);
469
+ const centroid = vector(header, "centroid");
470
+ const records = [];
471
+ const count = Math.floor(trace.byteLength / TRACE_RECORD_BYTES);
472
+ for (let i = 0; i < count; i++) {
473
+ const record = FA2_TRACE.read(trace, i * TRACE_RECORD_BYTES);
474
+ records.push({
475
+ temperature: scalar(record, "modelScalar"),
476
+ meanDisplacement: scalar(record, "meanDisplacement"),
477
+ settledCount: scalar(record, "settledCount"),
478
+ });
479
+ }
480
+ return {
481
+ iteration: scalar(header, "iteration"),
482
+ meanDisplacement: scalar(header, "meanDisplacement"),
483
+ rmsRadius: scalar(header, "rmsRadius"),
484
+ layoutRadius: scalar(header, "radius"),
485
+ centroid: [centroid[0], centroid[1], centroid[2]],
486
+ repulsionTier: "exact",
487
+ maxCellOccupancy: null,
488
+ outsideGrid: null,
489
+ msPerIteration: null,
490
+ temperature: scalar(header, "temperature"),
491
+ trace: records,
492
+ };
493
+ }
494
+ /**
495
+ * The temperature of a global iteration (PD-5): a pending reheat re-anchors tempOrigin so this iteration's
496
+ * temperature index is floor(0.7 * iterations); then max(0, 0.1 - dt * index), dt = 0.1 / (iterations + 1).
497
+ * @param global - the global iteration index
498
+ * @param resolved - the current record
499
+ * @returns the temperature (f64; the uniform slot rounds it to f32)
500
+ */
501
+ temperatureAt(global, resolved) {
502
+ if (this.pendingReheat) {
503
+ this.tempOrigin = global - Math.floor(FR_REHEAT_FRACTION * resolved.iterations);
504
+ this.pendingReheat = false;
505
+ }
506
+ const dt = FR_START_TEMPERATURE / (resolved.iterations + 1);
507
+ return Math.max(0, FR_START_TEMPERATURE - dt * (global - this.tempOrigin));
508
+ }
509
+ /**
510
+ * The resources of the last bind(), or E_NOT_LOADED before it.
511
+ * @returns the resources
512
+ */
513
+ requireResources() {
514
+ if (this.resources === null) {
515
+ throw new WebGpuGraphError("E_NOT_LOADED", "the Fruchterman-Reingold model has not been bound (load() first)", { state: "created" });
516
+ }
517
+ return this.resources;
518
+ }
519
+ /**
520
+ * The index of a stage name in FR_STAGES, or E_INVALID_ARGUMENT.
521
+ * @param upTo - the stage name
522
+ * @returns its index
523
+ */
524
+ stageIndex(upTo) {
525
+ for (let i = 0; i < FR_STAGES.length; i++) {
526
+ if (FR_STAGES[i] === upTo) {
527
+ return i;
528
+ }
529
+ }
530
+ throw invalid("upTo", upTo, FR_STAGES.join(" | "));
531
+ }
532
+ /** Drops the bind groups of the previous bind() (the buffers changed) and forgets the pass of a batch recorded before the rebind. */
533
+ dropBound() {
534
+ this.openPass = null;
535
+ const { bound } = this;
536
+ if (bound === null) {
537
+ return;
538
+ }
539
+ for (const kernel of [bound.k1, bound.k2, bound.k3, bound.k5, bound.toScene, bound.fill]) {
540
+ kernel.invalidate();
541
+ }
542
+ this.bound = null;
543
+ }
544
+ }
545
+ // ============================================================ the factory
546
+ /**
547
+ * The resolve callback of the simulation's setParams: the PD-16 `fixed` check first (fixed is applied at load; a
548
+ * rejected patch leaves the simulation unchanged because ForceSimulation.setParams runs this before any state moves),
549
+ * then the patch over the current record, re-validated.
550
+ * @param patch - the setParams patch
551
+ * @param current - the simulation's current option record
552
+ * @returns the new record
553
+ */
554
+ function resolvePatch(patch, current) {
555
+ if ("fixed" in patch) {
556
+ throw new WebGpuGraphError("E_INVALID_ARGUMENT", "setParams({ fixed }) is not a live option (spec 7.12)", {
557
+ argument: "fixed",
558
+ value: patch.fixed,
559
+ expected: "absent",
560
+ hint: "use setFixed(mask); fixed is applied at load()",
561
+ });
562
+ }
563
+ return resolveFruchtermanReingoldOptions(patch, resolveFruchtermanReingoldOptions(current));
564
+ }
565
+ /**
566
+ * Spec 3.3 createFruchtermanReingold, verbatim: a GpuLayoutSimulation running Fruchterman-Reingold on the exact
567
+ * repulsion tier with the option defaults of spec 7.20 and the GPU-only tuning of GpuLayoutTuning.
568
+ * @param ctx - the context (E_DISPOSED / E_DEVICE_LOST through assertReady)
569
+ * @param options - the Fruchterman-Reingold options and the GPU-only tuning knobs in one record
570
+ * @returns the simulation in state "created"; load() next
571
+ */
572
+ export function createFruchtermanReingold(ctx, options) {
573
+ ctx.assertReady();
574
+ const resolved = resolveFruchtermanReingoldOptions(options);
575
+ const tuning = resolveLayoutTuning(options);
576
+ const model = new FruchtermanReingoldModel(tuning, resolved);
577
+ return new ForceSimulation(ctx, model, resolved, tuning, resolvePatch);
578
+ }
579
+ //# sourceMappingURL=fruchterman-reingold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fruchterman-reingold.js","sourceRoot":"","sources":["../../../src/layouts/fruchterman-reingold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EACH,iBAAiB,EACjB,0BAA0B,EAC1B,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,GACrB,MAAM,iB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