@luma.gl/graph 10.0.0-beta.3 → 10.0.0-beta.4

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 (125) hide show
  1. package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +66 -30
  2. package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +7 -1
  3. package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
  4. package/dist/arrow/gpu/arrow-gpu-table-conversion.js +78 -32
  5. package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
  6. package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +7 -0
  7. package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +2 -0
  8. package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
  9. package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +14 -0
  10. package/dist/arrow/gpu/arrow-gpu-vector-conversion.js.map +1 -1
  11. package/dist/arrow/index.cjs.map +2 -2
  12. package/dist/arrow/vectors/arrow-temporal-gpu-vector.cjs +1 -2
  13. package/dist/arrow/vectors/arrow-temporal-gpu-vector.js +2 -2
  14. package/dist/arrow/vectors/arrow-temporal-gpu-vector.js.map +1 -1
  15. package/dist/dist.dev.js +62 -27
  16. package/dist/dist.min.js +48 -47
  17. package/dist/gpu-core/gpu-command-graph-budget-controller.cjs +10 -2
  18. package/dist/gpu-core/gpu-command-graph-budget-controller.d.ts +4 -0
  19. package/dist/gpu-core/gpu-command-graph-budget-controller.d.ts.map +1 -1
  20. package/dist/gpu-core/gpu-command-graph-budget-controller.js +10 -2
  21. package/dist/gpu-core/gpu-command-graph-budget-controller.js.map +1 -1
  22. package/dist/gpu-core/gpu-group-aggregation.cjs +45 -21
  23. package/dist/gpu-core/gpu-group-aggregation.d.ts +4 -0
  24. package/dist/gpu-core/gpu-group-aggregation.d.ts.map +1 -1
  25. package/dist/gpu-core/gpu-group-aggregation.js +58 -24
  26. package/dist/gpu-core/gpu-group-aggregation.js.map +1 -1
  27. package/dist/gpu-core/index.cjs.map +1 -1
  28. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +6 -2
  29. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts +2 -1
  30. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
  31. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +6 -2
  32. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
  33. package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +61 -54
  34. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +6 -1
  35. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
  36. package/dist/gpu-dataframe/gpu-global-sort-compiler.js +61 -55
  37. package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
  38. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +88 -13
  39. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts +11 -4
  40. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
  41. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +96 -16
  42. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
  43. package/dist/gpu-dataframe/gpu-group-by-query.cjs +12 -3
  44. package/dist/gpu-dataframe/gpu-group-by-query.d.ts +8 -1
  45. package/dist/gpu-dataframe/gpu-group-by-query.d.ts.map +1 -1
  46. package/dist/gpu-dataframe/gpu-group-by-query.js +13 -3
  47. package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
  48. package/dist/gpu-dataframe/gpu-join-compiler.cjs +53 -2
  49. package/dist/gpu-dataframe/gpu-join-compiler.d.ts +9 -1
  50. package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
  51. package/dist/gpu-dataframe/gpu-join-compiler.js +51 -0
  52. package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
  53. package/dist/gpu-dataframe/gpu-query-compiler.cjs +24 -0
  54. package/dist/gpu-dataframe/gpu-query-compiler.d.ts +3 -1
  55. package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
  56. package/dist/gpu-dataframe/gpu-query-compiler.js +25 -0
  57. package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
  58. package/dist/gpu-dataframe/index.cjs.map +3 -3
  59. package/dist/gpu-graph/index.cjs.map +1 -1
  60. package/dist/gpu-graph-algorithms/benchmarks.cjs.map +2 -2
  61. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.cjs +182 -62
  62. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.d.ts +29 -2
  63. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.d.ts.map +1 -1
  64. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.js +200 -64
  65. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.js.map +1 -1
  66. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.cjs +135 -9
  67. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.d.ts +55 -8
  68. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.d.ts.map +1 -1
  69. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.js +145 -14
  70. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.js.map +1 -1
  71. package/dist/gpu-graph-algorithms/index.cjs.map +3 -3
  72. package/dist/gpu-physics/articulation-tree-shader.cjs +177 -0
  73. package/dist/gpu-physics/articulation-tree-shader.d.ts +3 -0
  74. package/dist/gpu-physics/articulation-tree-shader.d.ts.map +1 -0
  75. package/dist/gpu-physics/articulation-tree-shader.js +159 -0
  76. package/dist/gpu-physics/articulation-tree-shader.js.map +1 -0
  77. package/dist/gpu-physics/gpu-articulation-tree.cjs +203 -0
  78. package/dist/gpu-physics/gpu-articulation-tree.d.ts +81 -0
  79. package/dist/gpu-physics/gpu-articulation-tree.d.ts.map +1 -0
  80. package/dist/gpu-physics/gpu-articulation-tree.js +205 -0
  81. package/dist/gpu-physics/gpu-articulation-tree.js.map +1 -0
  82. package/dist/gpu-physics/gpu-rigid-body-world.cjs +62 -0
  83. package/dist/gpu-physics/gpu-rigid-body-world.d.ts +12 -0
  84. package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
  85. package/dist/gpu-physics/gpu-rigid-body-world.js +76 -0
  86. package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
  87. package/dist/gpu-physics/index.cjs +3 -0
  88. package/dist/gpu-physics/index.cjs.map +3 -3
  89. package/dist/gpu-physics/index.d.ts +1 -0
  90. package/dist/gpu-physics/index.d.ts.map +1 -1
  91. package/dist/gpu-physics/index.js +1 -0
  92. package/dist/gpu-physics/index.js.map +1 -1
  93. package/dist/gpu-physics/rigid-body-joints.d.ts +2 -0
  94. package/dist/gpu-physics/rigid-body-joints.d.ts.map +1 -1
  95. package/dist/gpu-physics/rigid-body-joints.js.map +1 -1
  96. package/dist/gpu-project/graph.cjs.map +2 -2
  97. package/dist/gpu-simple-graph/index.cjs.map +2 -2
  98. package/dist/gpu-sql/gpu-sql.cjs +167 -47
  99. package/dist/gpu-sql/gpu-sql.d.ts +6 -1
  100. package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
  101. package/dist/gpu-sql/gpu-sql.js +187 -47
  102. package/dist/gpu-sql/gpu-sql.js.map +1 -1
  103. package/dist/gpu-sql/index.cjs.map +3 -3
  104. package/dist/index.cjs.map +1 -1
  105. package/package.json +8 -8
  106. package/src/arrow/gpu/arrow-gpu-table-conversion.ts +94 -40
  107. package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +19 -0
  108. package/src/arrow/vectors/arrow-temporal-gpu-vector.ts +2 -2
  109. package/src/gpu-core/gpu-command-graph-budget-controller.ts +22 -2
  110. package/src/gpu-core/gpu-group-aggregation.ts +68 -30
  111. package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +9 -2
  112. package/src/gpu-dataframe/gpu-global-sort-compiler.ts +95 -78
  113. package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +191 -24
  114. package/src/gpu-dataframe/gpu-group-by-query.ts +27 -4
  115. package/src/gpu-dataframe/gpu-join-compiler.ts +75 -0
  116. package/src/gpu-dataframe/gpu-query-compiler.ts +41 -1
  117. package/src/gpu-graph-algorithms/README.md +4 -2
  118. package/src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.ts +248 -66
  119. package/src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.ts +218 -20
  120. package/src/gpu-physics/articulation-tree-shader.ts +169 -0
  121. package/src/gpu-physics/gpu-articulation-tree.ts +279 -0
  122. package/src/gpu-physics/gpu-rigid-body-world.ts +89 -0
  123. package/src/gpu-physics/index.ts +7 -0
  124. package/src/gpu-physics/rigid-body-joints.ts +2 -0
  125. package/src/gpu-sql/gpu-sql.ts +248 -57
