graphwise 1.9.0 → 1.10.0

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 (135) hide show
  1. package/dist/async/index.cjs +98 -1
  2. package/dist/async/index.cjs.map +1 -0
  3. package/dist/async/index.d.ts +1 -0
  4. package/dist/async/index.d.ts.map +1 -1
  5. package/dist/async/index.js +96 -2
  6. package/dist/async/index.js.map +1 -0
  7. package/dist/async/ops.d.ts +2 -0
  8. package/dist/async/ops.d.ts.map +1 -1
  9. package/dist/async/protocol.d.ts +14 -0
  10. package/dist/async/protocol.d.ts.map +1 -1
  11. package/dist/async/runner-batched.d.ts +21 -0
  12. package/dist/async/runner-batched.d.ts.map +1 -0
  13. package/dist/async/runner-batched.unit.test.d.ts +2 -0
  14. package/dist/async/runner-batched.unit.test.d.ts.map +1 -0
  15. package/dist/async/runners.d.ts.map +1 -1
  16. package/dist/expansion/base-core.d.ts.map +1 -1
  17. package/dist/expansion/fuse.d.ts +24 -1
  18. package/dist/expansion/fuse.d.ts.map +1 -1
  19. package/dist/expansion/index.cjs +9 -1
  20. package/dist/expansion/index.js +2 -2
  21. package/dist/expansion/lace.d.ts +23 -2
  22. package/dist/expansion/lace.d.ts.map +1 -1
  23. package/dist/expansion/priority-helpers.d.ts +20 -1
  24. package/dist/expansion/priority-helpers.d.ts.map +1 -1
  25. package/dist/expansion/sift.d.ts +24 -1
  26. package/dist/expansion/sift.d.ts.map +1 -1
  27. package/dist/expansion/types.d.ts +30 -0
  28. package/dist/expansion/types.d.ts.map +1 -1
  29. package/dist/{expansion-DaTroIyv.cjs → expansion--UuRowv-.cjs} +267 -4
  30. package/dist/expansion--UuRowv-.cjs.map +1 -0
  31. package/dist/{expansion-ClDhlMK8.js → expansion-CZLNK6Pr.js} +220 -5
  32. package/dist/expansion-CZLNK6Pr.js.map +1 -0
  33. package/dist/gpu/csr-graph.d.ts +68 -0
  34. package/dist/gpu/csr-graph.d.ts.map +1 -0
  35. package/dist/gpu/csr-graph.unit.test.d.ts +2 -0
  36. package/dist/gpu/csr-graph.unit.test.d.ts.map +1 -0
  37. package/dist/gpu/index.cjs +220 -15
  38. package/dist/gpu/index.cjs.map +1 -0
  39. package/dist/gpu/index.d.ts +1 -0
  40. package/dist/gpu/index.d.ts.map +1 -1
  41. package/dist/gpu/index.js +204 -2
  42. package/dist/gpu/index.js.map +1 -0
  43. package/dist/gpu/kernels/adamic-adar/kernel.d.ts +39 -0
  44. package/dist/gpu/kernels/adamic-adar/kernel.d.ts.map +1 -0
  45. package/dist/gpu/kernels/intersection/kernel.d.ts +50 -0
  46. package/dist/gpu/kernels/intersection/kernel.d.ts.map +1 -0
  47. package/dist/gpu/kernels/intersection/logic.d.ts +87 -0
  48. package/dist/gpu/kernels/intersection/logic.d.ts.map +1 -0
  49. package/dist/gpu/kernels/intersection/logic.unit.test.d.ts +2 -0
  50. package/dist/gpu/kernels/intersection/logic.unit.test.d.ts.map +1 -0
  51. package/dist/gpu/kernels/kmeans/index.d.ts +6 -0
  52. package/dist/gpu/kernels/kmeans/index.d.ts.map +1 -0
  53. package/dist/gpu/kernels/kmeans/kernel.d.ts +34 -0
  54. package/dist/gpu/kernels/kmeans/kernel.d.ts.map +1 -0
  55. package/dist/gpu/kernels/kmeans/logic.d.ts +111 -0
  56. package/dist/gpu/kernels/kmeans/logic.d.ts.map +1 -0
  57. package/dist/gpu/kernels/kmeans/logic.unit.test.d.ts +5 -0
  58. package/dist/gpu/kernels/kmeans/logic.unit.test.d.ts.map +1 -0
  59. package/dist/gpu/operations.d.ts +52 -0
  60. package/dist/gpu/operations.d.ts.map +1 -1
  61. package/dist/index/index.cjs +38 -19
  62. package/dist/index/index.js +10 -8
  63. package/dist/{jaccard-Bys9_dGW.cjs → jaccard-Bdw4B0i4.cjs} +1 -1
  64. package/dist/{jaccard-Bys9_dGW.cjs.map → jaccard-Bdw4B0i4.cjs.map} +1 -1
  65. package/dist/{jaccard-3rCdilwm.js → jaccard-BwC_NuQu.js} +1 -1
  66. package/dist/{jaccard-3rCdilwm.js.map → jaccard-BwC_NuQu.js.map} +1 -1
  67. package/dist/kernel-2oH4Cn32.cjs +1001 -0
  68. package/dist/kernel-2oH4Cn32.cjs.map +1 -0
  69. package/dist/kernel-6deK9fh1.js +724 -0
  70. package/dist/kernel-6deK9fh1.js.map +1 -0
  71. package/dist/kernel-CXeGBH3s.cjs +467 -0
  72. package/dist/kernel-CXeGBH3s.cjs.map +1 -0
  73. package/dist/kernel-CigCjrts.js +467 -0
  74. package/dist/kernel-CigCjrts.js.map +1 -0
  75. package/dist/kernel-CvnRsF7E.js +1001 -0
  76. package/dist/kernel-CvnRsF7E.js.map +1 -0
  77. package/dist/kernel-DukrXtVb.cjs +724 -0
  78. package/dist/kernel-DukrXtVb.cjs.map +1 -0
  79. package/dist/{kmeans-B8x9D1kt.cjs → kmeans-CZ7tJFYw.cjs} +1 -1
  80. package/dist/{kmeans-B8x9D1kt.cjs.map → kmeans-CZ7tJFYw.cjs.map} +1 -1
  81. package/dist/{kmeans-DKkL9rAN.js → kmeans-DLrlrp6i.js} +1 -1
  82. package/dist/{kmeans-DKkL9rAN.js.map → kmeans-DLrlrp6i.js.map} +1 -1
  83. package/dist/logic-Dbyfb_-7.cjs +289 -0
  84. package/dist/logic-Dbyfb_-7.cjs.map +1 -0
  85. package/dist/logic-DyBzRg1A.js +242 -0
  86. package/dist/logic-DyBzRg1A.js.map +1 -0
  87. package/dist/operations-D-RB67WP.cjs +2269 -0
  88. package/dist/operations-D-RB67WP.cjs.map +1 -0
  89. package/dist/operations-D9otVlIH.js +2198 -0
  90. package/dist/operations-D9otVlIH.js.map +1 -0
  91. package/dist/{ops-upIi6JIi.js → ops-D5xZr4fV.js} +60 -2
  92. package/dist/ops-D5xZr4fV.js.map +1 -0
  93. package/dist/{ops-djAsQQSh.cjs → ops-paa1Nvlf.cjs} +71 -1
  94. package/dist/ops-paa1Nvlf.cjs.map +1 -0
  95. package/dist/ranking/baselines/communicability.d.ts +12 -0
  96. package/dist/ranking/baselines/communicability.d.ts.map +1 -1
  97. package/dist/ranking/baselines/katz.d.ts +12 -0
  98. package/dist/ranking/baselines/katz.d.ts.map +1 -1
  99. package/dist/ranking/baselines/pagerank.d.ts +15 -0
  100. package/dist/ranking/baselines/pagerank.d.ts.map +1 -1
  101. package/dist/ranking/baselines/types.d.ts +3 -0
  102. package/dist/ranking/baselines/types.d.ts.map +1 -1
  103. package/dist/ranking/index.cjs +5 -2
  104. package/dist/ranking/index.js +3 -3
  105. package/dist/ranking/mi/index.cjs +1 -1
  106. package/dist/ranking/mi/index.js +1 -1
  107. package/dist/ranking/parse-gpu.d.ts +31 -0
  108. package/dist/ranking/parse-gpu.d.ts.map +1 -0
  109. package/dist/ranking/parse-gpu.unit.test.d.ts +5 -0
  110. package/dist/ranking/parse-gpu.unit.test.d.ts.map +1 -0
  111. package/dist/ranking/parse.d.ts.map +1 -1
  112. package/dist/{ranking-3ez5m67U.js → ranking-DOKDBcIR.js} +237 -11
  113. package/dist/ranking-DOKDBcIR.js.map +1 -0
  114. package/dist/{ranking-DVvajgUZ.cjs → ranking-pe5UaxKg.cjs} +254 -10
  115. package/dist/ranking-pe5UaxKg.cjs.map +1 -0
  116. package/dist/schemas/graph.d.ts +1 -1
  117. package/dist/seeds/grasp-gpu.d.ts +40 -0
  118. package/dist/seeds/grasp-gpu.d.ts.map +1 -0
  119. package/dist/seeds/index.cjs +1 -1
  120. package/dist/seeds/index.js +1 -1
  121. package/dist/{gpu-CHiCN0wa.js → typegpu-Dq5FfUB8.cjs} +16 -2041
  122. package/dist/typegpu-Dq5FfUB8.cjs.map +1 -0
  123. package/dist/{gpu-Y6owRVMi.cjs → typegpu-DwnJf28i.js} +2 -2127
  124. package/dist/typegpu-DwnJf28i.js.map +1 -0
  125. package/dist/utils/index.cjs +1 -1
  126. package/dist/utils/index.js +1 -1
  127. package/package.json +1 -1
  128. package/dist/expansion-ClDhlMK8.js.map +0 -1
  129. package/dist/expansion-DaTroIyv.cjs.map +0 -1
  130. package/dist/gpu-CHiCN0wa.js.map +0 -1
  131. package/dist/gpu-Y6owRVMi.cjs.map +0 -1
  132. package/dist/ops-djAsQQSh.cjs.map +0 -1
  133. package/dist/ops-upIi6JIi.js.map +0 -1
  134. package/dist/ranking-3ez5m67U.js.map +0 -1
  135. package/dist/ranking-DVvajgUZ.cjs.map +0 -1
