@graphty/graphty-element 2.0.1 → 2.2.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 (76) hide show
  1. package/README.md +3 -3
  2. package/dist/ai.js +4 -4
  3. package/dist/catalog.js +5 -5
  4. package/dist/chunks/{AiManager-awS0MNr1.js → AiManager-DWwQiBQu.js} +5 -5
  5. package/dist/chunks/{Algorithm-BdcqHKps.js → Algorithm-RQ629NLb.js} +210 -92
  6. package/dist/chunks/{DataSource-DK4GZBKg.js → DataSource-DEg3igzS.js} +3 -3
  7. package/dist/chunks/{GraphSession-D87eymV8.js → GraphSession-CtqyVNsw.js} +2518 -2239
  8. package/dist/chunks/{GraphtyError-B3eKs4yg.js → GraphtyError-BwcnblTH.js} +10 -8
  9. package/dist/chunks/{GraphtyLogger-CK03SnJi.js → GraphtyLogger-5KEttFUo.js} +1 -1
  10. package/dist/chunks/{NodeStyle-CS7dj20m.js → NodeStyle-Cup9O1lu.js} +2 -1
  11. package/dist/chunks/{VoiceInputAdapter-CcnCmxo5.js → VoiceInputAdapter-mD0x3z7t.js} +1 -1
  12. package/dist/chunks/{XRPivotCameraController-UjMsbran.js → XRPivotCameraController-Clil9NhV.js} +2 -2
  13. package/dist/chunks/{cameras-BeIAlMWR.js → cameras-DFXNYBze.js} +2 -2
  14. package/dist/chunks/{capability-check-DcKFwS6q.js → capability-check-dXwQ_z5B.js} +1 -1
  15. package/dist/chunks/{detect-B-YbbP7i.js → detect-CqN0mC6u.js} +3 -3
  16. package/dist/chunks/{format-detection-DohSEZnb.js → format-detection-C8vbCSlS.js} +1 -1
  17. package/dist/chunks/{index-uohvGegX.js → index-2VIpMJZP.js} +1576 -1211
  18. package/dist/chunks/{paletteRegistry-B-oS4YxP.js → paletteRegistry-NrWOKT-A.js} +17 -17
  19. package/dist/chunks/{registry-DU-e49Y2.js → registry-CSba5QGJ.js} +1 -1
  20. package/dist/chunks/{scales-DvGid5Ln.js → scales-BUS7NWy2.js} +2206 -1357
  21. package/dist/custom-elements.json +1 -1
  22. package/dist/extend.js +26 -27
  23. package/dist/graphty-catalog.json +7 -4
  24. package/dist/graphty.bundle.js +36288 -34368
  25. package/dist/graphty.js +66 -64
  26. package/dist/index.d.ts +1 -1
  27. package/dist/logging.js +2 -2
  28. package/dist/schema.js +1 -1
  29. package/dist/session.d.ts +2 -1
  30. package/dist/session.js +37 -33
  31. package/dist/src/Edge.d.ts +1 -1
  32. package/dist/src/Graph.d.ts +41 -7
  33. package/dist/src/Node.d.ts +1 -1
  34. package/dist/src/acceleration/AccelerationController.d.ts +27 -0
  35. package/dist/src/acceleration/index.d.ts +1 -1
  36. package/dist/src/acceleration/narrow.d.ts +56 -0
  37. package/dist/src/acceleration/types.d.ts +88 -7
  38. package/dist/src/algorithms/Algorithm.d.ts +96 -2
  39. package/dist/src/algorithms/BFSAlgorithm.d.ts +9 -0
  40. package/dist/src/algorithms/DijkstraAlgorithm.d.ts +2 -8
  41. package/dist/src/algorithms/PageRankAlgorithm.d.ts +8 -0
  42. package/dist/src/algorithms/utils/graphUtils.d.ts +13 -0
  43. package/dist/src/cameras/OrbitCameraController.d.ts +1 -0
  44. package/dist/src/catalog/layouts.d.ts +13 -1
  45. package/dist/src/config/GraphBehavior.d.ts +13 -0
  46. package/dist/src/config/GraphStyle.d.ts +1 -1
  47. package/dist/src/config/StyleTemplate.d.ts +4 -0
  48. package/dist/src/data/CSVDataSource.d.ts +1 -0
  49. package/dist/src/data/csv-variant-detection.d.ts +11 -0
  50. package/dist/src/errors/codes.d.ts +14 -1
  51. package/dist/src/events.d.ts +17 -4
  52. package/dist/src/graphty-element.d.ts +48 -3
  53. package/dist/src/layout/ForceAtlas2LayoutEngine.d.ts +28 -45
  54. package/dist/src/layout/LayoutEngine.d.ts +7 -7
  55. package/dist/src/layout/SimulationLayoutEngine.d.ts +458 -0
  56. package/dist/src/layout/SpringElectricalLayoutEngine.d.ts +32 -0
  57. package/dist/src/layout/SpringLayoutEngine.d.ts +22 -32
  58. package/dist/src/managers/EventManager.d.ts +7 -0
  59. package/dist/src/managers/GraphContext.d.ts +6 -0
  60. package/dist/src/managers/LayoutManager.d.ts +98 -4
  61. package/dist/src/managers/RenderManager.d.ts +7 -0
  62. package/dist/src/managers/UpdateManager.d.ts +1 -1
  63. package/dist/src/session/catalog.d.ts +2 -2
  64. package/dist/src/session/query.d.ts +83 -0
  65. package/dist/src/session/runs/types.d.ts +10 -4
  66. package/dist/src/session/selection/targets.d.ts +20 -3
  67. package/dist/src/session/styles/StylesApi.d.ts +18 -0
  68. package/dist/src/session/styles/legend.d.ts +9 -0
  69. package/dist/src/session/styles/predicate.d.ts +11 -0
  70. package/dist/src/session/styles/sources.d.ts +16 -0
  71. package/dist/src/session/types.d.ts +38 -2
  72. package/dist/src/testing/fakeAccelerator.d.ts +323 -0
  73. package/dist/webgpu.d.ts +23 -1
  74. package/dist/webgpu.js +70 -32
  75. package/package.json +10 -8
  76. package/dist/chunks/types-Dwm9waL2.js +0 -7
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @graphty/graphty-element
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@graphty/graphty-element.svg)](https://www.npmjs.com/package/@graphty/graphty-element)
4
- [![CI/CD](https://github.com/graphty-org/graphty-element/actions/workflows/ci.yml/badge.svg)](https://github.com/graphty-org/graphty-element/actions/workflows/ci.yml)
4
+ [![CI/CD](https://github.com/graphty-org/graphty-monorepo/actions/workflows/ci.yml/badge.svg)](https://github.com/graphty-org/graphty-monorepo/actions/workflows/ci.yml)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/graphty-org/graphty-element/badge.svg?branch=master)](https://coveralls.io/github/graphty-org/graphty-element?branch=master)
6
6
  [![Documentation](https://img.shields.io/badge/docs-vitepress-blue)](https://graphty.app/docs/graphty-element/)
7
- [![Storybook](https://img.shields.io/badge/storybook-examples-ff4785)](https://graphty.app/storybook/element/)
7
+ [![Storybook](https://img.shields.io/badge/storybook-examples-ff4785)](https://graphty.app/storybook/graphty-element/)
8
8
 
9
9
  A Web Component for 3D/2D graph visualization built with Lit and Babylon.js.
10
10
 
@@ -52,7 +52,7 @@ npm install @graphty/graphty-element @babylonjs/core lit
52
52
  - [Getting Started Guide](https://graphty.app/docs/graphty-element/guide/getting-started)
53
53
  - [Installation](https://graphty.app/docs/graphty-element/guide/installation)
54
54
  - [API Reference](https://graphty.app/docs/graphty-element/api/)
55
- - [Interactive Examples (Storybook)](https://graphty.app/storybook/element/)
55
+ - [Interactive Examples (Storybook)](https://graphty.app/storybook/graphty-element/)
56
56
 
57
57
  ## Features
58
58
 
package/dist/ai.js CHANGED
@@ -1,9 +1,9 @@
1
- import { f as p } from "./chunks/AiManager-awS0MNr1.js";
2
- import { A as L, a as M, b as D, C as V, M as j, S as E, c as z, V as N, d as q, e as W, g as G, h as T, i as F, j as U, k as _, l as B, m as J, q as O, s as Y, n as H, o as Q, p as K, r as X, z as Z } from "./chunks/AiManager-awS0MNr1.js";
1
+ import { f as p } from "./chunks/AiManager-DWwQiBQu.js";
2
+ import { A as L, a as M, b as D, C as V, M as j, S as E, c as z, V as N, d as q, e as W, g as G, h as T, i as F, j as U, k as _, l as B, m as J, q as O, s as Y, n as H, o as Q, p as K, r as X, z as Z } from "./chunks/AiManager-DWwQiBQu.js";
3
3
  import { A as te } from "./chunks/ApiKeyManager-C0ac91dE.js";
4
- import { V as se } from "./chunks/VoiceInputAdapter-CcnCmxo5.js";
4
+ import { V as se } from "./chunks/VoiceInputAdapter-mD0x3z7t.js";
5
5
  import { z as r } from "zod";
6
- import { A as u } from "./chunks/Algorithm-BdcqHKps.js";
6
+ import { A as u } from "./chunks/Algorithm-RQ629NLb.js";
7
7
  const m = r.object({
8
8
  namespace: r.string().describe("The namespace of the algorithm (e.g., 'graphty')"),
9
9
  type: r.string().describe("The type of algorithm to run (e.g., 'degree', 'pagerank')")
package/dist/catalog.js CHANGED
@@ -1,8 +1,8 @@
1
- import { B as y, L as f, a as m, P as T, S, U as v, b as O, c as E, l as A, d as N, e as I, p as R, f as k, s as x, g as _ } from "./chunks/scales-DvGid5Ln.js";
2
- import { C, a as L, b as P, c as W, d as U, e as F, f as B } from "./chunks/cameras-BeIAlMWR.js";
3
- import { d as M, a as K } from "./chunks/detect-B-YbbP7i.js";
4
- import { F as Y, U as G, t as z, u as V, o as q } from "./chunks/paletteRegistry-B-oS4YxP.js";
5
- import { L as Z, l as $ } from "./chunks/GraphtyLogger-CK03SnJi.js";
1
+ import { B as y, L as f, a as m, P as T, S, U as v, b as O, c as E, l as A, d as N, e as I, p as R, f as k, s as x, g as _ } from "./chunks/scales-BUS7NWy2.js";
2
+ import { C, a as L, b as P, c as W, d as U, e as F, f as B } from "./chunks/cameras-DFXNYBze.js";
3
+ import { d as M, a as K } from "./chunks/detect-CqN0mC6u.js";
4
+ import { F as Y, U as G, t as z, u as V, o as q } from "./chunks/paletteRegistry-NrWOKT-A.js";
5
+ import { L as Z, l as $ } from "./chunks/GraphtyLogger-5KEttFUo.js";
6
6
  import { A as Q, C as ee, f as te, K as ae, a as oe, b as ne, c as re, d as ie, g as se, O as he, R as le, h as de, j as ce, k as we, i as ue, e as pe } from "./chunks/types-B7bX5c0K.js";
7
7
  const d = Object.keys({
8
8
  enabled: 0,
@@ -1,11 +1,11 @@
1
- import { l as _ } from "./VoiceInputAdapter-CcnCmxo5.js";
2
- import { G as K } from "./GraphtyLogger-CK03SnJi.js";
1
+ import { l as _ } from "./VoiceInputAdapter-mD0x3z7t.js";
2
+ import { G as K } from "./GraphtyLogger-5KEttFUo.js";
3
3
  import W from "jmespath";
4
4
  import { z as m } from "zod";
5
- import { e as G } from "./Algorithm-BdcqHKps.js";
6
- import { N as H, c as B, C as X } from "./cameras-BeIAlMWR.js";
5
+ import { e as G } from "./Algorithm-RQ629NLb.js";
6
+ import { N as H, c as B, C as X } from "./cameras-DFXNYBze.js";
7
7
  import { inferSchema as C } from "@jsonhero/schema-infer";
8
- import { i as Z } from "./GraphtyError-B3eKs4yg.js";
8
+ import { i as Z } from "./GraphtyError-BwcnblTH.js";
9
9
  import { createAnthropic as Y } from "@ai-sdk/anthropic";
10
10
  import { createGoogleGenerativeAI as J } from "@ai-sdk/google";
11
11
  import { createOpenAI as Q } from "@ai-sdk/openai";
@@ -1,15 +1,16 @@
1
- import { q as f } from "./GraphtyLogger-CK03SnJi.js";
2
- import { K as O, f as $ } from "./types-B7bX5c0K.js";
3
- import { G as d } from "./GraphtyError-B3eKs4yg.js";
4
- import { Graph as S } from "@graphty/algorithms";
5
- const m = f({
1
+ import { q as C } from "./GraphtyLogger-5KEttFUo.js";
2
+ import { K as $, f as N } from "./types-B7bX5c0K.js";
3
+ import { G as d } from "./GraphtyError-BwcnblTH.js";
4
+ import { Graph as _, accelerated as y } from "@graphty/algorithms";
5
+ import { INVALID_INDEX as w } from "@graphty/graph-format";
6
+ const p = C({
6
7
  kind: "camera",
7
8
  idOf: (e) => e.descriptor.id,
8
9
  descriptorOf: (e) => e.descriptor,
9
10
  implementationOf: (e) => e.compute,
10
- builtInIds: () => O
11
+ builtInIds: () => $
11
12
  });
12
- function R(e, t) {
13
+ function K(e, t) {
13
14
  const s = e.descriptor;
14
15
  if (s === void 0 || typeof s != "object")
15
16
  throw new d({
@@ -39,25 +40,57 @@ function R(e, t) {
39
40
  source: "registry",
40
41
  details: { kind: "camera", name: String(s.id), field: "compute" }
41
42
  });
42
- m.register(e, t);
43
+ p.register(e, t);
44
+ }
45
+ function z() {
46
+ return p.descriptors();
47
+ }
48
+ function W(e) {
49
+ return p.byId(e);
50
+ }
51
+ function Y() {
52
+ p.clearForTesting();
43
53
  }
44
- function T() {
45
- return m.descriptors();
54
+ const I = ["forceAtlas2", "fruchtermanReingold", "springElectrical", "release"], k = [
55
+ "pageRank",
56
+ "sssp",
57
+ "breadthFirstSearch",
58
+ "connectedComponents",
59
+ "weaklyConnectedComponents",
60
+ "minimumSpanningTree"
61
+ ];
62
+ function H(e) {
63
+ const t = {
64
+ kind: e.backend
65
+ };
66
+ for (const s of I) {
67
+ const r = e[s];
68
+ typeof r == "function" && (t[s] = r.bind(e));
69
+ }
70
+ return t;
46
71
  }
47
- function V(e) {
48
- return m.byId(e);
72
+ function R(e) {
73
+ const t = {
74
+ kind: e.backend
75
+ };
76
+ for (const s of k) {
77
+ const r = e[s];
78
+ typeof r == "function" && (t[s] = r.bind(e));
79
+ }
80
+ return t;
49
81
  }
50
- function j() {
51
- m.clearForTesting();
82
+ const D = ["auto", "off", "required"], Z = "auto";
83
+ function X(e) {
84
+ return typeof e == "string" && D.includes(e);
52
85
  }
53
- const p = f({
86
+ const M = "f64", J = "f32", Q = "acceleration.minNodes", ee = 0, g = C({
54
87
  kind: "algorithm",
55
88
  idOf: (e) => e.descriptor.key,
56
89
  descriptorOf: (e) => e.descriptor,
57
90
  implementationOf: (e) => e.descriptor,
58
- builtInIds: () => $
91
+ builtInIds: () => N
59
92
  });
60
- function A(e, t) {
93
+ function T(e, t) {
61
94
  if (e.descriptor.key !== e.type)
62
95
  throw new d({
63
96
  code: "E_BAD_COMMAND",
@@ -71,18 +104,18 @@ function A(e, t) {
71
104
  namespace: e.namespace
72
105
  }
73
106
  });
74
- p.register(e, t);
107
+ g.register(e, t);
75
108
  }
76
- function x() {
77
- return p.descriptors();
109
+ function te() {
110
+ return g.descriptors();
78
111
  }
79
- function B(e) {
80
- return p.byId(e);
112
+ function se(e) {
113
+ return g.byId(e);
81
114
  }
82
- function G() {
83
- p.clearForTesting();
115
+ function re() {
116
+ g.clearForTesting();
84
117
  }
85
- class o extends Error {
118
+ class a extends Error {
86
119
  /**
87
120
  * Creates an option validation error
88
121
  * @param optionKey - The key of the option that failed validation
@@ -92,93 +125,106 @@ class o extends Error {
92
125
  super(`Option '${t}': ${s}`), this.optionKey = t, this.name = "OptionValidationError";
93
126
  }
94
127
  }
95
- function k(e, t, s) {
128
+ function v(e, t, s) {
96
129
  if (t == null) {
97
130
  if (s.required)
98
- throw new o(e, "is required but was not provided");
131
+ throw new a(e, "is required but was not provided");
99
132
  return;
100
133
  }
101
134
  switch (s.type) {
102
135
  case "number":
103
- u(e, t, s, !1);
136
+ A(e, t, s, !1);
104
137
  break;
105
138
  case "integer":
106
- u(e, t, s, !0);
139
+ A(e, t, s, !0);
107
140
  break;
108
141
  case "boolean":
109
142
  if (typeof t != "boolean")
110
- throw new o(e, `must be a boolean, got ${typeof t}`);
143
+ throw new a(e, `must be a boolean, got ${typeof t}`);
111
144
  break;
112
145
  case "string":
113
146
  if (typeof t != "string")
114
- throw new o(e, `must be a string, got ${typeof t}`);
147
+ throw new a(e, `must be a string, got ${typeof t}`);
115
148
  break;
116
149
  case "select":
117
- N(e, t, s);
150
+ L(e, t, s);
118
151
  break;
119
152
  case "nodeId":
120
153
  if (typeof t != "string" && typeof t != "number")
121
- throw new o(e, `must be a string or number (node ID), got ${typeof t}`);
154
+ throw new a(e, `must be a string or number (node ID), got ${typeof t}`);
122
155
  break;
123
156
  default:
124
- throw new o(e, `has unknown type '${s.type}'`);
157
+ throw new a(e, `has unknown type '${s.type}'`);
125
158
  }
126
159
  }
127
- function u(e, t, s, r) {
160
+ function A(e, t, s, r) {
128
161
  if (typeof t != "number")
129
- throw new o(e, `must be a number, got ${typeof t}`);
162
+ throw new a(e, `must be a number, got ${typeof t}`);
130
163
  if (Number.isNaN(t))
131
- throw new o(e, "must not be NaN");
164
+ throw new a(e, "must not be NaN");
132
165
  if (!Number.isFinite(t))
133
- throw new o(e, "must be finite");
166
+ throw new a(e, "must be finite");
134
167
  if (r && !Number.isInteger(t))
135
- throw new o(e, `must be an integer, got ${t}`);
168
+ throw new a(e, `must be an integer, got ${t}`);
136
169
  if (s.min !== void 0 && t < s.min)
137
- throw new o(e, `must be >= ${s.min}, got ${t}`);
170
+ throw new a(e, `must be >= ${s.min}, got ${t}`);
138
171
  if (s.max !== void 0 && t > s.max)
139
- throw new o(e, `must be <= ${s.max}, got ${t}`);
172
+ throw new a(e, `must be <= ${s.max}, got ${t}`);
140
173
  }
141
- function N(e, t, s) {
174
+ function L(e, t, s) {
142
175
  if (!s.options || s.options.length === 0)
143
- throw new o(e, "is a select type but has no options defined");
144
- if (!s.options.map((i) => i.value).includes(t)) {
145
- const i = s.options.map((a) => `'${String(a.value)}'`).join(", ");
146
- throw new o(e, `must be one of [${i}], got '${String(t)}'`);
176
+ throw new a(e, "is a select type but has no options defined");
177
+ if (!s.options.map((n) => n.value).includes(t)) {
178
+ const n = s.options.map((i) => `'${String(i.value)}'`).join(", ");
179
+ throw new a(e, `must be one of [${n}], got '${String(t)}'`);
147
180
  }
148
181
  }
149
- function C(e, t) {
182
+ function P(e, t) {
150
183
  const s = {};
151
- for (const [r, i] of Object.entries(e)) {
152
- const c = t?.[r] ?? i.default;
153
- k(r, c, i), s[r] = c;
184
+ for (const [r, n] of Object.entries(e)) {
185
+ const c = t?.[r] ?? n.default;
186
+ v(r, c, n), s[r] = c;
154
187
  }
155
188
  return s;
156
189
  }
157
- function F(e) {
190
+ function ne(e) {
158
191
  return e;
159
192
  }
160
- function D(e, t) {
161
- const s = e.getSnapshot(), r = t === "directed" ? s : e.undirected(s).snapshot, i = r.flags.multigraph ? r.simplified({ weights: "sum" }).snapshot : r;
162
- return _(i, t);
193
+ function x(e, t) {
194
+ const s = e.getSnapshot(), r = t === "directed" ? s : e.undirected(s).snapshot, n = r.flags.multigraph ? r.simplified({ weights: "sum" }).snapshot : r;
195
+ return B(n, t);
163
196
  }
164
- function P(e) {
197
+ function oe(e) {
165
198
  const t = e.getSnapshot();
166
199
  return t.flags.multigraph ? t.edgeCount - t.simplified({ weights: "sum" }).snapshot.edgeCount : 0;
167
200
  }
168
- function _(e, t) {
169
- const s = new S({
201
+ function B(e, t) {
202
+ const s = new _({
170
203
  directed: t !== "undirected"
171
204
  }), { ids: r } = e;
172
- for (let n = 0; n < e.nodeCount; n++)
173
- s.addNode(r.idOf(n));
174
- const { src: i, dst: a, weights: c } = e.edgeList();
175
- for (let n = 0; n < e.edgeCount; n++) {
176
- const w = r.idOf(i[n]), b = r.idOf(a[n]), y = c === null ? 1 : c[n];
177
- s.addEdge(w, b, y);
205
+ for (let o = 0; o < e.nodeCount; o++)
206
+ s.addNode(r.idOf(o));
207
+ const { src: n, dst: i, weights: c } = e.edgeList();
208
+ for (let o = 0; o < e.edgeCount; o++) {
209
+ const u = r.idOf(n[o]), h = r.idOf(i[o]), l = c === null ? 1 : c[o];
210
+ s.addEdge(u, h, l);
178
211
  }
179
212
  return s;
180
213
  }
181
- const g = /* @__PURE__ */ new Map(), h = class h {
214
+ const m = /* @__PURE__ */ new Map();
215
+ function F(e, t) {
216
+ if (t === null)
217
+ return e;
218
+ if (e === null)
219
+ return t;
220
+ const s = new Uint32Array(e.length);
221
+ for (let r = 0; r < e.length; r++) {
222
+ const n = e[r];
223
+ s[r] = n === w ? w : t[n];
224
+ }
225
+ return s;
226
+ }
227
+ const O = class O {
182
228
  /**
183
229
  * Getter for schema options
184
230
  *
@@ -208,7 +254,71 @@ const g = /* @__PURE__ */ new Map(), h = class h {
208
254
  * @returns a freshly built Graph for the algorithm package
209
255
  */
210
256
  algorithmGraph(t) {
211
- return D(this.graph.getDataManager(), t);
257
+ return x(this.graph.getDataManager(), t);
258
+ }
259
+ /**
260
+ * The route an algorithm with an accelerated implementation takes.
261
+ *
262
+ * It is the counterpart of {@link algorithmGraph} for the algorithms `@graphty/algorithms`
263
+ * can dispatch: instead of copying the snapshot into an object graph, the work runs over the
264
+ * snapshot itself, on the attached accelerator or on the index-based CPU port, and the adapter
265
+ * writes one loop over an index-aligned result either way.
266
+ *
267
+ * THE DECISION IS TAKEN ONCE, HERE, BEFORE ANY WORK STARTS. The controller answers "the policy
268
+ * is off", "no accelerator", "below `acceleration.minNodes`" or "this accelerator does not
269
+ * implement that" up front, and under `acceleration="required"` it throws `E_NO_ACCELERATOR`
270
+ * rather than answering quietly. After the work has started there is no second decision: a
271
+ * failure from the accelerator propagates with its code and fails the run, because a number
272
+ * that silently came from somewhere else is worse than no number.
273
+ * @param capability - The accelerator member this work would use, such as `"pageRank"`.
274
+ * @param mode - The shape this algorithm needs; see {@link AlgorithmGraphMode}. `"undirected"`
275
+ * takes the snapshot's undirected view, which is what collapses a reciprocal pair into one
276
+ * edge.
277
+ * @returns The snapshot, the edge map onto it, and the runner.
278
+ * @example
279
+ * ```ts
280
+ * const { snapshot, run } = this.accelerated("connectedComponents", "undirected");
281
+ * const { value, precision } = await run((dispatch, s) => dispatch.connectedComponents(s));
282
+ * const group = value.labels[snapshot.ids.indexOf(nodeId)];
283
+ * ```
284
+ */
285
+ accelerated(t, s) {
286
+ const r = this.graph.getDataManager(), n = r.getSnapshot(), i = s === "undirected" ? r.undirected(n) : null, c = i === null ? n : i.snapshot, o = c.flags.multigraph ? c.simplified({ weights: "sum" }) : null, u = o === null ? c : o.snapshot, h = this.graph.acceleration, l = { capability: t, nodeCount: u.nodeCount };
287
+ return {
288
+ snapshot: u,
289
+ edgeRemap: F(i?.edgeRemap ?? null, o?.edgeRemap ?? null),
290
+ run: async (b) => {
291
+ const f = await h.run(
292
+ l,
293
+ (S) => b(y(R(S)), u)
294
+ );
295
+ return f.accelerated ? { value: f.value, precision: f.precision } : { value: await b(y(null), u), precision: M };
296
+ }
297
+ };
298
+ }
299
+ /**
300
+ * The dense row of a node the reader named in an option.
301
+ *
302
+ * A search takes its source as an id and the snapshot answers in indices, so this is where the
303
+ * two meet -- and where an id that names no node in the graph is reported as what it is: an
304
+ * option whose value is outside the permitted range, carrying the option's name and what was
305
+ * passed, rather than a silent empty result or a search from row zero.
306
+ * @param snapshot - The graph the work runs over.
307
+ * @param option - The option the id came from, named in the error.
308
+ * @param id - The node id the reader gave.
309
+ * @returns The node's dense row.
310
+ * @throws A `GraphtyError` with `E_OPTION_RANGE` when the graph has no such node.
311
+ */
312
+ nodeIndex(t, s, r) {
313
+ const n = t.ids.indexOf(r);
314
+ if (n === w)
315
+ throw new d({
316
+ code: "E_OPTION_RANGE",
317
+ message: `the graph has no node "${String(r)}", so "${s}" names nothing to run from`,
318
+ source: "run",
319
+ details: { option: s, value: r }
320
+ });
321
+ return n;
212
322
  }
213
323
  /**
214
324
  * Resolves and validates options against the schema
@@ -217,7 +327,7 @@ const g = /* @__PURE__ */ new Map(), h = class h {
217
327
  */
218
328
  resolveOptions(t) {
219
329
  const s = this.constructor.optionsSchema;
220
- return Object.keys(s).length === 0 ? {} : C(s, t);
330
+ return Object.keys(s).length === 0 ? {} : P(s, t);
221
331
  }
222
332
  /**
223
333
  * Gets the algorithm type
@@ -270,14 +380,14 @@ const g = /* @__PURE__ */ new Map(), h = class h {
270
380
  * @returns The registered algorithm class
271
381
  */
272
382
  static register(t) {
273
- const s = t, r = String(s.type), i = String(s.namespace), { descriptor: a, cost: c, version: n } = s;
274
- return a !== void 0 && A({
275
- descriptor: a,
276
- namespace: i,
383
+ const s = t, r = String(s.type), n = String(s.namespace), { descriptor: i, cost: c, version: o } = s;
384
+ return i !== void 0 && T({
385
+ descriptor: i,
386
+ namespace: n,
277
387
  type: r,
278
388
  ...c === void 0 ? {} : { cost: c },
279
- ...n === void 0 ? {} : { version: n }
280
- }), g.set(`${i}:${r}`, t), t;
389
+ ...o === void 0 ? {} : { version: o }
390
+ }), m.set(`${n}:${r}`, t), t;
281
391
  }
282
392
  /**
283
393
  * Gets an algorithm instance from the registry
@@ -287,9 +397,9 @@ const g = /* @__PURE__ */ new Map(), h = class h {
287
397
  * @param options - Optional algorithm-specific options to pass to constructor
288
398
  * @returns A new instance of the algorithm, or null if not found
289
399
  */
290
- static get(t, s, r, i) {
291
- const a = g.get(`${s}:${r}`);
292
- return a ? new a(t, i) : null;
400
+ static get(t, s, r, n) {
401
+ const i = m.get(`${s}:${r}`);
402
+ return i ? new i(t, n) : null;
293
403
  }
294
404
  /**
295
405
  * Gets an algorithm class from the registry
@@ -298,7 +408,7 @@ const g = /* @__PURE__ */ new Map(), h = class h {
298
408
  * @returns The algorithm class, or null if not found
299
409
  */
300
410
  static getClass(t, s) {
301
- return g.get(`${t}:${s}`) ?? null;
411
+ return m.get(`${t}:${s}`) ?? null;
302
412
  }
303
413
  /**
304
414
  * Get the options schema for this algorithm
@@ -337,7 +447,7 @@ const g = /* @__PURE__ */ new Map(), h = class h {
337
447
  */
338
448
  static getRegisteredAlgorithms(t) {
339
449
  const s = [];
340
- for (const r of g.keys())
450
+ for (const r of m.keys())
341
451
  (!t || r.startsWith(`${t}:`)) && s.push(r);
342
452
  return s.sort();
343
453
  }
@@ -357,20 +467,28 @@ const g = /* @__PURE__ */ new Map(), h = class h {
357
467
  return this.getRegisteredAlgorithms();
358
468
  }
359
469
  };
360
- h.optionsSchema = {};
361
- let l = h;
470
+ O.optionsSchema = {};
471
+ let E = O;
362
472
  export {
363
- l as A,
364
- o as O,
365
- j as a,
366
- x as b,
367
- G as c,
368
- F as d,
369
- T as e,
370
- C as f,
371
- V as g,
372
- B as h,
373
- P as m,
374
- R as r,
375
- k as v
473
+ E as A,
474
+ M as C,
475
+ J as D,
476
+ a as O,
477
+ Y as a,
478
+ te as b,
479
+ re as c,
480
+ ne as d,
481
+ z as e,
482
+ P as f,
483
+ D as g,
484
+ Z as h,
485
+ X as i,
486
+ W as j,
487
+ ee as k,
488
+ Q as l,
489
+ se as m,
490
+ H as n,
491
+ oe as o,
492
+ K as r,
493
+ v
376
494
  };
@@ -1,8 +1,8 @@
1
1
  import { z as p } from "zod/v4";
2
2
  import * as $ from "zod/v4/core";
3
- import { F as w, v as E } from "./paletteRegistry-B-oS4YxP.js";
4
- import { b as F } from "./GraphtyLogger-CK03SnJi.js";
5
- import { G as f } from "./GraphtyError-B3eKs4yg.js";
3
+ import { F as w, v as E } from "./paletteRegistry-NrWOKT-A.js";
4
+ import { b as F } from "./GraphtyLogger-5KEttFUo.js";
5
+ import { G as f } from "./GraphtyError-BwcnblTH.js";
6
6
  class C {
7
7
  /**
8
8
  * Creates a new ErrorAggregator instance.