@@ -20,22 +20,28 @@ __export(gpu_graph_single_source_shortest_path_exports, {
20
20
  GPUGraphAlgorithmsSingleSourceShortestPath: () => GPUGraphAlgorithmsSingleSourceShortestPath
21
21
  });
22
22
  module.exports = __toCommonJS(gpu_graph_single_source_shortest_path_exports);
23
+ var import_core = require("@luma.gl/core");
23
24
  var import_dynamic = require("@luma.gl/core/dynamic");
25
+ var import_gpu_command_graph = require("../gpu-core/gpu-command-graph.cjs");
24
26
  var import_gpu_graph_single_source_shortest_path_internals = require("./gpu-graph-single-source-shortest-path-internals.cjs");
25
- const MAXIMUM_SHORTEST_PATH_ITERATIONS = 1024;
27
+ const MAXIMUM_ENCODED_ITERATIONS = 1024;
28
+ const MAXIMUM_UINT32 = 4294967295;
29
+ const DEFAULT_ITERATIONS_PER_SUBMIT = 128;
26
30
  const SCALAR_BYTE_LENGTH = 4;
27
31
  class GPUGraphAlgorithmsSingleSourceShortestPath {
28
32
  /** Prefix for generated command-graph nodes and imported resources. */
29
33
  id;
30
34
  /** Existing caller-owned graph topology. */
31
35
  topology;
32
- /** Stable source vertex identifier. */
36
+ /** Stable source vertex identifier, when the source is not read from `seeds`. */
33
37
  sourceVertex;
38
+ /** Caller-owned source vertex identifiers. Await {@link run} before writing to the buffer. */
39
+ seeds;
34
40
  /** Caller-owned, vertex-aligned weighted distance column. */
35
41
  distances;
36
42
  /** Caller-owned, vertex-aligned deterministic predecessor column. */
37
43
  predecessors;
38
- /** Maximum compiled Bellman-Ford relaxation rounds. */
44
+ /** Maximum Bellman-Ford relaxation rounds. */
39
45
  maxIterations;
40
46
  /** Selected graph edge orientation. */
41
47
  direction;
@@ -43,29 +49,39 @@ class GPUGraphAlgorithmsSingleSourceShortestPath {
43
49
  converged;
44
50
  /** Optional caller-owned invalid-source-edge-weight count scalar. */
45
51
  invalidWeightCount;
52
+ _runner;
53
+ /** Whether a run owns the runner and its outputs. */
54
+ _running = false;
46
55
  /** Validates caller-owned metadata without allocating, submitting, or reading GPU work. */
47
56
  constructor(props) {
48
57
  this.id = props.id ?? "gpu-graph-single-source-shortest-path";
49
58
  this.topology = props.topology;
50
59
  this.sourceVertex = props.sourceVertex;
60
+ this.seeds = props.seeds;
51
61
  this.distances = props.distances;
52
62
  this.predecessors = props.predecessors;
53
- this.maxIterations = props.maxIterations ?? Math.min(Math.max(this.topology.graph.vertexCount - 1, 0), MAXIMUM_SHORTEST_PATH_ITERATIONS);
63
+ this.maxIterations = props.maxIterations ?? Math.max(this.topology.graph.vertexCount - 1, 0);
54
64
  this.direction = props.direction ?? "outgoing";
55
65
  this.converged = props.converged;
56
66
  this.invalidWeightCount = props.invalidWeightCount;
67
+ if (this.sourceVertex === void 0 === (this.seeds === void 0)) {
68
+ throw new Error(`${this.id} requires exactly one of sourceVertex and seeds`);
69
+ }
57
70
  const maximumSourceVertex = Math.max(this.topology.graph.vertexCount - 1, 0);
58
- if (!Number.isSafeInteger(this.sourceVertex) || this.sourceVertex < 0 || this.sourceVertex > maximumSourceVertex) {
71
+ if (this.sourceVertex !== void 0 && (!Number.isSafeInteger(this.sourceVertex) || this.sourceVertex < 0 || this.sourceVertex > maximumSourceVertex)) {
59
72
  throw new Error(`${this.id} sourceVertex must identify an existing graph vertex`);
60
73
  }
74
+ if (this.seeds) {
75
+ validateSeedVector(this.seeds, `${this.id} seeds`);
76
+ }
61
77
  if (!["outgoing", "incoming", "both"].includes(this.direction)) {
62
78
  throw new Error(`${this.id} direction must be outgoing, incoming, or both`);
63
79
  }
64
80
  if (this.direction !== "outgoing" && this.topology.graph.directed && !this.topology.reverse) {
65
81
  throw new Error(`${this.id} incoming or bidirectional directed paths require reverse adjacency`);
66
82
  }
67
- if (!Number.isSafeInteger(this.maxIterations) || this.maxIterations < 0 || this.maxIterations > MAXIMUM_SHORTEST_PATH_ITERATIONS) {
68
- throw new Error(`${this.id} maxIterations must be a safe integer between zero and 1024`);
83
+ if (!Number.isSafeInteger(this.maxIterations) || this.maxIterations < 0 || this.maxIterations > MAXIMUM_UINT32) {
84
+ throw new Error(`${this.id} maxIterations must be an integer between zero and 2^32 - 1`);
69
85
  }
70
86
  validateShortestPathVector(this.distances, "float32", this.topology.graph.vertexCount, `${this.id} distances`);
71
87
  validateShortestPathVector(this.predecessors, "uint32", this.topology.graph.vertexCount, `${this.id} predecessors`);
@@ -77,11 +93,118 @@ class GPUGraphAlgorithmsSingleSourceShortestPath {
77
93
  }
78
94
  validateDistinctShortestPathOutputs(this);
79
95
  }
80
- /** Adds bounded weighted-path passes without submitting commands or reading GPU results. */
96
+ /**
97
+ * Adds initialization and up to 1,024 relaxation rounds without submitting or reading back.
98
+ *
99
+ * Every round is GPU-gated: once the search converges or exhausts `maxIterations`, later rounds
100
+ * dispatch zero workgroups. Use {@link run} when the search can need more than 1,024 rounds.
101
+ */
81
102
  addToGraph(commandGraph) {
82
- (0, import_gpu_graph_single_source_shortest_path_internals.addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit)(this, commandGraph, commandGraph.device.limits.maxComputeWorkgroupsPerDimension);
103
+ (0, import_gpu_graph_single_source_shortest_path_internals.addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit)(this, commandGraph, commandGraph.device.limits.maxComputeWorkgroupsPerDimension, Math.min(this.maxIterations, MAXIMUM_ENCODED_ITERATIONS));
104
+ }
105
+ /**
106
+ * Runs the search to convergence or to `maxIterations`, in batches of GPU-gated rounds.
107
+ *
108
+ * Each submission encodes `iterationsPerSubmit` rounds and reads back one 32-byte status.
109
+ * Runs with the same batch size reuse the compiled command graphs. Build the topology first.
110
+ * An overlapping call rejects. Await the current run before writing to {@link seeds} or calling
111
+ * {@link destroy}.
112
+ */
113
+ async run(options = {}) {
114
+ var _a, _b;
115
+ if (this._running) {
116
+ throw new Error(`${this.id} is already running. Await run() before starting another run.`);
117
+ }
118
+ const iterationsPerSubmit = options.iterationsPerSubmit ?? DEFAULT_ITERATIONS_PER_SUBMIT;
119
+ if (!Number.isSafeInteger(iterationsPerSubmit) || iterationsPerSubmit < 1 || iterationsPerSubmit > MAXIMUM_ENCODED_ITERATIONS) {
120
+ throw new Error(`${this.id} iterationsPerSubmit must be an integer between 1 and 1024`);
121
+ }
122
+ this._running = true;
123
+ try {
124
+ if (((_a = this._runner) == null ? void 0 : _a.iterationsPerSubmit) !== iterationsPerSubmit) {
125
+ (_b = this._runner) == null ? void 0 : _b.destroy();
126
+ this._runner = void 0;
127
+ this._runner = createShortestPathRunner(this, iterationsPerSubmit);
128
+ }
129
+ const runner = this._runner;
130
+ const { device } = runner;
131
+ let submissions = 0;
132
+ let status;
133
+ let encoder = device.createCommandEncoder({ id: `${this.id}-run` });
134
+ runner.initialization.encode(encoder, { parameters: void 0 });
135
+ for (; ; ) {
136
+ runner.rounds.encode(encoder, { parameters: void 0 });
137
+ device.submit(encoder.finish());
138
+ submissions++;
139
+ status = await readControl(runner.control);
140
+ if (status[import_gpu_graph_single_source_shortest_path_internals.SHORTEST_PATH_CONTROL_DISPATCH_X] === 0) {
141
+ break;
142
+ }
143
+ encoder = device.createCommandEncoder({ id: `${this.id}-run` });
144
+ }
145
+ return {
146
+ converged: status[import_gpu_graph_single_source_shortest_path_internals.SHORTEST_PATH_CONTROL_CONVERGED] === 1,
147
+ iterations: status[import_gpu_graph_single_source_shortest_path_internals.SHORTEST_PATH_CONTROL_ITERATIONS],
148
+ submissions
149
+ };
150
+ } finally {
151
+ this._running = false;
152
+ }
153
+ }
154
+ /** Releases the command graphs and status buffers. Await {@link run} before calling this method. */
155
+ destroy() {
156
+ var _a;
157
+ (_a = this._runner) == null ? void 0 : _a.destroy();
158
+ this._runner = void 0;
83
159
  }
84
160
  }
161
+ function createShortestPathRunner(search, iterationsPerSubmit) {
162
+ const device = getPhysicalBuffer(search.distances.data[0]).device;
163
+ const maxComputeWorkgroupsPerDimension = device.limits.maxComputeWorkgroupsPerDimension;
164
+ const control = device.createBuffer({
165
+ id: `${search.id}-control`,
166
+ byteLength: import_gpu_graph_single_source_shortest_path_internals.SHORTEST_PATH_CONTROL_BYTE_LENGTH,
167
+ usage: import_core.Buffer.STORAGE | import_core.Buffer.INDIRECT | import_core.Buffer.COPY_SRC
168
+ });
169
+ const persistent = { control };
170
+ const compiled = [];
171
+ const destroy = () => {
172
+ for (const graph of compiled)
173
+ graph.destroy();
174
+ control.destroy();
175
+ };
176
+ try {
177
+ const initializationGraph = new import_gpu_command_graph.GPUCommandGraph(device, { id: `${search.id}-initialization` });
178
+ (0, import_gpu_graph_single_source_shortest_path_internals.addGPUGraphAlgorithmsShortestPathInitializationToGraph)(search, initializationGraph, maxComputeWorkgroupsPerDimension, persistent);
179
+ const initialization = initializationGraph.compile();
180
+ compiled.push(initialization);
181
+ const roundsGraph = new import_gpu_command_graph.GPUCommandGraph(device, { id: `${search.id}-rounds` });
182
+ (0, import_gpu_graph_single_source_shortest_path_internals.addGPUGraphAlgorithmsShortestPathRoundsToGraph)(search, roundsGraph, maxComputeWorkgroupsPerDimension, iterationsPerSubmit, persistent);
183
+ const rounds = roundsGraph.compile();
184
+ compiled.push(rounds);
185
+ return {
186
+ device,
187
+ iterationsPerSubmit,
188
+ control,
189
+ initialization,
190
+ rounds,
191
+ destroy
192
+ };
193
+ } catch (error) {
194
+ destroy();
195
+ throw error;
196
+ }
197
+ }
198
+ async function readControl(control) {
199
+ const bytes = await control.readAsync(0, import_gpu_graph_single_source_shortest_path_internals.SHORTEST_PATH_CONTROL_BYTE_LENGTH);
200
+ return new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
201
+ }
202
+ function validateSeedVector(seeds, name) {
203
+ if (seeds.length < 1 || seeds.length > MAXIMUM_UINT32) {
204
+ throw new Error(`${name} must contain at least one uint32 vertex identifier`);
205
+ }
206
+ validateShortestPathVector(seeds, "uint32", seeds.length, name);
207
+ }
85
208
  function validateShortestPathVector(vector, format, length, name) {
86
209
  if (vector.format !== format || vector.data.length !== 1 || vector.length !== length || vector.stride !== 1 || vector.byteStride !== SCALAR_BYTE_LENGTH || vector.rowByteLength !== SCALAR_BYTE_LENGTH || vector.valueLength !== vector.length || vector.bufferLayout) {
87
210
  throw new Error(`${name} must contain exactly ${length} packed ${format} rows in one chunk`);
@@ -108,6 +231,9 @@ function validateDistinctShortestPathOutputs(search) {
108
231
  physicalAllocations.add(getPhysicalBuffer(chunk));
109
232
  }
110
233
  }
234
+ if (search.seeds) {
235
+ physicalAllocations.add(getPhysicalBuffer(search.seeds.data[0]));
236
+ }
111
237
  const outputs = [
112
238
  { name: "distances", vector: search.distances },
113
239
  { name: "predecessors", vector: search.predecessors },
@@ -1,5 +1,5 @@
1
1
  import type { GPUVector } from '@luma.gl/graph/gpu-data';
2
- import type { GPUCommandGraph } from "../gpu-core/gpu-command-graph.js";
2
+ import { GPUCommandGraph } from "../gpu-core/gpu-command-graph.js";
3
3
  import type { GPUGraphAlgorithmsTopology } from "./gpu-graph-topology.js";
4
4
  /** Forward, reverse, or combined orientation for weighted shortest-path exploration. */
5
5
  export type GPUGraphAlgorithmsSingleSourceShortestPathDirection = 'outgoing' | 'incoming' | 'both';
@@ -9,13 +9,14 @@ export type GPUGraphAlgorithmsSingleSourceShortestPathProps = {
9
9
  id?: string;
10
10
  /** Existing GPU-resident compressed adjacency and its explicit overflow status. */
11
11
  topology: GPUGraphAlgorithmsTopology;
12
- /** Stable source vertex identifier; zero is also accepted for an empty graph. */
13
- sourceVertex: number;
14
12
  /** One caller-owned floating-point distance for every graph vertex. */
15
13
  distances: GPUVector<'float32'>;
16
14
  /** One caller-owned unsigned predecessor identifier for every graph vertex. */
17
15
  predecessors: GPUVector<'uint32'>;
18
- /** Maximum compiled relaxation rounds, between zero and 1,024 inclusive. */
16
+ /**
17
+ * Maximum relaxation rounds, a uint32. Defaults to `vertexCount - 1`, which is enough for every
18
+ * simple path. `addToGraph()` encodes at most 1,024 of them; `run()` continues to this budget.
19
+ */
19
20
  maxIterations?: number;
20
21
  /** Forward, reverse, or combined edge orientation. Defaults to outgoing. */
21
22
  direction?: GPUGraphAlgorithmsSingleSourceShortestPathDirection;
@@ -23,6 +24,31 @@ export type GPUGraphAlgorithmsSingleSourceShortestPathProps = {
23
24
  converged?: GPUVector<'uint32'>;
24
25
  /** Optional caller-owned scalar receiving invalid, valid-endpoint source-edge weights. */
25
26
  invalidWeightCount?: GPUVector<'uint32'>;
27
+ /**
28
+ * Stable source vertex identifier; zero is also accepted for an empty graph. Give exactly one
29
+ * of `sourceVertex` and `seeds`.
30
+ */
31
+ sourceVertex?: number;
32
+ /**
33
+ * Caller-owned source vertex identifiers in one packed chunk, read when the GPU work runs.
34
+ * Await {@link GPUGraphAlgorithmsSingleSourceShortestPath.run} before writing new identifiers.
35
+ * Every seed starts at distance zero. Identifiers outside the graph are ignored.
36
+ */
37
+ seeds?: GPUVector<'uint32'>;
38
+ };
39
+ /** Options for {@link GPUGraphAlgorithmsSingleSourceShortestPath.run}. */
40
+ export type GPUGraphAlgorithmsSingleSourceShortestPathRunOptions = {
41
+ /** Relaxation rounds encoded per submission, between 1 and 1,024. Default 128. */
42
+ iterationsPerSubmit?: number;
43
+ };
44
+ /** Status of one {@link GPUGraphAlgorithmsSingleSourceShortestPath.run}. */
45
+ export type GPUGraphAlgorithmsSingleSourceShortestPathRunResult = {
46
+ /** Whether every distance is final. */
47
+ converged: boolean;
48
+ /** Relaxation rounds that ran, including the last round, which found no shorter distance. */
49
+ iterations: number;
50
+ /** Command buffers submitted, each followed by one status readback. */
51
+ submissions: number;
26
52
  };
27
53
  /**
28
54
  * Computes bounded, non-negative weighted shortest paths without reading GPU graph data.
@@ -37,13 +63,15 @@ export declare class GPUGraphAlgorithmsSingleSourceShortestPath {
37
63
  readonly id: string;
38
64
  /** Existing caller-owned graph topology. */
39
65
  readonly topology: GPUGraphAlgorithmsTopology;
40
- /** Stable source vertex identifier. */
41
- readonly sourceVertex: number;
66
+ /** Stable source vertex identifier, when the source is not read from `seeds`. */
67
+ readonly sourceVertex?: number;
68
+ /** Caller-owned source vertex identifiers. Await {@link run} before writing to the buffer. */
69
+ readonly seeds?: GPUVector<'uint32'>;
42
70
  /** Caller-owned, vertex-aligned weighted distance column. */
43
71
  readonly distances: GPUVector<'float32'>;
44
72
  /** Caller-owned, vertex-aligned deterministic predecessor column. */
45
73
  readonly predecessors: GPUVector<'uint32'>;
46
- /** Maximum compiled Bellman-Ford relaxation rounds. */
74
+ /** Maximum Bellman-Ford relaxation rounds. */
47
75
  readonly maxIterations: number;
48
76
  /** Selected graph edge orientation. */
49
77
  readonly direction: GPUGraphAlgorithmsSingleSourceShortestPathDirection;
@@ -51,9 +79,28 @@ export declare class GPUGraphAlgorithmsSingleSourceShortestPath {
51
79
  readonly converged?: GPUVector<'uint32'>;
52
80
  /** Optional caller-owned invalid-source-edge-weight count scalar. */
53
81
  readonly invalidWeightCount?: GPUVector<'uint32'>;
82
+ private _runner?;
83
+ /** Whether a run owns the runner and its outputs. */
84
+ private _running;
54
85
  /** Validates caller-owned metadata without allocating, submitting, or reading GPU work. */
55
86
  constructor(props: GPUGraphAlgorithmsSingleSourceShortestPathProps);
56
- /** Adds bounded weighted-path passes without submitting commands or reading GPU results. */
87
+ /**
88
+ * Adds initialization and up to 1,024 relaxation rounds without submitting or reading back.
89
+ *
90
+ * Every round is GPU-gated: once the search converges or exhausts `maxIterations`, later rounds
91
+ * dispatch zero workgroups. Use {@link run} when the search can need more than 1,024 rounds.
92
+ */
57
93
  addToGraph<Parameters>(commandGraph: GPUCommandGraph<Parameters>): void;
94
+ /**
95
+ * Runs the search to convergence or to `maxIterations`, in batches of GPU-gated rounds.
96
+ *
97
+ * Each submission encodes `iterationsPerSubmit` rounds and reads back one 32-byte status.
98
+ * Runs with the same batch size reuse the compiled command graphs. Build the topology first.
99
+ * An overlapping call rejects. Await the current run before writing to {@link seeds} or calling
100
+ * {@link destroy}.
101
+ */
102
+ run(options?: GPUGraphAlgorithmsSingleSourceShortestPathRunOptions): Promise<GPUGraphAlgorithmsSingleSourceShortestPathRunResult>;
103
+ /** Releases the command graphs and status buffers. Await {@link run} before calling this method. */
104
+ destroy(): void;
58
105
  }
59
106
  //# sourceMappingURL=gpu-graph-single-source-shortest-path.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-graph-single-source-shortest-path.d.ts","sourceRoot":"","sources":["../../src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAU,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAC,eAAe,EAAC,yCAAsC;AAEnE,OAAO,KAAK,EAA8B,0BAA0B,EAAC,gCAA6B;AAKlG,wFAAwF;AACxF,MAAM,MAAM,mDAAmD,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAEnG,2FAA2F;AAC3F,MAAM,MAAM,+CAA+C,GAAG;IAC5D,kFAAkF;IAClF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,QAAQ,EAAE,0BAA0B,CAAC;IACrC,iFAAiF;IACj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 {"version":3,"file":"gpu-graph-single-source-shortest-path.d.ts","sourceRoot":"","sources":["../../src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAU,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAC,eAAe,EAA+B,yCAAsC;AAW5F,OAAO,KAAK,EAA8B,0BAA0B,EAAC,gCAA6B;AAQlG,wFAAwF;AACxF,MAAM,MAAM,mDAAmD,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAEnG,2FAA2F;AAC3F,MAAM,MAAM,+CAA+C,GAAG;IAC5D,kFAAkF;IAClF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,QAAQ,EAAE,0BAA0B,CAAC;IACrC,uEAAuE;IACvE,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC,+EAA+E;IAC/E,YAAY,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAClC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,mDAAmD,CAAC;IAChE,uFAAuF;IACvF,SAAS,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAChC,0FAA0F;IAC1F,kBAAkB,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IACzC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC7B,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,oDAAoD,GAAG;IACjE,kFAAkF;IAClF,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MAAM,mDAAmD,GAAG;IAChE,uCAAuC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,6FAA6F;IAC7F,UAAU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MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
  // SPDX-FileComment: Independently implemented for WebGPU; inspired by NVIDIA RAPIDS cuGraph.
5
+ import { Buffer } from '@luma.gl/core';
5
6
  import { DynamicBuffer } from '@luma.gl/core/dynamic';
6
- import { addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit } from "./gpu-graph-single-source-shortest-path-internals.js";
7
- const MAXIMUM_SHORTEST_PATH_ITERATIONS = 1024;
7
+ import { GPUCommandGraph } from "../gpu-core/gpu-command-graph.js";
8
+ import { SHORTEST_PATH_CONTROL_BYTE_LENGTH, SHORTEST_PATH_CONTROL_CONVERGED, SHORTEST_PATH_CONTROL_DISPATCH_X, SHORTEST_PATH_CONTROL_ITERATIONS, addGPUGraphAlgorithmsShortestPathInitializationToGraph, addGPUGraphAlgorithmsShortestPathRoundsToGraph, addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit } from "./gpu-graph-single-source-shortest-path-internals.js";
9
+ /** Most relaxation rounds that one command graph encodes. */
10
+ const MAXIMUM_ENCODED_ITERATIONS = 1024;
11
+ const MAXIMUM_UINT32 = 0xffffffff;
12
+ const DEFAULT_ITERATIONS_PER_SUBMIT = 128;
8
13
  const SCALAR_BYTE_LENGTH = 4;
9
14
  /**
10
15
  * Computes bounded, non-negative weighted shortest paths without reading GPU graph data.
@@ -19,13 +24,15 @@ export class GPUGraphAlgorithmsSingleSourceShortestPath {
19
24
  id;
20
25
  /** Existing caller-owned graph topology. */
21
26
  topology;
22
- /** Stable source vertex identifier. */
27
+ /** Stable source vertex identifier, when the source is not read from `seeds`. */
23
28
  sourceVertex;
29
+ /** Caller-owned source vertex identifiers. Await {@link run} before writing to the buffer. */
30
+ seeds;
24
31
  /** Caller-owned, vertex-aligned weighted distance column. */
25
32
  distances;
26
33
  /** Caller-owned, vertex-aligned deterministic predecessor column. */
27
34
  predecessors;
28
- /** Maximum compiled Bellman-Ford relaxation rounds. */
35
+ /** Maximum Bellman-Ford relaxation rounds. */
29
36
  maxIterations;
30
37
  /** Selected graph edge orientation. */
31
38
  direction;
@@ -33,25 +40,34 @@ export class GPUGraphAlgorithmsSingleSourceShortestPath {
33
40
  converged;
34
41
  /** Optional caller-owned invalid-source-edge-weight count scalar. */
35
42
  invalidWeightCount;
43
+ _runner;
44
+ /** Whether a run owns the runner and its outputs. */
45
+ _running = false;
36
46
  /** Validates caller-owned metadata without allocating, submitting, or reading GPU work. */
37
47
  constructor(props) {
38
48
  this.id = props.id ?? 'gpu-graph-single-source-shortest-path';
39
49
  this.topology = props.topology;
40
50
  this.sourceVertex = props.sourceVertex;
51
+ this.seeds = props.seeds;
41
52
  this.distances = props.distances;
42
53
  this.predecessors = props.predecessors;
43
- this.maxIterations =
44
- props.maxIterations ??
45
- Math.min(Math.max(this.topology.graph.vertexCount - 1, 0), MAXIMUM_SHORTEST_PATH_ITERATIONS);
54
+ this.maxIterations = props.maxIterations ?? Math.max(this.topology.graph.vertexCount - 1, 0);
46
55
  this.direction = props.direction ?? 'outgoing';
47
56
  this.converged = props.converged;
48
57
  this.invalidWeightCount = props.invalidWeightCount;
58
+ if ((this.sourceVertex === undefined) === (this.seeds === undefined)) {
59
+ throw new Error(`${this.id} requires exactly one of sourceVertex and seeds`);
60
+ }
49
61
  const maximumSourceVertex = Math.max(this.topology.graph.vertexCount - 1, 0);
50
- if (!Number.isSafeInteger(this.sourceVertex) ||
51
- this.sourceVertex < 0 ||
52
- this.sourceVertex > maximumSourceVertex) {
62
+ if (this.sourceVertex !== undefined &&
63
+ (!Number.isSafeInteger(this.sourceVertex) ||
64
+ this.sourceVertex < 0 ||
65
+ this.sourceVertex > maximumSourceVertex)) {
53
66
  throw new Error(`${this.id} sourceVertex must identify an existing graph vertex`);
54
67
  }
68
+ if (this.seeds) {
69
+ validateSeedVector(this.seeds, `${this.id} seeds`);
70
+ }
55
71
  if (!['outgoing', 'incoming', 'both'].includes(this.direction)) {
56
72
  throw new Error(`${this.id} direction must be outgoing, incoming, or both`);
57
73
  }
@@ -60,8 +76,8 @@ export class GPUGraphAlgorithmsSingleSourceShortestPath {
60
76
  }
61
77
  if (!Number.isSafeInteger(this.maxIterations) ||
62
78
  this.maxIterations < 0 ||
63
- this.maxIterations > MAXIMUM_SHORTEST_PATH_ITERATIONS) {
64
- throw new Error(`${this.id} maxIterations must be a safe integer between zero and 1024`);
79
+ this.maxIterations > MAXIMUM_UINT32) {
80
+ throw new Error(`${this.id} maxIterations must be an integer between zero and 2^32 - 1`);
65
81
  }
66
82
  validateShortestPathVector(this.distances, 'float32', this.topology.graph.vertexCount, `${this.id} distances`);
67
83
  validateShortestPathVector(this.predecessors, 'uint32', this.topology.graph.vertexCount, `${this.id} predecessors`);
@@ -73,11 +89,123 @@ export class GPUGraphAlgorithmsSingleSourceShortestPath {
73
89
  }
74
90
  validateDistinctShortestPathOutputs(this);
75
91
  }
76
- /** Adds bounded weighted-path passes without submitting commands or reading GPU results. */
92
+ /**
93
+ * Adds initialization and up to 1,024 relaxation rounds without submitting or reading back.
94
+ *
95
+ * Every round is GPU-gated: once the search converges or exhausts `maxIterations`, later rounds
96
+ * dispatch zero workgroups. Use {@link run} when the search can need more than 1,024 rounds.
97
+ */
77
98
  addToGraph(commandGraph) {
78
- addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit(this, commandGraph, commandGraph.device.limits.maxComputeWorkgroupsPerDimension);
99
+ addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit(this, commandGraph, commandGraph.device.limits.maxComputeWorkgroupsPerDimension, Math.min(this.maxIterations, MAXIMUM_ENCODED_ITERATIONS));
100
+ }
101
+ /**
102
+ * Runs the search to convergence or to `maxIterations`, in batches of GPU-gated rounds.
103
+ *
104
+ * Each submission encodes `iterationsPerSubmit` rounds and reads back one 32-byte status.
105
+ * Runs with the same batch size reuse the compiled command graphs. Build the topology first.
106
+ * An overlapping call rejects. Await the current run before writing to {@link seeds} or calling
107
+ * {@link destroy}.
108
+ */
109
+ async run(options = {}) {
110
+ if (this._running) {
111
+ throw new Error(`${this.id} is already running. Await run() before starting another run.`);
112
+ }
113
+ const iterationsPerSubmit = options.iterationsPerSubmit ?? DEFAULT_ITERATIONS_PER_SUBMIT;
114
+ if (!Number.isSafeInteger(iterationsPerSubmit) ||
115
+ iterationsPerSubmit < 1 ||
116
+ iterationsPerSubmit > MAXIMUM_ENCODED_ITERATIONS) {
117
+ throw new Error(`${this.id} iterationsPerSubmit must be an integer between 1 and 1024`);
118
+ }
119
+ this._running = true;
120
+ try {
121
+ if (this._runner?.iterationsPerSubmit !== iterationsPerSubmit) {
122
+ this._runner?.destroy();
123
+ this._runner = undefined;
124
+ this._runner = createShortestPathRunner(this, iterationsPerSubmit);
125
+ }
126
+ const runner = this._runner;
127
+ const { device } = runner;
128
+ let submissions = 0;
129
+ let status;
130
+ let encoder = device.createCommandEncoder({ id: `${this.id}-run` });
131
+ runner.initialization.encode(encoder, { parameters: undefined });
132
+ for (;;) {
133
+ runner.rounds.encode(encoder, { parameters: undefined });
134
+ device.submit(encoder.finish());
135
+ submissions++;
136
+ status = await readControl(runner.control);
137
+ if (status[SHORTEST_PATH_CONTROL_DISPATCH_X] === 0) {
138
+ break;
139
+ }
140
+ encoder = device.createCommandEncoder({ id: `${this.id}-run` });
141
+ }
142
+ return {
143
+ converged: status[SHORTEST_PATH_CONTROL_CONVERGED] === 1,
144
+ iterations: status[SHORTEST_PATH_CONTROL_ITERATIONS],
145
+ submissions
146
+ };
147
+ }
148
+ finally {
149
+ this._running = false;
150
+ }
151
+ }
152
+ /** Releases the command graphs and status buffers. Await {@link run} before calling this method. */
153
+ destroy() {
154
+ this._runner?.destroy();
155
+ this._runner = undefined;
79
156
  }
80
157
  }
158
+ /** Compiles the reusable initialization and round-batch command graphs for {@link run}. */
159
+ function createShortestPathRunner(search, iterationsPerSubmit) {
160
+ const device = getPhysicalBuffer(search.distances.data[0]).device;
161
+ const maxComputeWorkgroupsPerDimension = device.limits.maxComputeWorkgroupsPerDimension;
162
+ const control = device.createBuffer({
163
+ id: `${search.id}-control`,
164
+ byteLength: SHORTEST_PATH_CONTROL_BYTE_LENGTH,
165
+ usage: Buffer.STORAGE | Buffer.INDIRECT | Buffer.COPY_SRC
166
+ });
167
+ const persistent = { control };
168
+ const compiled = [];
169
+ const destroy = () => {
170
+ for (const graph of compiled)
171
+ graph.destroy();
172
+ control.destroy();
173
+ };
174
+ try {
175
+ const initializationGraph = new GPUCommandGraph(device, { id: `${search.id}-initialization` });
176
+ addGPUGraphAlgorithmsShortestPathInitializationToGraph(search, initializationGraph, maxComputeWorkgroupsPerDimension, persistent);
177
+ const initialization = initializationGraph.compile();
178
+ compiled.push(initialization);
179
+ const roundsGraph = new GPUCommandGraph(device, { id: `${search.id}-rounds` });
180
+ addGPUGraphAlgorithmsShortestPathRoundsToGraph(search, roundsGraph, maxComputeWorkgroupsPerDimension, iterationsPerSubmit, persistent);
181
+ const rounds = roundsGraph.compile();
182
+ compiled.push(rounds);
183
+ return {
184
+ device,
185
+ iterationsPerSubmit,
186
+ control,
187
+ initialization,
188
+ rounds,
189
+ destroy
190
+ };
191
+ }
192
+ catch (error) {
193
+ destroy();
194
+ throw error;
195
+ }
196
+ }
197
+ /** Reads the dispatch command, round count, and convergence status in one transfer. */
198
+ async function readControl(control) {
199
+ const bytes = await control.readAsync(0, SHORTEST_PATH_CONTROL_BYTE_LENGTH);
200
+ return new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
201
+ }
202
+ /** Requires one packed uint32 chunk with at least one seed. */
203
+ function validateSeedVector(seeds, name) {
204
+ if (seeds.length < 1 || seeds.length > MAXIMUM_UINT32) {
205
+ throw new Error(`${name} must contain at least one uint32 vertex identifier`);
206
+ }
207
+ validateShortestPathVector(seeds, 'uint32', seeds.length, name);
208
+ }
81
209
  /** Requires exactly one packed, properly aligned caller-owned scalar output chunk. */
82
210
  function validateShortestPathVector(vector, format, length, name) {
83
211
  if (vector.format !== format ||
@@ -121,6 +249,9 @@ function validateDistinctShortestPathOutputs(search) {
121
249
  physicalAllocations.add(getPhysicalBuffer(chunk));
122
250
  }
123
251
  }
252
+ if (search.seeds) {
253
+ physicalAllocations.add(getPhysicalBuffer(search.seeds.data[0]));
254
+ }
124
255
  const outputs = [
125
256
  { name: 'distances', vector: search.distances },
126
257
  { name: 'predecessors', vector: search.predecessors },
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-graph-single-source-shortest-path.js","sourceRoot":"","sources":["../../src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAC5D,6FAA6F;AAG7F,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAGpD,OAAO,EAAC,qEAAqE,EAAC,6DAA0D;AAGxI,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAC9C,MAAM,kBAAkB,GAAG,CAAC,CAAC;AA2B7B;;;;;;;GAOG;AACH,MAAM,OAAO,0CAA0C;IACrD,uEAAuE;IAC9D,EAAE,CAAS;IACpB,4CAA4C;IACnC,QAAQ,CAA6B;IAC9C,uCAAuC;IAC9B,YAAY,CAAS;IAC9B,6DAA6D;IACpD,SAAS,CAAuB;IACzC,qEAAqE;IAC5D,YAAY,CAAsB;IAC3C,uDAAuD;IAC9C,aAAa,CAAS;IAC/B,uCAAuC;IAC9B,SAAS,CAAsD;IACxE,uDAAuD;IAC9C,SAAS,CAAuB;IACzC,qEAAqE;IAC5D,kBAAkB,CAAuB;IAElD,2FAA2F;IAC3F,YAAY,KAAsD;QAChE,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,uCAAuC,CAAC;QAC9D,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC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C,MAAM,cAAc,GAAG,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,IAAI,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,EAAE,IAAI,IAAI,iDAAiD,CAAC,CAAC;QACzF,CAAC;QACD,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,6FAA6F;AAC7F,SAAS,mBAAmB,CAC1B,SAAsC;IAEtC,OAAO;QACL,SAAS,CAAC,OAAO;QACjB,SAAS,CAAC,SAAS;QACnB,SAAS,CAAC,OAAO;QACjB,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,SAAS,CAAC,KAAK;QACf,SAAS,CAAC,QAAQ;KACnB,CAAC;AACJ,CAAC;AAED,yEAAyE;AACzE,SAAS,iBAAiB,CAAC,KAA6C;IACtE,OAAO,KAAK,CAAC,MAAM,YAAY,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;AACpF,CAAC"}
1
+ {"version":3,"file":"gpu-graph-single-source-shortest-path.js","sourceRoot":"","sources":["../../src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAC5D,6FAA6F;AAE7F,OAAO,EAAC,MAAM,EAAc,MAAM,eAAe,CAAC;AAClD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAC,eAAe,EAA+B,yCAAsC;AAC5F,OAAO,EAEL,iCAAiC,EACjC,+BAA+B,EAC/B,gCAAgC,EAChC,gCAAgC,EAChC,sDAAsD,EAC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