@@ -1,16 +1,221 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_gpu = require("../gpu-Y6owRVMi.cjs");
3
- exports.GPUNotAvailableError = require_gpu.GPUNotAvailableError;
4
- exports.assertWebGPUAvailable = require_gpu.assertWebGPUAvailable;
5
- exports.csrToTypedBuffers = require_gpu.csrToTypedBuffers;
6
- exports.detectWebGPU = require_gpu.detectWebGPU;
7
- exports.gpuBfsLevels = require_gpu.gpuBfsLevels;
8
- exports.gpuDegreeHistogram = require_gpu.gpuDegreeHistogram;
9
- exports.gpuJaccardBatch = require_gpu.gpuJaccardBatch;
10
- exports.gpuPageRank = require_gpu.gpuPageRank;
11
- exports.gpuSpmv = require_gpu.gpuSpmv;
12
- exports.graphToCSR = require_gpu.graphToCSR;
13
- exports.initGPU = require_gpu.initGPU;
14
- exports.initGPUFromDevice = require_gpu.initGPUFromDevice;
15
- exports.isWebGPUAvailable = require_gpu.isWebGPUAvailable;
16
- exports.withBackend = require_gpu.withBackend;
2
+ const require_typegpu = require("../typegpu-Dq5FfUB8.cjs");
3
+ const require_logic = require("../logic-Dbyfb_-7.cjs");
4
+ const require_operations = require("../operations-D-RB67WP.cjs");
5
+ //#region src/gpu/csr-graph.ts
6
+ /**
7
+ * A ReadableGraph implementation backed by CSR arrays.
8
+ *
9
+ * All neighbourhood and degree queries use CSR row slices (O(1) slice + O(k) iteration
10
+ * where k is neighbourhood size). This is significantly faster than hash map lookups
11
+ * on large graphs, especially when the same nodes are queried multiple times.
12
+ *
13
+ * @typeParam N - Node data type (not stored; always returns undefined from getNode)
14
+ * @typeParam E - Edge data type (not stored; always returns undefined from getEdge)
15
+ */
16
+ var CSRReadableGraph = class CSRReadableGraph {
17
+ csr;
18
+ indexMap;
19
+ isDirected;
20
+ /**
21
+ * Create a CSR-backed graph from CSR structures.
22
+ *
23
+ * @param csr - CSR matrix (rowOffsets, colIndices)
24
+ * @param indexMap - Node ID ↔ CSR index mapping
25
+ * @param directed - Whether the graph is directed
26
+ */
27
+ constructor(csr, indexMap, directed) {
28
+ this.csr = csr;
29
+ this.indexMap = indexMap;
30
+ this.isDirected = directed;
31
+ }
32
+ /**
33
+ * Create a CSR-backed graph from any ReadableGraph.
34
+ *
35
+ * Converts the graph to CSR format (O(V + E) time) and returns a
36
+ * CSRReadableGraph wrapping the result.
37
+ *
38
+ * @param graph - Graph to convert
39
+ * @param direction - Edge direction for CSR (default: 'out' for directed, 'both' for undirected)
40
+ * @returns CSRReadableGraph with identical topology
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const original = AdjacencyMapGraph.undirected();
45
+ * // ... add nodes and edges ...
46
+ *
47
+ * const csr = CSRReadableGraph.from(original);
48
+ *
49
+ * // All operations on csr are identical to original but faster
50
+ * assert.deepEqual(
51
+ * [...csr.neighbours('A')],
52
+ * [...original.neighbours('A')]
53
+ * );
54
+ * ```
55
+ */
56
+ static from(graph, direction = graph.directed ? "out" : "both") {
57
+ const nodeToIndex = /* @__PURE__ */ new Map();
58
+ const indexToNode = [];
59
+ for (const nodeId of graph.nodeIds()) {
60
+ const index = indexToNode.length;
61
+ nodeToIndex.set(nodeId, index);
62
+ indexToNode.push(nodeId);
63
+ }
64
+ const nodeCount = indexToNode.length;
65
+ const degrees = new Uint32Array(nodeCount);
66
+ for (const nodeId of graph.nodeIds()) {
67
+ const srcIndex = nodeToIndex.get(nodeId);
68
+ if (srcIndex === void 0) continue;
69
+ degrees[srcIndex] = graph.degree(nodeId, direction);
70
+ }
71
+ const rowOffsets = new Uint32Array(nodeCount + 1);
72
+ for (let i = 0; i < nodeCount; i++) rowOffsets[i + 1] = (rowOffsets[i] ?? 0) + (degrees[i] ?? 0);
73
+ const totalEdges = rowOffsets[nodeCount] ?? 0;
74
+ const colIndices = new Uint32Array(totalEdges);
75
+ for (const nodeId of graph.nodeIds()) {
76
+ const srcIndex = nodeToIndex.get(nodeId);
77
+ if (srcIndex === void 0) continue;
78
+ const baseOffset = rowOffsets[srcIndex] ?? 0;
79
+ let localOffset = 0;
80
+ for (const neighbourId of graph.neighbours(nodeId, direction)) {
81
+ const dstIndex = nodeToIndex.get(neighbourId);
82
+ if (dstIndex === void 0) continue;
83
+ colIndices[baseOffset + localOffset] = dstIndex;
84
+ localOffset++;
85
+ }
86
+ }
87
+ return new CSRReadableGraph({
88
+ rowOffsets,
89
+ colIndices,
90
+ nodeCount,
91
+ edgeCount: graph.directed ? graph.edgeCount : graph.edgeCount * 2
92
+ }, {
93
+ nodeToIndex,
94
+ indexToNode
95
+ }, graph.directed);
96
+ }
97
+ /**
98
+ * Access the underlying CSR matrix and index map.
99
+ *
100
+ * Useful for GPU operations that need direct CSR data.
101
+ */
102
+ get data() {
103
+ return {
104
+ csr: this.csr,
105
+ indexMap: this.indexMap
106
+ };
107
+ }
108
+ get directed() {
109
+ return this.isDirected;
110
+ }
111
+ get nodeCount() {
112
+ return this.csr.nodeCount;
113
+ }
114
+ get edgeCount() {
115
+ return this.csr.edgeCount;
116
+ }
117
+ hasNode(id) {
118
+ return this.indexMap.nodeToIndex.has(id);
119
+ }
120
+ getNode(_id) {}
121
+ *nodeIds() {
122
+ for (const nodeId of this.indexMap.indexToNode) yield nodeId;
123
+ }
124
+ *neighbours(id, _direction) {
125
+ const srcIdx = this.indexMap.nodeToIndex.get(id);
126
+ if (srcIdx === void 0) return;
127
+ const { rowOffsets, colIndices } = this.csr;
128
+ const start = rowOffsets[srcIdx] ?? 0;
129
+ const end = rowOffsets[srcIdx + 1] ?? 0;
130
+ for (let i = start; i < end; i++) {
131
+ const dstIdx = colIndices[i];
132
+ if (dstIdx !== void 0) {
133
+ const nodeId = this.indexMap.indexToNode[dstIdx];
134
+ if (nodeId !== void 0) yield nodeId;
135
+ }
136
+ }
137
+ }
138
+ degree(id, _direction) {
139
+ const idx = this.indexMap.nodeToIndex.get(id);
140
+ if (idx === void 0) return 0;
141
+ const { rowOffsets } = this.csr;
142
+ return (rowOffsets[idx + 1] ?? 0) - (rowOffsets[idx] ?? 0);
143
+ }
144
+ getEdge(_source, _target) {}
145
+ *edges() {}
146
+ };
147
+ //#endregion
148
+ //#region src/gpu/root.ts
149
+ /**
150
+ * TypeGPU root initialisation for graphwise GPU operations.
151
+ *
152
+ * Provides a simplified wrapper around TypeGPU's tgpu.init() for
153
+ * GPU device acquisition and resource management.
154
+ *
155
+ * @module gpu/root
156
+ */
157
+ /**
158
+ * Initialise a TypeGPU root for GPU compute operations.
159
+ *
160
+ * This wraps tgpu.init() with WebGPU availability checking and
161
+ * simplified options.
162
+ *
163
+ * @param options - Initialisation options
164
+ * @returns Promise resolving to a TypeGPU root instance
165
+ * @throws Error if WebGPU is unavailable or device request fails
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * import { initGPU } from "graphwise/gpu";
170
+ *
171
+ * const root = await initGPU();
172
+ * // Use root for GPU operations...
173
+ * root.destroy();
174
+ * ```
175
+ */
176
+ async function initGPU(options = {}) {
177
+ const detection = require_operations.detectWebGPU();
178
+ if (!detection.available) throw new Error(`WebGPU unavailable: ${detection.reason ?? "unknown reason"}`);
179
+ return await require_typegpu.tgpu_exports.init({ adapter: options.powerPreference ? { powerPreference: options.powerPreference } : void 0 });
180
+ }
181
+ /**
182
+ * Create a TypeGPU root from an existing GPU device.
183
+ *
184
+ * Use this when you already have a GPUDevice and want to wrap it
185
+ * with TypeGPU functionality.
186
+ *
187
+ * @param device - Existing GPU device
188
+ * @returns TypeGPU root instance
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * import { initGPUFromDevice } from "graphwise/gpu";
193
+ *
194
+ * const adapter = await navigator.gpu.requestAdapter();
195
+ * const device = await adapter.requestDevice();
196
+ * const root = initGPUFromDevice(device);
197
+ * ```
198
+ */
199
+ function initGPUFromDevice(device) {
200
+ return require_typegpu.tgpu_exports.initFromDevice({ device });
201
+ }
202
+ //#endregion
203
+ exports.CSRReadableGraph = CSRReadableGraph;
204
+ exports.GPUNotAvailableError = require_operations.GPUNotAvailableError;
205
+ exports.assertWebGPUAvailable = require_operations.assertWebGPUAvailable;
206
+ exports.csrToTypedBuffers = require_logic.csrToTypedBuffers;
207
+ exports.detectWebGPU = require_operations.detectWebGPU;
208
+ exports.gpuBfsLevels = require_operations.gpuBfsLevels;
209
+ exports.gpuDegreeHistogram = require_operations.gpuDegreeHistogram;
210
+ exports.gpuJaccardBatch = require_operations.gpuJaccardBatch;
211
+ exports.gpuKMeansAssign = require_operations.gpuKMeansAssign;
212
+ exports.gpuMIBatch = require_operations.gpuMIBatch;
213
+ exports.gpuPageRank = require_operations.gpuPageRank;
214
+ exports.gpuSpmv = require_operations.gpuSpmv;
215
+ exports.graphToCSR = require_logic.graphToCSR;
216
+ exports.initGPU = initGPU;
217
+ exports.initGPUFromDevice = initGPUFromDevice;
218
+ exports.isWebGPUAvailable = require_operations.isWebGPUAvailable;
219
+ exports.withBackend = require_operations.withBackend;
220
+
221
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/gpu/csr-graph.ts","../../src/gpu/root.ts"],"sourcesContent":["/**\n * CSR-backed read-only graph implementation.\n *\n * Provides a cache-friendly ReadableGraph backed by Compressed Sparse Row\n * arrays. Neighbourhood lookups are O(1) slices; perfect for algorithms\n * that make many repeated queries on large static graphs.\n *\n * Node and edge data are not stored (CSR is topology-only), so `getNode`\n * and `getEdge` always return undefined. For data-aware algorithms, wrap\n * in a composite that delegates data lookups to a separate store.\n */\n\nimport type { NodeId, Direction, NodeData, EdgeData } from \"../graph/types\";\nimport type { ReadableGraph } from \"../graph\";\nimport type { CSRGraph, CSRIndexMap, CSRMatrix } from \"./csr\";\n\n/**\n * A ReadableGraph implementation backed by CSR arrays.\n *\n * All neighbourhood and degree queries use CSR row slices (O(1) slice + O(k) iteration\n * where k is neighbourhood size). This is significantly faster than hash map lookups\n * on large graphs, especially when the same nodes are queried multiple times.\n *\n * @typeParam N - Node data type (not stored; always returns undefined from getNode)\n * @typeParam E - Edge data type (not stored; always returns undefined from getEdge)\n */\nexport class CSRReadableGraph<\n\tN extends NodeData = NodeData,\n\tE extends EdgeData = EdgeData,\n> implements ReadableGraph<N, E> {\n\tprivate readonly csr: CSRMatrix;\n\tprivate readonly indexMap: CSRIndexMap;\n\tprivate readonly isDirected: boolean;\n\n\t/**\n\t * Create a CSR-backed graph from CSR structures.\n\t *\n\t * @param csr - CSR matrix (rowOffsets, colIndices)\n\t * @param indexMap - Node ID ↔ CSR index mapping\n\t * @param directed - Whether the graph is directed\n\t */\n\tprivate constructor(\n\t\tcsr: CSRMatrix,\n\t\tindexMap: CSRIndexMap,\n\t\tdirected: boolean,\n\t) {\n\t\tthis.csr = csr;\n\t\tthis.indexMap = indexMap;\n\t\tthis.isDirected = directed;\n\t}\n\n\t/**\n\t * Create a CSR-backed graph from any ReadableGraph.\n\t *\n\t * Converts the graph to CSR format (O(V + E) time) and returns a\n\t * CSRReadableGraph wrapping the result.\n\t *\n\t * @param graph - Graph to convert\n\t * @param direction - Edge direction for CSR (default: 'out' for directed, 'both' for undirected)\n\t * @returns CSRReadableGraph with identical topology\n\t *\n\t * @example\n\t * ```typescript\n\t * const original = AdjacencyMapGraph.undirected();\n\t * // ... add nodes and edges ...\n\t *\n\t * const csr = CSRReadableGraph.from(original);\n\t *\n\t * // All operations on csr are identical to original but faster\n\t * assert.deepEqual(\n\t * [...csr.neighbours('A')],\n\t * [...original.neighbours('A')]\n\t * );\n\t * ```\n\t */\n\tstatic from<N extends NodeData, E extends EdgeData>(\n\t\tgraph: ReadableGraph<N, E>,\n\t\tdirection: Direction = graph.directed ? \"out\" : \"both\",\n\t): CSRReadableGraph<N, E> {\n\t\tconst nodeToIndex = new Map<NodeId, number>();\n\t\tconst indexToNode: NodeId[] = [];\n\n\t\tfor (const nodeId of graph.nodeIds()) {\n\t\t\tconst index = indexToNode.length;\n\t\t\tnodeToIndex.set(nodeId, index);\n\t\t\tindexToNode.push(nodeId);\n\t\t}\n\n\t\tconst nodeCount = indexToNode.length;\n\n\t\t// Count edges per node\n\t\tconst degrees = new Uint32Array(nodeCount);\n\t\tfor (const nodeId of graph.nodeIds()) {\n\t\t\tconst srcIndex = nodeToIndex.get(nodeId);\n\t\t\tif (srcIndex === undefined) continue;\n\t\t\tdegrees[srcIndex] = graph.degree(nodeId, direction);\n\t\t}\n\n\t\t// Build rowOffsets\n\t\tconst rowOffsets = new Uint32Array(nodeCount + 1);\n\t\tfor (let i = 0; i < nodeCount; i++) {\n\t\t\trowOffsets[i + 1] = (rowOffsets[i] ?? 0) + (degrees[i] ?? 0);\n\t\t}\n\n\t\tconst totalEdges = rowOffsets[nodeCount] ?? 0;\n\n\t\t// Build colIndices\n\t\tconst colIndices = new Uint32Array(totalEdges);\n\n\t\tfor (const nodeId of graph.nodeIds()) {\n\t\t\tconst srcIndex = nodeToIndex.get(nodeId);\n\t\t\tif (srcIndex === undefined) continue;\n\n\t\t\tconst baseOffset = rowOffsets[srcIndex] ?? 0;\n\t\t\tlet localOffset = 0;\n\n\t\t\tfor (const neighbourId of graph.neighbours(nodeId, direction)) {\n\t\t\t\tconst dstIndex = nodeToIndex.get(neighbourId);\n\t\t\t\tif (dstIndex === undefined) continue;\n\n\t\t\t\tcolIndices[baseOffset + localOffset] = dstIndex;\n\t\t\t\tlocalOffset++;\n\t\t\t}\n\t\t}\n\n\t\tconst csr: CSRMatrix = {\n\t\t\trowOffsets,\n\t\t\tcolIndices,\n\t\t\tnodeCount,\n\t\t\tedgeCount: graph.directed ? graph.edgeCount : graph.edgeCount * 2,\n\t\t};\n\n\t\tconst indexMap: CSRIndexMap = {\n\t\t\tnodeToIndex,\n\t\t\tindexToNode,\n\t\t};\n\n\t\treturn new CSRReadableGraph(csr, indexMap, graph.directed);\n\t}\n\n\t/**\n\t * Access the underlying CSR matrix and index map.\n\t *\n\t * Useful for GPU operations that need direct CSR data.\n\t */\n\tget data(): CSRGraph {\n\t\treturn {\n\t\t\tcsr: this.csr,\n\t\t\tindexMap: this.indexMap,\n\t\t};\n\t}\n\n\tget directed(): boolean {\n\t\treturn this.isDirected;\n\t}\n\n\tget nodeCount(): number {\n\t\treturn this.csr.nodeCount;\n\t}\n\n\tget edgeCount(): number {\n\t\treturn this.csr.edgeCount;\n\t}\n\n\thasNode(id: NodeId): boolean {\n\t\treturn this.indexMap.nodeToIndex.has(id);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tgetNode(_id: NodeId): undefined {\n\t\t// CSR stores topology only, no node data\n\t\treturn undefined;\n\t}\n\n\t*nodeIds(): Iterable<NodeId> {\n\t\tfor (const nodeId of this.indexMap.indexToNode) {\n\t\t\tyield nodeId;\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t*neighbours(id: NodeId, _direction?: Direction): Iterable<NodeId> {\n\t\tconst srcIdx = this.indexMap.nodeToIndex.get(id);\n\t\tif (srcIdx === undefined) return;\n\n\t\tconst { rowOffsets, colIndices } = this.csr;\n\t\tconst start = rowOffsets[srcIdx] ?? 0;\n\t\tconst end = rowOffsets[srcIdx + 1] ?? 0;\n\n\t\t// For CSR backed by 'both' direction in undirected graphs, all entries\n\t\t// are already bidirectional. Otherwise respect the direction parameter.\n\t\t// (CSR format was built with the specified direction, so we just iterate.)\n\n\t\tfor (let i = start; i < end; i++) {\n\t\t\tconst dstIdx = colIndices[i];\n\t\t\tif (dstIdx !== undefined) {\n\t\t\t\tconst nodeId = this.indexMap.indexToNode[dstIdx];\n\t\t\t\tif (nodeId !== undefined) {\n\t\t\t\t\tyield nodeId;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tdegree(id: NodeId, _direction?: Direction): number {\n\t\tconst idx = this.indexMap.nodeToIndex.get(id);\n\t\tif (idx === undefined) return 0;\n\n\t\tconst { rowOffsets } = this.csr;\n\t\treturn (rowOffsets[idx + 1] ?? 0) - (rowOffsets[idx] ?? 0);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tgetEdge(_source: NodeId, _target: NodeId): undefined {\n\t\t// CSR stores topology only, no edge data\n\t\treturn undefined;\n\t}\n\n\t*edges(): Iterable<E> {\n\t\t// No edges can be returned because we have no edge data\n\t}\n}\n","/**\n * TypeGPU root initialisation for graphwise GPU operations.\n *\n * Provides a simplified wrapper around TypeGPU's tgpu.init() for\n * GPU device acquisition and resource management.\n *\n * @module gpu/root\n */\n\nimport { tgpu } from \"typegpu\";\nimport { detectWebGPU } from \"./detect\";\n\n/**\n * Options for initialising the GPU root.\n */\nexport interface InitGPUOptions {\n\t/** Power preference for GPU adapter */\n\treadonly powerPreference?: \"low-power\" | \"high-performance\";\n}\n\n/**\n * The TypeGPU root instance used for GPU operations.\n * Re-exports TgpuRoot from TypeGPU for convenience.\n */\nexport type GraphwiseGPURoot = Awaited<ReturnType<typeof tgpu.init>>;\n\n/**\n * Initialise a TypeGPU root for GPU compute operations.\n *\n * This wraps tgpu.init() with WebGPU availability checking and\n * simplified options.\n *\n * @param options - Initialisation options\n * @returns Promise resolving to a TypeGPU root instance\n * @throws Error if WebGPU is unavailable or device request fails\n *\n * @example\n * ```typescript\n * import { initGPU } from \"graphwise/gpu\";\n *\n * const root = await initGPU();\n * // Use root for GPU operations...\n * root.destroy();\n * ```\n */\nexport async function initGPU(\n\toptions: InitGPUOptions = {},\n): Promise<GraphwiseGPURoot> {\n\tconst detection = detectWebGPU();\n\tif (!detection.available) {\n\t\tthrow new Error(\n\t\t\t`WebGPU unavailable: ${detection.reason ?? \"unknown reason\"}`,\n\t\t);\n\t}\n\n\tconst root = await tgpu.init({\n\t\tadapter: options.powerPreference\n\t\t\t? { powerPreference: options.powerPreference }\n\t\t\t: undefined,\n\t});\n\n\treturn root;\n}\n\n/**\n * Create a TypeGPU root from an existing GPU device.\n *\n * Use this when you already have a GPUDevice and want to wrap it\n * with TypeGPU functionality.\n *\n * @param device - Existing GPU device\n * @returns TypeGPU root instance\n *\n * @example\n * ```typescript\n * import { initGPUFromDevice } from \"graphwise/gpu\";\n *\n * const adapter = await navigator.gpu.requestAdapter();\n * const device = await adapter.requestDevice();\n * const root = initGPUFromDevice(device);\n * ```\n */\nexport function initGPUFromDevice(device: GPUDevice): GraphwiseGPURoot {\n\treturn tgpu.initFromDevice({ device });\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,IAAa,mBAAb,MAAa,iBAGoB;CAChC;CACA;CACA;;;;;;;;CASA,YACC,KACA,UACA,UACC;AACD,OAAK,MAAM;AACX,OAAK,WAAW;AAChB,OAAK,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BnB,OAAO,KACN,OACA,YAAuB,MAAM,WAAW,QAAQ,QACvB;EACzB,MAAM,8BAAc,IAAI,KAAqB;EAC7C,MAAM,cAAwB,EAAE;AAEhC,OAAK,MAAM,UAAU,MAAM,SAAS,EAAE;GACrC,MAAM,QAAQ,YAAY;AAC1B,eAAY,IAAI,QAAQ,MAAM;AAC9B,eAAY,KAAK,OAAO;;EAGzB,MAAM,YAAY,YAAY;EAG9B,MAAM,UAAU,IAAI,YAAY,UAAU;AAC1C,OAAK,MAAM,UAAU,MAAM,SAAS,EAAE;GACrC,MAAM,WAAW,YAAY,IAAI,OAAO;AACxC,OAAI,aAAa,KAAA,EAAW;AAC5B,WAAQ,YAAY,MAAM,OAAO,QAAQ,UAAU;;EAIpD,MAAM,aAAa,IAAI,YAAY,YAAY,EAAE;AACjD,OAAK,IAAI,IAAI,GAAG,IAAI,WAAW,IAC9B,YAAW,IAAI,MAAM,WAAW,MAAM,MAAM,QAAQ,MAAM;EAG3D,MAAM,aAAa,WAAW,cAAc;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W,KAAA,EACd,OAAM;;;;CAOV,OAAO,IAAY,YAAgC;EAClD,MAAM,MAAM,KAAK,SAAS,YAAY,IAAI,GAAG;AAC7C,MAAI,QAAQ,KAAA,EAAW,QAAO;EAE9B,MAAM,EAAE,eAAe,KAAK;AAC5B,UAAQ,WAAW,MAAM,MAAM,MAAM,WAAW,QAAQ;;CAIzD,QAAQ,SAAiB,SAA4B;CAKrD,CAAC,QAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9KvB,eAAsB,QACrB,UAA0B,EAAE,EACA;CAC5B,MAAM,YAAY,mBAAA,cAAc;AAChC,KAAI,CAAC,UAAU,UACd,OAAM,IAAI,MACT,uBAAuB,UAAU,UAAU,mBAC3C;AASF,QANa,MAAM,gBAAA,aAAK,KAAK,EAC5B,SAAS,QAAQ,kBACd,EAAE,iBAAiB,QAAQ,iBAAiB,GAC5C,KAAA,GACH,CAAC;;;;;;;;;;;;;;;;;;;;AAuBH,SAAgB,kBAAkB,QAAqC;AACtE,QAAO,gBAAA,aAAK,eAAe,EAAE,QAAQ,CAAC"}
@@ -5,6 +5,7 @@
5
5
  */
6
6
  export * from './types';
7
7
  export * from './csr';
8
+ export * from './csr-graph';
8
9
  export * from './detect';
9
10
  export * from './root';
10
11
  export * from './dispatch';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gpu/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gpu/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
package/dist/gpu/index.js CHANGED
@@ -1,2 +1,204 @@
1
- import { a as gpuSpmv, c as initGPUFromDevice, d as isWebGPUAvailable, f as csrToTypedBuffers, i as gpuPageRank, l as assertWebGPUAvailable, m as GPUNotAvailableError, n as gpuDegreeHistogram, o as withBackend, p as graphToCSR, r as gpuJaccardBatch, s as initGPU, t as gpuBfsLevels, u as detectWebGPU } from "../gpu-CHiCN0wa.js";
2
- export { GPUNotAvailableError, assertWebGPUAvailable, csrToTypedBuffers, detectWebGPU, gpuBfsLevels, gpuDegreeHistogram, gpuJaccardBatch, gpuPageRank, gpuSpmv, graphToCSR, initGPU, initGPUFromDevice, isWebGPUAvailable, withBackend };
1
+ import { r as tgpu_exports } from "../typegpu-DwnJf28i.js";
2
+ import { c as graphToCSR, s as csrToTypedBuffers } from "../logic-DyBzRg1A.js";
3
+ import { a as gpuMIBatch, c as withBackend, d as detectWebGPU, f as isWebGPUAvailable, i as gpuKMeansAssign, l as GPUNotAvailableError, n as gpuDegreeHistogram, o as gpuPageRank, r as gpuJaccardBatch, s as gpuSpmv, t as gpuBfsLevels, u as assertWebGPUAvailable } from "../operations-D9otVlIH.js";
4
+ //#region src/gpu/csr-graph.ts
5
+ /**
6
+ * A ReadableGraph implementation backed by CSR arrays.
7
+ *
8
+ * All neighbourhood and degree queries use CSR row slices (O(1) slice + O(k) iteration
9
+ * where k is neighbourhood size). This is significantly faster than hash map lookups
10
+ * on large graphs, especially when the same nodes are queried multiple times.
11
+ *
12
+ * @typeParam N - Node data type (not stored; always returns undefined from getNode)
13
+ * @typeParam E - Edge data type (not stored; always returns undefined from getEdge)
14
+ */
15
+ var CSRReadableGraph = class CSRReadableGraph {
16
+ csr;
17
+ indexMap;
18
+ isDirected;
19
+ /**
20
+ * Create a CSR-backed graph from CSR structures.
21
+ *
22
+ * @param csr - CSR matrix (rowOffsets, colIndices)
23
+ * @param indexMap - Node ID ↔ CSR index mapping
24
+ * @param directed - Whether the graph is directed
25
+ */
26
+ constructor(csr, indexMap, directed) {
27
+ this.csr = csr;
28
+ this.indexMap = indexMap;
29
+ this.isDirected = directed;
30
+ }
31
+ /**
32
+ * Create a CSR-backed graph from any ReadableGraph.
33
+ *
34
+ * Converts the graph to CSR format (O(V + E) time) and returns a
35
+ * CSRReadableGraph wrapping the result.
36
+ *
37
+ * @param graph - Graph to convert
38
+ * @param direction - Edge direction for CSR (default: 'out' for directed, 'both' for undirected)
39
+ * @returns CSRReadableGraph with identical topology
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const original = AdjacencyMapGraph.undirected();
44
+ * // ... add nodes and edges ...
45
+ *
46
+ * const csr = CSRReadableGraph.from(original);
47
+ *
48
+ * // All operations on csr are identical to original but faster
49
+ * assert.deepEqual(
50
+ * [...csr.neighbours('A')],
51
+ * [...original.neighbours('A')]
52
+ * );
53
+ * ```
54
+ */
55
+ static from(graph, direction = graph.directed ? "out" : "both") {
56
+ const nodeToIndex = /* @__PURE__ */ new Map();
57
+ const indexToNode = [];
58
+ for (const nodeId of graph.nodeIds()) {
59
+ const index = indexToNode.length;
60
+ nodeToIndex.set(nodeId, index);
61
+ indexToNode.push(nodeId);
62
+ }
63
+ const nodeCount = indexToNode.length;
64
+ const degrees = new Uint32Array(nodeCount);
65
+ for (const nodeId of graph.nodeIds()) {
66
+ const srcIndex = nodeToIndex.get(nodeId);
67
+ if (srcIndex === void 0) continue;
68
+ degrees[srcIndex] = graph.degree(nodeId, direction);
69
+ }
70
+ const rowOffsets = new Uint32Array(nodeCount + 1);
71
+ for (let i = 0; i < nodeCount; i++) rowOffsets[i + 1] = (rowOffsets[i] ?? 0) + (degrees[i] ?? 0);
72
+ const totalEdges = rowOffsets[nodeCount] ?? 0;
73
+ const colIndices = new Uint32Array(totalEdges);
74
+ for (const nodeId of graph.nodeIds()) {
75
+ const srcIndex = nodeToIndex.get(nodeId);
76
+ if (srcIndex === void 0) continue;
77
+ const baseOffset = rowOffsets[srcIndex] ?? 0;
78
+ let localOffset = 0;
79
+ for (const neighbourId of graph.neighbours(nodeId, direction)) {
80
+ const dstIndex = nodeToIndex.get(neighbourId);
81
+ if (dstIndex === void 0) continue;
82
+ colIndices[baseOffset + localOffset] = dstIndex;
83
+ localOffset++;
84
+ }
85
+ }
86
+ return new CSRReadableGraph({
87
+ rowOffsets,
88
+ colIndices,
89
+ nodeCount,
90
+ edgeCount: graph.directed ? graph.edgeCount : graph.edgeCount * 2
91
+ }, {
92
+ nodeToIndex,
93
+ indexToNode
94
+ }, graph.directed);
95
+ }
96
+ /**
97
+ * Access the underlying CSR matrix and index map.
98
+ *
99
+ * Useful for GPU operations that need direct CSR data.
100
+ */
101
+ get data() {
102
+ return {
103
+ csr: this.csr,
104
+ indexMap: this.indexMap
105
+ };
106
+ }
107
+ get directed() {
108
+ return this.isDirected;
109
+ }
110
+ get nodeCount() {
111
+ return this.csr.nodeCount;
112
+ }
113
+ get edgeCount() {
114
+ return this.csr.edgeCount;
115
+ }
116
+ hasNode(id) {
117
+ return this.indexMap.nodeToIndex.has(id);
118
+ }
119
+ getNode(_id) {}
120
+ *nodeIds() {
121
+ for (const nodeId of this.indexMap.indexToNode) yield nodeId;
122
+ }
123
+ *neighbours(id, _direction) {
124
+ const srcIdx = this.indexMap.nodeToIndex.get(id);
125
+ if (srcIdx === void 0) return;
126
+ const { rowOffsets, colIndices } = this.csr;
127
+ const start = rowOffsets[srcIdx] ?? 0;
128
+ const end = rowOffsets[srcIdx + 1] ?? 0;
129
+ for (let i = start; i < end; i++) {
130
+ const dstIdx = colIndices[i];
131
+ if (dstIdx !== void 0) {
132
+ const nodeId = this.indexMap.indexToNode[dstIdx];
133
+ if (nodeId !== void 0) yield nodeId;
134
+ }
135
+ }
136
+ }
137
+ degree(id, _direction) {
138
+ const idx = this.indexMap.nodeToIndex.get(id);
139
+ if (idx === void 0) return 0;
140
+ const { rowOffsets } = this.csr;
141
+ return (rowOffsets[idx + 1] ?? 0) - (rowOffsets[idx] ?? 0);
142
+ }
143
+ getEdge(_source, _target) {}
144
+ *edges() {}
145
+ };
146
+ //#endregion
147
+ //#region src/gpu/root.ts
148
+ /**
149
+ * TypeGPU root initialisation for graphwise GPU operations.
150
+ *
151
+ * Provides a simplified wrapper around TypeGPU's tgpu.init() for
152
+ * GPU device acquisition and resource management.
153
+ *
154
+ * @module gpu/root
155
+ */
156
+ /**
157
+ * Initialise a TypeGPU root for GPU compute operations.
158
+ *
159
+ * This wraps tgpu.init() with WebGPU availability checking and
160
+ * simplified options.
161
+ *
162
+ * @param options - Initialisation options
163
+ * @returns Promise resolving to a TypeGPU root instance
164
+ * @throws Error if WebGPU is unavailable or device request fails
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * import { initGPU } from "graphwise/gpu";
169
+ *
170
+ * const root = await initGPU();
171
+ * // Use root for GPU operations...
172
+ * root.destroy();
173
+ * ```
174
+ */
175
+ async function initGPU(options = {}) {
176
+ const detection = detectWebGPU();
177
+ if (!detection.available) throw new Error(`WebGPU unavailable: ${detection.reason ?? "unknown reason"}`);
178
+ return await tgpu_exports.init({ adapter: options.powerPreference ? { powerPreference: options.powerPreference } : void 0 });
179
+ }
180
+ /**
181
+ * Create a TypeGPU root from an existing GPU device.
182
+ *
183
+ * Use this when you already have a GPUDevice and want to wrap it
184
+ * with TypeGPU functionality.
185
+ *
186
+ * @param device - Existing GPU device
187
+ * @returns TypeGPU root instance
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * import { initGPUFromDevice } from "graphwise/gpu";
192
+ *
193
+ * const adapter = await navigator.gpu.requestAdapter();
194
+ * const device = await adapter.requestDevice();
195
+ * const root = initGPUFromDevice(device);
196
+ * ```
197
+ */
198
+ function initGPUFromDevice(device) {
199
+ return tgpu_exports.initFromDevice({ device });
200
+ }
201
+ //#endregion
202
+ export { CSRReadableGraph, GPUNotAvailableError, assertWebGPUAvailable, csrToTypedBuffers, detectWebGPU, gpuBfsLevels, gpuDegreeHistogram, gpuJaccardBatch, gpuKMeansAssign, gpuMIBatch, gpuPageRank, gpuSpmv, graphToCSR, initGPU, initGPUFromDevice, isWebGPUAvailable, withBackend };
203
+
204
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/gpu/csr-graph.ts","../../src/gpu/root.ts"],"sourcesContent":["/**\n * CSR-backed read-only graph implementation.\n *\n * Provides a cache-friendly ReadableGraph backed by Compressed Sparse Row\n * arrays. Neighbourhood lookups are O(1) slices; perfect for algorithms\n * that make many repeated queries on large static graphs.\n *\n * Node and edge data are not stored (CSR is topology-only), so `getNode`\n * and `getEdge` always return undefined. For data-aware algorithms, wrap\n * in a composite that delegates data lookups to a separate store.\n */\n\nimport type { NodeId, Direction, NodeData, EdgeData } from \"../graph/types\";\nimport type { ReadableGraph } from \"../graph\";\nimport type { CSRGraph, CSRIndexMap, CSRMatrix } from \"./csr\";\n\n/**\n * A ReadableGraph implementation backed by CSR arrays.\n *\n * All neighbourhood and degree queries use CSR row slices (O(1) slice + O(k) iteration\n * where k is neighbourhood size). This is significantly faster than hash map lookups\n * on large graphs, especially when the same nodes are queried multiple times.\n *\n * @typeParam N - Node data type (not stored; always returns undefined from getNode)\n * @typeParam E - Edge data type (not stored; always returns undefined from getEdge)\n */\nexport class CSRReadableGraph<\n\tN extends NodeData = NodeData,\n\tE extends EdgeData = EdgeData,\n> implements ReadableGraph<N, E> {\n\tprivate readonly csr: CSRMatrix;\n\tprivate readonly indexMap: CSRIndexMap;\n\tprivate readonly isDirected: boolean;\n\n\t/**\n\t * Create a CSR-backed graph from CSR structures.\n\t *\n\t * @param csr - CSR matrix (rowOffsets, colIndices)\n\t * @param indexMap - Node ID ↔ CSR index mapping\n\t * @param directed - Whether the graph is directed\n\t */\n\tprivate constructor(\n\t\tcsr: CSRMatrix,\n\t\tindexMap: CSRIndexMap,\n\t\tdirected: boolean,\n\t) {\n\t\tthis.csr = csr;\n\t\tthis.indexMap = indexMap;\n\t\tthis.isDirected = directed;\n\t}\n\n\t/**\n\t * Create a CSR-backed graph from any ReadableGraph.\n\t *\n\t * Converts the graph to CSR format (O(V + E) time) and returns a\n\t * CSRReadableGraph wrapping the result.\n\t *\n\t * @param graph - Graph to convert\n\t * @param direction - Edge direction for CSR (default: 'out' for directed, 'both' for undirected)\n\t * @returns CSRReadableGraph with identical topology\n\t *\n\t * @example\n\t * ```typescript\n\t * const original = AdjacencyMapGraph.undirected();\n\t * // ... add nodes and edges ...\n\t *\n\t * const csr = CSRReadableGraph.from(original);\n\t *\n\t * // All operations on csr are identical to original but faster\n\t * assert.deepEqual(\n\t * [...csr.neighbours('A')],\n\t * [...original.neighbours('A')]\n\t * );\n\t * ```\n\t */\n\tstatic from<N extends NodeData, E extends EdgeData>(\n\t\tgraph: ReadableGraph<N, E>,\n\t\tdirection: Direction = graph.directed ? \"out\" : \"both\",\n\t): CSRReadableGraph<N, E> {\n\t\tconst nodeToIndex = new Map<NodeId, number>();\n\t\tconst indexToNode: NodeId[] = [];\n\n\t\tfor (const nodeId of graph.nodeIds()) {\n\t\t\tconst index = indexToNode.length;\n\t\t\tnodeToIndex.set(nodeId, index);\n\t\t\tindexToNode.push(nodeId);\n\t\t}\n\n\t\tconst nodeCount = indexToNode.length;\n\n\t\t// Count edges per node\n\t\tconst degrees = new Uint32Array(nodeCount);\n\t\tfor (const nodeId of graph.nodeIds()) {\n\t\t\tconst srcIndex = nodeToIndex.get(nodeId);\n\t\t\tif (srcIndex === undefined) continue;\n\t\t\tdegrees[srcIndex] = graph.degree(nodeId, direction);\n\t\t}\n\n\t\t// Build rowOffsets\n\t\tconst rowOffsets = new Uint32Array(nodeCount + 1);\n\t\tfor (let i = 0; i < nodeCount; i++) {\n\t\t\trowOffsets[i + 1] = (rowOffsets[i] ?? 0) + (degrees[i] ?? 0);\n\t\t}\n\n\t\tconst totalEdges = rowOffsets[nodeCount] ?? 0;\n\n\t\t// Build colIndices\n\t\tconst colIndices = new Uint32Array(totalEdges);\n\n\t\tfor (const nodeId of graph.nodeIds()) {\n\t\t\tconst srcIndex = nodeToIndex.get(nodeId);\n\t\t\tif (srcIndex === undefined) continue;\n\n\t\t\tconst baseOffset = rowOffsets[srcIndex] ?? 0;\n\t\t\tlet localOffset = 0;\n\n\t\t\tfor (const neighbourId of graph.neighbours(nodeId, direction)) {\n\t\t\t\tconst dstIndex = nodeToIndex.get(neighbourId);\n\t\t\t\tif (dstIndex === undefined) continue;\n\n\t\t\t\tcolIndices[baseOffset + localOffset] = dstIndex;\n\t\t\t\tlocalOffset++;\n\t\t\t}\n\t\t}\n\n\t\tconst csr: CSRMatrix = {\n\t\t\trowOffsets,\n\t\t\tcolIndices,\n\t\t\tnodeCount,\n\t\t\tedgeCount: graph.directed ? graph.edgeCount : graph.edgeCount * 2,\n\t\t};\n\n\t\tconst indexMap: CSRIndexMap = {\n\t\t\tnodeToIndex,\n\t\t\tindexToNode,\n\t\t};\n\n\t\treturn new CSRReadableGraph(csr, indexMap, graph.directed);\n\t}\n\n\t/**\n\t * Access the underlying CSR matrix and index map.\n\t *\n\t * Useful for GPU operations that need direct CSR data.\n\t */\n\tget data(): CSRGraph {\n\t\treturn {\n\t\t\tcsr: this.csr,\n\t\t\tindexMap: this.indexMap,\n\t\t};\n\t}\n\n\tget directed(): boolean {\n\t\treturn this.isDirected;\n\t}\n\n\tget nodeCount(): number {\n\t\treturn this.csr.nodeCount;\n\t}\n\n\tget edgeCount(): number {\n\t\treturn this.csr.edgeCount;\n\t}\n\n\thasNode(id: NodeId): boolean {\n\t\treturn this.indexMap.nodeToIndex.has(id);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tgetNode(_id: NodeId): undefined {\n\t\t// CSR stores topology only, no node data\n\t\treturn undefined;\n\t}\n\n\t*nodeIds(): Iterable<NodeId> {\n\t\tfor (const nodeId of this.indexMap.indexToNode) {\n\t\t\tyield nodeId;\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t*neighbours(id: NodeId, _direction?: Direction): Iterable<NodeId> {\n\t\tconst srcIdx = this.indexMap.nodeToIndex.get(id);\n\t\tif (srcIdx === undefined) return;\n\n\t\tconst { rowOffsets, colIndices } = this.csr;\n\t\tconst start = rowOffsets[srcIdx] ?? 0;\n\t\tconst end = rowOffsets[srcIdx + 1] ?? 0;\n\n\t\t// For CSR backed by 'both' direction in undirected graphs, all entries\n\t\t// are already bidirectional. Otherwise respect the direction parameter.\n\t\t// (CSR format was built with the specified direction, so we just iterate.)\n\n\t\tfor (let i = start; i < end; i++) {\n\t\t\tconst dstIdx = colIndices[i];\n\t\t\tif (dstIdx !== undefined) {\n\t\t\t\tconst nodeId = this.indexMap.indexToNode[dstIdx];\n\t\t\t\tif (nodeId !== undefined) {\n\t\t\t\t\tyield nodeId;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tdegree(id: NodeId, _direction?: Direction): number {\n\t\tconst idx = this.indexMap.nodeToIndex.get(id);\n\t\tif (idx === undefined) return 0;\n\n\t\tconst { rowOffsets } = this.csr;\n\t\treturn (rowOffsets[idx + 1] ?? 0) - (rowOffsets[idx] ?? 0);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tgetEdge(_source: NodeId, _target: NodeId): undefined {\n\t\t// CSR stores topology only, no edge data\n\t\treturn undefined;\n\t}\n\n\t*edges(): Iterable<E> {\n\t\t// No edges can be returned because we have no edge data\n\t}\n}\n","/**\n * TypeGPU root initialisation for graphwise GPU operations.\n *\n * Provides a simplified wrapper around TypeGPU's tgpu.init() for\n * GPU device acquisition and resource management.\n *\n * @module gpu/root\n */\n\nimport { tgpu } from \"typegpu\";\nimport { detectWebGPU } from \"./detect\";\n\n/**\n * Options for initialising the GPU root.\n */\nexport interface InitGPUOptions {\n\t/** Power preference for GPU adapter */\n\treadonly powerPreference?: \"low-power\" | \"high-performance\";\n}\n\n/**\n * The TypeGPU root instance used for GPU operations.\n * Re-exports TgpuRoot from TypeGPU for convenience.\n */\nexport type GraphwiseGPURoot = Awaited<ReturnType<typeof tgpu.init>>;\n\n/**\n * Initialise a TypeGPU root for GPU compute operations.\n *\n * This wraps tgpu.init() with WebGPU availability checking and\n * simplified options.\n *\n * @param options - Initialisation options\n * @returns Promise resolving to a TypeGPU root instance\n * @throws Error if WebGPU is unavailable or device request fails\n *\n * @example\n * ```typescript\n * import { initGPU } from \"graphwise/gpu\";\n *\n * const root = await initGPU();\n * // Use root for GPU operations...\n * root.destroy();\n * ```\n */\nexport async function initGPU(\n\toptions: InitGPUOptions = {},\n): Promise<GraphwiseGPURoot> {\n\tconst detection = detectWebGPU();\n\tif (!detection.available) {\n\t\tthrow new Error(\n\t\t\t`WebGPU unavailable: ${detection.reason ?? \"unknown reason\"}`,\n\t\t);\n\t}\n\n\tconst root = await tgpu.init({\n\t\tadapter: options.powerPreference\n\t\t\t? { powerPreference: options.powerPreference }\n\t\t\t: undefined,\n\t});\n\n\treturn root;\n}\n\n/**\n * Create a TypeGPU root from an existing GPU device.\n *\n * Use this when you already have a GPUDevice and want to wrap it\n * with TypeGPU functionality.\n *\n * @param device - Existing GPU device\n * @returns TypeGPU root instance\n *\n * @example\n * ```typescript\n * import { initGPUFromDevice } from \"graphwise/gpu\";\n *\n * const adapter = await navigator.gpu.requestAdapter();\n * const device = await adapter.requestDevice();\n * const root = initGPUFromDevice(device);\n * ```\n */\nexport function initGPUFromDevice(device: GPUDevice): GraphwiseGPURoot {\n\treturn tgpu.initFromDevice({ device });\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,IAAa,mBAAb,MAAa,iBAGoB;CAChC;CACA;CACA;;;;;;;;CASA,YACC,KACA,UACA,UACC;AACD,OAAK,MAAM;AACX,OAAK,WAAW;AAChB,OAAK,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BnB,OAAO,KACN,OACA,YAAuB,MAAM,WAAW,QAAQ,Q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}
@@ -0,0 +1,39 @@
1
+ import { d, StorageFlag, TgpuBuffer } from 'typegpu';
2
+ import { TypedBufferGroup } from '../../csr';
3
+ import { GraphwiseGPURoot } from '../../root';
4
+ declare const AdamicLayout: import('typegpu').TgpuBindGroupLayout<{
5
+ rowOffsets: {
6
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
7
+ };
8
+ colIndices: {
9
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
10
+ };
11
+ pairsU: {
12
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
13
+ };
14
+ pairsV: {
15
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
16
+ };
17
+ intersections: {
18
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
19
+ access: "mutable";
20
+ };
21
+ sizeUs: {
22
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
23
+ access: "mutable";
24
+ };
25
+ sizeVs: {
26
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
27
+ access: "mutable";
28
+ };
29
+ results: {
30
+ storage: (elementCount: number) => d.WgslArray<d.F32>;
31
+ access: "mutable";
32
+ };
33
+ pairCount: {
34
+ uniform: d.U32;
35
+ };
36
+ }>;
37
+ export declare function dispatchAdamicAdar(root: GraphwiseGPURoot, csrBuffers: TypedBufferGroup, pairsU: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.u32>>> & StorageFlag, pairsV: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.u32>>> & StorageFlag, results: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.f32>>> & StorageFlag, intersections: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.u32>>> & StorageFlag, sizeUs: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.u32>>> & StorageFlag, sizeVs: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.u32>>> & StorageFlag, pairCount: number): void;
38
+ export { AdamicLayout };
39
+ //# sourceMappingURL=kernel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":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MAAM,GACf,IAAI,CAeN;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { d, StorageFlag, TgpuBuffer } from 'typegpu';
2
+ import { TypedBufferGroup } from '../../csr';
3
+ import { GraphwiseGPURoot } from '../../root';
4
+ /**
5
+ * Bind group layout for Intersection kernel.
6
+ */
7
+ declare const IntersectionLayout: import('typegpu').TgpuBindGroupLayout<{
8
+ rowOffsets: {
9
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
10
+ };
11
+ colIndices: {
12
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
13
+ };
14
+ pairsU: {
15
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
16
+ };
17
+ pairsV: {
18
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
19
+ };
20
+ intersections: {
21
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
22
+ access: "mutable";
23
+ };
24
+ sizeUs: {
25
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
26
+ access: "mutable";
27
+ };
28
+ sizeVs: {
29
+ storage: (elementCount: number) => d.WgslArray<d.U32>;
30
+ access: "mutable";
31
+ };
32
+ pairCount: {
33
+ uniform: d.U32;
34
+ };
35
+ }>;
36
+ /**
37
+ * Dispatch batch intersection on GPU.
38
+ *
39
+ * @param root - TypeGPU root instance
40
+ * @param csrBuffers - CSR matrix as typed buffers
41
+ * @param pairsU - First node of each pair (u32 array)
42
+ * @param pairsV - Second node of each pair (u32 array)
43
+ * @param intersections - Output intersections (u32 array, mutable)
44
+ * @param sizeUs - Output sizeU per pair (u32 array, mutable)
45
+ * @param sizeVs - Output sizeV per pair (u32 array, mutable)
46
+ * @param pairCount - Number of pairs to compute
47
+ */
48
+ export declare function dispatchIntersection(root: GraphwiseGPURoot, csrBuffers: TypedBufferGroup, pairsU: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.u32>>> & StorageFlag, pairsV: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.u32>>> & StorageFlag, intersections: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.u32>>> & StorageFlag, sizeUs: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.u32>>> & StorageFlag, sizeVs: TgpuBuffer<ReturnType<typeof d.arrayOf<typeof d.u32>>> & StorageFlag, pairCount: number): void;
49
+ export { IntersectionLayout };
50
+ //# sourceMappingURL=kernel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../../src/gpu/kernels/intersection/kernel.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAa,EAAE,CAAC,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;GAEG;AACH,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAStB,CAAC;AAgFH;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,gBAAgB,EAC5B,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,EAC5E,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,EAC5E,aAAa,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACpE,WAAW,EACZ,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAA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