egraph 6.0.0-alpha.8 → 6.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -17
- package/package.json +1 -1
- package/pkg/README.md +93 -17
- package/pkg/egraph_wasm.d.ts +2108 -623
- package/pkg/egraph_wasm.js +11232 -3728
- package/pkg/egraph_wasm_bg.wasm +0 -0
- package/pkg/index.d.ts +2435 -718
- package/pkg/index.js +436 -106
package/README.md
CHANGED
|
@@ -12,8 +12,9 @@ npm install egraph
|
|
|
12
12
|
|
|
13
13
|
- **Pure ESM & Single `.wasm`**: Modern `"exports"` entrypoints for browsers/bundlers (`./pkg/index.js`) and Node.js 18+ (`./pkg/egraph_wasm.node.js`), sharing a single `wasm-opt -Oz` optimized `.wasm` binary.
|
|
14
14
|
- **Strictly Single-Threaded**: Pure CPU Rust with deterministic seeded execution (`seed = 42` default), zero `rayon`, zero `std::thread`, zero Web Workers, and zero `SharedArrayBuffer`.
|
|
15
|
-
- **Zero-Copy Linear Memory Views**: `
|
|
16
|
-
- **Cooperative
|
|
15
|
+
- **Zero-Copy Linear Memory Views**: `coordsView()` on `Layout2d`, `LayoutNd`, and `ManifoldLayout2d` (plus `labelsView()` on all 5 clustering result classes and `centroidsView()` on `KMeansResult`) returns a cached typed-array view directly over WebAssembly linear memory and automatically refreshes if `memory.grow` detaches the `ArrayBuffer`.
|
|
16
|
+
- **Polymorphic Cooperative Execution**: `step(layout)`, `runSteps(layout, k)`, `run(layout)`, and `runProgressive(solver, layout, onFrame, options?)` work polymorphically across `Layout2d`, `LayoutNd` (11 N-D solvers), and `ManifoldLayout2d` (6 manifold solvers).
|
|
17
|
+
- **Track A, Track B, 3D/N-D & Non-Euclidean Engines**: `TsNetSolver.pure2Hop({ backend: "auto" })` / `fromGraphRowNormalized`, `SgdSolver.sparseBarrierDog`, `GuMapSolver`, `ArenaOctree3d`, `DynamicKdTree`, `ManifoldLayout2d` (`"hyperbolic_lorentz"`, `toPoincareLayout`, `ManifoldMetric`, `torusSpectralPhaseInit`, `torusAutoPan`, `torusEdgeSegments`, geodesic crossings), `TwinDeclutterer`, `transitiveReduction`, `MetricReport` (`toRecord()`), `listDatasets` / synthetic generators, `DijkstraWorkspace`, MDS, Laplacian builders, and `ChebyshevDogKernel`.
|
|
17
18
|
|
|
18
19
|
## Quick Start (Browser / Bundler ESM)
|
|
19
20
|
|
|
@@ -39,7 +40,7 @@ const layout = pivotMdsInit(graph, 4, 42);
|
|
|
39
40
|
|
|
40
41
|
// Run Track A Pure 1+2-Hop Adaptive tsNET progressively in requestAnimationFrame
|
|
41
42
|
const solver = TsNetSolver.pure2Hop(graph, {
|
|
42
|
-
backend: "
|
|
43
|
+
backend: "auto",
|
|
43
44
|
seed: 42,
|
|
44
45
|
});
|
|
45
46
|
|
|
@@ -53,7 +54,7 @@ await runProgressive(
|
|
|
53
54
|
{ frameBudgetMs: 10 },
|
|
54
55
|
);
|
|
55
56
|
|
|
56
|
-
// Selectively evaluate quality metrics
|
|
57
|
+
// Selectively evaluate quality metrics -> MetricReport
|
|
57
58
|
const report = evaluateMetrics(graph, layout, ["sns", "np2", "crossingNumber"]);
|
|
58
59
|
console.log(report.toRecord());
|
|
59
60
|
```
|
|
@@ -69,24 +70,32 @@ await init();
|
|
|
69
70
|
|
|
70
71
|
const graph = CsrGraph.fromEdgeList(4, new Uint32Array([0, 1, 1, 2, 2, 3, 3, 0]));
|
|
71
72
|
const layout = pivotMdsInit(graph, 4, 42);
|
|
72
|
-
const solver = new TFdpSolver(graph, { backend: "ibfft",
|
|
73
|
+
const solver = new TFdpSolver(graph, { backend: "ibfft", iterations: 200, seed: 42 });
|
|
73
74
|
solver.run(layout);
|
|
74
75
|
|
|
75
76
|
const xy = layout.coordsView();
|
|
76
77
|
console.log(Array.from(xy));
|
|
77
78
|
```
|
|
78
79
|
|
|
79
|
-
## Solver Examples
|
|
80
|
+
## Solver & Engine Examples
|
|
80
81
|
|
|
81
|
-
### Track A: `TsNetSolver.pure2Hop`
|
|
82
|
+
### Track A: `TsNetSolver.pure2Hop` & `fromGraphRowNormalized`
|
|
82
83
|
|
|
83
84
|
```js
|
|
84
85
|
const solver = TsNetSolver.pure2Hop(graph, {
|
|
85
|
-
backend: "fft",
|
|
86
|
+
backend: "auto", // "auto" (Exact <= 256, LinearFft > 256), "fft", "linear_fft", "barnes_hut", "exact"
|
|
86
87
|
perplexityC: 0.9,
|
|
87
88
|
seed: 42,
|
|
88
89
|
});
|
|
89
90
|
solver.run(layout);
|
|
91
|
+
|
|
92
|
+
const rnSolver = TsNetSolver.fromGraphRowNormalizedWithOptions(graph, {
|
|
93
|
+
w2: 0.5,
|
|
94
|
+
mode: "two_step_random_walk",
|
|
95
|
+
backend: "auto",
|
|
96
|
+
seed: 42,
|
|
97
|
+
});
|
|
98
|
+
rnSolver.run(layout);
|
|
90
99
|
```
|
|
91
100
|
|
|
92
101
|
### Track B & Unified Force Models: `TFdpSolver`, `ForceAtlas2Solver`, `GuMapSolver`
|
|
@@ -102,7 +111,7 @@ import {
|
|
|
102
111
|
// t-FDP with ibFFT repulsion
|
|
103
112
|
const tfdp = new TFdpSolver(graph, {
|
|
104
113
|
backend: "ibfft",
|
|
105
|
-
|
|
114
|
+
iterations: 200,
|
|
106
115
|
seed: 42,
|
|
107
116
|
});
|
|
108
117
|
tfdp.run(layout);
|
|
@@ -118,7 +127,7 @@ fa2.run(layout);
|
|
|
118
127
|
|
|
119
128
|
// GuMap from regularized Chebyshev DoG landmarks
|
|
120
129
|
const gumap = GuMapSolver.fromGraphDog(graph, {
|
|
121
|
-
|
|
130
|
+
iterations: 200,
|
|
122
131
|
minDist: 0.1,
|
|
123
132
|
spread: 1.0,
|
|
124
133
|
seed: 42,
|
|
@@ -130,11 +139,57 @@ const barrierSgd = SgdSolver.sparseBarrierDog(graph, { seed: 42 });
|
|
|
130
139
|
barrierSgd.run(layout);
|
|
131
140
|
```
|
|
132
141
|
|
|
133
|
-
###
|
|
142
|
+
### 3D / $N$-D (`LayoutNd` + `ArenaOctree3d`) & Non-Euclidean Manifolds (`ManifoldLayout2d`)
|
|
134
143
|
|
|
135
144
|
```js
|
|
136
|
-
import {
|
|
145
|
+
import {
|
|
146
|
+
ArenaOctree3d,
|
|
147
|
+
LayoutNd,
|
|
148
|
+
ManifoldLayout2d,
|
|
149
|
+
SgdSolver,
|
|
150
|
+
geodesicDistortion,
|
|
151
|
+
runProgressive,
|
|
152
|
+
} from "egraph";
|
|
153
|
+
|
|
154
|
+
// 3D LayoutNd with ArenaOctree3d
|
|
155
|
+
const layout3d = LayoutNd.init(graph.numNodes(), 3, 42);
|
|
156
|
+
const octree = new ArenaOctree3d();
|
|
157
|
+
octree.build(layout3d);
|
|
158
|
+
const repulsion = octree.computeCoulombRepulsion(0.5);
|
|
159
|
+
|
|
160
|
+
// Hyperbolic Lorentz hyperboloid -> Poincaré disk + polymorphic runProgressive
|
|
161
|
+
const lorentz = ManifoldLayout2d.init("hyperbolic_lorentz", graph.numNodes(), 42);
|
|
162
|
+
await runProgressive(SgdSolver.full(graph, { iterations: 60, seed: 42 }), lorentz);
|
|
163
|
+
const poincare = lorentz.toPoincareLayout();
|
|
164
|
+
console.log("geodesicDistortion:", geodesicDistortion(graph, poincare));
|
|
165
|
+
|
|
166
|
+
// Torus spectral phase init & optimal boundary auto-pan
|
|
167
|
+
const torus = ManifoldLayout2d.torusSpectralPhaseInit(graph, 42);
|
|
168
|
+
const panned = torus.torusAutoPan(graph);
|
|
169
|
+
console.log(panned.coordsView().length);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Clustering (`labelsView()`), Overlap Removal, Decluttering & Datasets
|
|
137
173
|
|
|
174
|
+
```js
|
|
175
|
+
import {
|
|
176
|
+
Layout2d,
|
|
177
|
+
PrismOverlapRemoval,
|
|
178
|
+
TwinDeclutterer,
|
|
179
|
+
generateSbmGraph,
|
|
180
|
+
leidenCommunities,
|
|
181
|
+
listDatasets,
|
|
182
|
+
prismDistortion,
|
|
183
|
+
transitiveReduction,
|
|
184
|
+
} from "egraph";
|
|
185
|
+
|
|
186
|
+
// Synthetic SBM graph + zero-copy LeidenResult.labelsView()
|
|
187
|
+
const { graph: sbmGraph, labels: groundTruth } = generateSbmGraph(new Uint32Array([12, 12]), 0.5, 0.05, 42);
|
|
188
|
+
const leiden = leidenCommunities(sbmGraph, { seed: 42 });
|
|
189
|
+
const labels = leiden.labelsView();
|
|
190
|
+
console.log("datasets:", listDatasets().length, "communities:", leiden.numCommunities, labels.length, groundTruth.length);
|
|
191
|
+
|
|
192
|
+
// Overlap removal (PRISM) + TwinDeclutterer
|
|
138
193
|
const original = Layout2d.fromCoords(layout.coordsView());
|
|
139
194
|
const radii = new Float32Array(graph.numNodes()).fill(0.25);
|
|
140
195
|
const prism = PrismOverlapRemoval.fromRadii(radii, {
|
|
@@ -143,20 +198,41 @@ const prism = PrismOverlapRemoval.fromRadii(radii, {
|
|
|
143
198
|
seed: 42,
|
|
144
199
|
});
|
|
145
200
|
prism.run(layout);
|
|
201
|
+
new TwinDeclutterer({ iterations: 4 }).run(layout);
|
|
146
202
|
|
|
147
203
|
const distortion = prismDistortion(original, layout);
|
|
148
204
|
console.log(prism.lastOverlapCount, distortion.sigmaDist, distortion.sigmaDisp);
|
|
149
205
|
```
|
|
150
206
|
|
|
207
|
+
### Linalg, Chebyshev & Shortest Paths
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
import {
|
|
211
|
+
ChebyshevDogKernel,
|
|
212
|
+
DijkstraWorkspace,
|
|
213
|
+
classicalMds,
|
|
214
|
+
combinatorialLaplacian,
|
|
215
|
+
pivotMds,
|
|
216
|
+
} from "egraph";
|
|
217
|
+
|
|
218
|
+
const ws = new DijkstraWorkspace(graph.numNodes());
|
|
219
|
+
const dists = ws.dijkstraFrom(graph, 0);
|
|
220
|
+
const mds3d = classicalMds(graph, 3);
|
|
221
|
+
const mds2d = pivotMds(graph, 4, 42);
|
|
222
|
+
const lap = combinatorialLaplacian(graph);
|
|
223
|
+
const dog = new ChebyshevDogKernel(graph, { seed: 42 });
|
|
224
|
+
console.log(dists.length, mds3d.dims, mds2d.numNodes, lap.nnz, dog.degree);
|
|
225
|
+
```
|
|
226
|
+
|
|
151
227
|
## Migration from v5 / Legacy Alpha
|
|
152
228
|
|
|
153
|
-
See [docs/MIGRATION_V6.md](https://github.com/likr/egraph-rs/blob/master/docs/MIGRATION_V6.md) for a complete v5
|
|
229
|
+
See [docs/MIGRATION_V6.md](https://github.com/likr/egraph-rs/blob/master/docs/MIGRATION_V6.md) for a complete v5 and `alpha.8 -> alpha.9` migration guide, including:
|
|
154
230
|
|
|
155
231
|
1. Replacing `Graph` host object weights with `CsrGraph.fromCsr` / `CsrGraph.fromEdgeList` and host-side arrays
|
|
156
|
-
2. Migrating
|
|
157
|
-
3. Consolidating `TsNet` / `BhTsNet` / `FitTsNet` / `LTsNet` into `TsNetSolver
|
|
158
|
-
4. Replacing `stress` (`NS`) with Scale-Normalized Stress (`scaleNormalizedStress` / `evaluateMetrics`)
|
|
159
|
-
5. Migrating from `egraph/dist/web/egraph_wasm` to pure ESM, `coordsView()`, and `runProgressive`
|
|
232
|
+
2. Migrating legacy v5 overlap removal classes to `PrismOverlapRemoval` / `ForbidOverlapRemoval` / `TwinDeclutterer`
|
|
233
|
+
3. Consolidating `TsNet` / `BhTsNet` / `FitTsNet` / `LTsNet` into `TsNetSolver` (`pure2Hop`, `fromGraphRowNormalized`, `"auto"`)
|
|
234
|
+
4. Replacing `stress` (`NS`) with Scale-Normalized Stress (`scaleNormalizedStress` / `evaluateMetrics` -> `MetricReport`)
|
|
235
|
+
5. Migrating from `egraph/dist/web/egraph_wasm` to pure ESM, `coordsView()`, `labelsView()`, and polymorphic `runProgressive`, plus `iterations`/`maxIterations` option unification
|
|
160
236
|
|
|
161
237
|
## License
|
|
162
238
|
|
package/package.json
CHANGED
package/pkg/README.md
CHANGED
|
@@ -12,8 +12,9 @@ npm install egraph
|
|
|
12
12
|
|
|
13
13
|
- **Pure ESM & Single `.wasm`**: Modern `"exports"` entrypoints for browsers/bundlers (`./pkg/index.js`) and Node.js 18+ (`./pkg/egraph_wasm.node.js`), sharing a single `wasm-opt -Oz` optimized `.wasm` binary.
|
|
14
14
|
- **Strictly Single-Threaded**: Pure CPU Rust with deterministic seeded execution (`seed = 42` default), zero `rayon`, zero `std::thread`, zero Web Workers, and zero `SharedArrayBuffer`.
|
|
15
|
-
- **Zero-Copy Linear Memory Views**: `
|
|
16
|
-
- **Cooperative
|
|
15
|
+
- **Zero-Copy Linear Memory Views**: `coordsView()` on `Layout2d`, `LayoutNd`, and `ManifoldLayout2d` (plus `labelsView()` on all 5 clustering result classes and `centroidsView()` on `KMeansResult`) returns a cached typed-array view directly over WebAssembly linear memory and automatically refreshes if `memory.grow` detaches the `ArrayBuffer`.
|
|
16
|
+
- **Polymorphic Cooperative Execution**: `step(layout)`, `runSteps(layout, k)`, `run(layout)`, and `runProgressive(solver, layout, onFrame, options?)` work polymorphically across `Layout2d`, `LayoutNd` (11 N-D solvers), and `ManifoldLayout2d` (6 manifold solvers).
|
|
17
|
+
- **Track A, Track B, 3D/N-D & Non-Euclidean Engines**: `TsNetSolver.pure2Hop({ backend: "auto" })` / `fromGraphRowNormalized`, `SgdSolver.sparseBarrierDog`, `GuMapSolver`, `ArenaOctree3d`, `DynamicKdTree`, `ManifoldLayout2d` (`"hyperbolic_lorentz"`, `toPoincareLayout`, `ManifoldMetric`, `torusSpectralPhaseInit`, `torusAutoPan`, `torusEdgeSegments`, geodesic crossings), `TwinDeclutterer`, `transitiveReduction`, `MetricReport` (`toRecord()`), `listDatasets` / synthetic generators, `DijkstraWorkspace`, MDS, Laplacian builders, and `ChebyshevDogKernel`.
|
|
17
18
|
|
|
18
19
|
## Quick Start (Browser / Bundler ESM)
|
|
19
20
|
|
|
@@ -39,7 +40,7 @@ const layout = pivotMdsInit(graph, 4, 42);
|
|
|
39
40
|
|
|
40
41
|
// Run Track A Pure 1+2-Hop Adaptive tsNET progressively in requestAnimationFrame
|
|
41
42
|
const solver = TsNetSolver.pure2Hop(graph, {
|
|
42
|
-
backend: "
|
|
43
|
+
backend: "auto",
|
|
43
44
|
seed: 42,
|
|
44
45
|
});
|
|
45
46
|
|
|
@@ -53,7 +54,7 @@ await runProgressive(
|
|
|
53
54
|
{ frameBudgetMs: 10 },
|
|
54
55
|
);
|
|
55
56
|
|
|
56
|
-
// Selectively evaluate quality metrics
|
|
57
|
+
// Selectively evaluate quality metrics -> MetricReport
|
|
57
58
|
const report = evaluateMetrics(graph, layout, ["sns", "np2", "crossingNumber"]);
|
|
58
59
|
console.log(report.toRecord());
|
|
59
60
|
```
|
|
@@ -69,24 +70,32 @@ await init();
|
|
|
69
70
|
|
|
70
71
|
const graph = CsrGraph.fromEdgeList(4, new Uint32Array([0, 1, 1, 2, 2, 3, 3, 0]));
|
|
71
72
|
const layout = pivotMdsInit(graph, 4, 42);
|
|
72
|
-
const solver = new TFdpSolver(graph, { backend: "ibfft",
|
|
73
|
+
const solver = new TFdpSolver(graph, { backend: "ibfft", iterations: 200, seed: 42 });
|
|
73
74
|
solver.run(layout);
|
|
74
75
|
|
|
75
76
|
const xy = layout.coordsView();
|
|
76
77
|
console.log(Array.from(xy));
|
|
77
78
|
```
|
|
78
79
|
|
|
79
|
-
## Solver Examples
|
|
80
|
+
## Solver & Engine Examples
|
|
80
81
|
|
|
81
|
-
### Track A: `TsNetSolver.pure2Hop`
|
|
82
|
+
### Track A: `TsNetSolver.pure2Hop` & `fromGraphRowNormalized`
|
|
82
83
|
|
|
83
84
|
```js
|
|
84
85
|
const solver = TsNetSolver.pure2Hop(graph, {
|
|
85
|
-
backend: "fft",
|
|
86
|
+
backend: "auto", // "auto" (Exact <= 256, LinearFft > 256), "fft", "linear_fft", "barnes_hut", "exact"
|
|
86
87
|
perplexityC: 0.9,
|
|
87
88
|
seed: 42,
|
|
88
89
|
});
|
|
89
90
|
solver.run(layout);
|
|
91
|
+
|
|
92
|
+
const rnSolver = TsNetSolver.fromGraphRowNormalizedWithOptions(graph, {
|
|
93
|
+
w2: 0.5,
|
|
94
|
+
mode: "two_step_random_walk",
|
|
95
|
+
backend: "auto",
|
|
96
|
+
seed: 42,
|
|
97
|
+
});
|
|
98
|
+
rnSolver.run(layout);
|
|
90
99
|
```
|
|
91
100
|
|
|
92
101
|
### Track B & Unified Force Models: `TFdpSolver`, `ForceAtlas2Solver`, `GuMapSolver`
|
|
@@ -102,7 +111,7 @@ import {
|
|
|
102
111
|
// t-FDP with ibFFT repulsion
|
|
103
112
|
const tfdp = new TFdpSolver(graph, {
|
|
104
113
|
backend: "ibfft",
|
|
105
|
-
|
|
114
|
+
iterations: 200,
|
|
106
115
|
seed: 42,
|
|
107
116
|
});
|
|
108
117
|
tfdp.run(layout);
|
|
@@ -118,7 +127,7 @@ fa2.run(layout);
|
|
|
118
127
|
|
|
119
128
|
// GuMap from regularized Chebyshev DoG landmarks
|
|
120
129
|
const gumap = GuMapSolver.fromGraphDog(graph, {
|
|
121
|
-
|
|
130
|
+
iterations: 200,
|
|
122
131
|
minDist: 0.1,
|
|
123
132
|
spread: 1.0,
|
|
124
133
|
seed: 42,
|
|
@@ -130,11 +139,57 @@ const barrierSgd = SgdSolver.sparseBarrierDog(graph, { seed: 42 });
|
|
|
130
139
|
barrierSgd.run(layout);
|
|
131
140
|
```
|
|
132
141
|
|
|
133
|
-
###
|
|
142
|
+
### 3D / $N$-D (`LayoutNd` + `ArenaOctree3d`) & Non-Euclidean Manifolds (`ManifoldLayout2d`)
|
|
134
143
|
|
|
135
144
|
```js
|
|
136
|
-
import {
|
|
145
|
+
import {
|
|
146
|
+
ArenaOctree3d,
|
|
147
|
+
LayoutNd,
|
|
148
|
+
ManifoldLayout2d,
|
|
149
|
+
SgdSolver,
|
|
150
|
+
geodesicDistortion,
|
|
151
|
+
runProgressive,
|
|
152
|
+
} from "egraph";
|
|
153
|
+
|
|
154
|
+
// 3D LayoutNd with ArenaOctree3d
|
|
155
|
+
const layout3d = LayoutNd.init(graph.numNodes(), 3, 42);
|
|
156
|
+
const octree = new ArenaOctree3d();
|
|
157
|
+
octree.build(layout3d);
|
|
158
|
+
const repulsion = octree.computeCoulombRepulsion(0.5);
|
|
159
|
+
|
|
160
|
+
// Hyperbolic Lorentz hyperboloid -> Poincaré disk + polymorphic runProgressive
|
|
161
|
+
const lorentz = ManifoldLayout2d.init("hyperbolic_lorentz", graph.numNodes(), 42);
|
|
162
|
+
await runProgressive(SgdSolver.full(graph, { iterations: 60, seed: 42 }), lorentz);
|
|
163
|
+
const poincare = lorentz.toPoincareLayout();
|
|
164
|
+
console.log("geodesicDistortion:", geodesicDistortion(graph, poincare));
|
|
165
|
+
|
|
166
|
+
// Torus spectral phase init & optimal boundary auto-pan
|
|
167
|
+
const torus = ManifoldLayout2d.torusSpectralPhaseInit(graph, 42);
|
|
168
|
+
const panned = torus.torusAutoPan(graph);
|
|
169
|
+
console.log(panned.coordsView().length);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Clustering (`labelsView()`), Overlap Removal, Decluttering & Datasets
|
|
137
173
|
|
|
174
|
+
```js
|
|
175
|
+
import {
|
|
176
|
+
Layout2d,
|
|
177
|
+
PrismOverlapRemoval,
|
|
178
|
+
TwinDeclutterer,
|
|
179
|
+
generateSbmGraph,
|
|
180
|
+
leidenCommunities,
|
|
181
|
+
listDatasets,
|
|
182
|
+
prismDistortion,
|
|
183
|
+
transitiveReduction,
|
|
184
|
+
} from "egraph";
|
|
185
|
+
|
|
186
|
+
// Synthetic SBM graph + zero-copy LeidenResult.labelsView()
|
|
187
|
+
const { graph: sbmGraph, labels: groundTruth } = generateSbmGraph(new Uint32Array([12, 12]), 0.5, 0.05, 42);
|
|
188
|
+
const leiden = leidenCommunities(sbmGraph, { seed: 42 });
|
|
189
|
+
const labels = leiden.labelsView();
|
|
190
|
+
console.log("datasets:", listDatasets().length, "communities:", leiden.numCommunities, labels.length, groundTruth.length);
|
|
191
|
+
|
|
192
|
+
// Overlap removal (PRISM) + TwinDeclutterer
|
|
138
193
|
const original = Layout2d.fromCoords(layout.coordsView());
|
|
139
194
|
const radii = new Float32Array(graph.numNodes()).fill(0.25);
|
|
140
195
|
const prism = PrismOverlapRemoval.fromRadii(radii, {
|
|
@@ -143,20 +198,41 @@ const prism = PrismOverlapRemoval.fromRadii(radii, {
|
|
|
143
198
|
seed: 42,
|
|
144
199
|
});
|
|
145
200
|
prism.run(layout);
|
|
201
|
+
new TwinDeclutterer({ iterations: 4 }).run(layout);
|
|
146
202
|
|
|
147
203
|
const distortion = prismDistortion(original, layout);
|
|
148
204
|
console.log(prism.lastOverlapCount, distortion.sigmaDist, distortion.sigmaDisp);
|
|
149
205
|
```
|
|
150
206
|
|
|
207
|
+
### Linalg, Chebyshev & Shortest Paths
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
import {
|
|
211
|
+
ChebyshevDogKernel,
|
|
212
|
+
DijkstraWorkspace,
|
|
213
|
+
classicalMds,
|
|
214
|
+
combinatorialLaplacian,
|
|
215
|
+
pivotMds,
|
|
216
|
+
} from "egraph";
|
|
217
|
+
|
|
218
|
+
const ws = new DijkstraWorkspace(graph.numNodes());
|
|
219
|
+
const dists = ws.dijkstraFrom(graph, 0);
|
|
220
|
+
const mds3d = classicalMds(graph, 3);
|
|
221
|
+
const mds2d = pivotMds(graph, 4, 42);
|
|
222
|
+
const lap = combinatorialLaplacian(graph);
|
|
223
|
+
const dog = new ChebyshevDogKernel(graph, { seed: 42 });
|
|
224
|
+
console.log(dists.length, mds3d.dims, mds2d.numNodes, lap.nnz, dog.degree);
|
|
225
|
+
```
|
|
226
|
+
|
|
151
227
|
## Migration from v5 / Legacy Alpha
|
|
152
228
|
|
|
153
|
-
See [docs/MIGRATION_V6.md](https://github.com/likr/egraph-rs/blob/master/docs/MIGRATION_V6.md) for a complete v5
|
|
229
|
+
See [docs/MIGRATION_V6.md](https://github.com/likr/egraph-rs/blob/master/docs/MIGRATION_V6.md) for a complete v5 and `alpha.8 -> alpha.9` migration guide, including:
|
|
154
230
|
|
|
155
231
|
1. Replacing `Graph` host object weights with `CsrGraph.fromCsr` / `CsrGraph.fromEdgeList` and host-side arrays
|
|
156
|
-
2. Migrating
|
|
157
|
-
3. Consolidating `TsNet` / `BhTsNet` / `FitTsNet` / `LTsNet` into `TsNetSolver
|
|
158
|
-
4. Replacing `stress` (`NS`) with Scale-Normalized Stress (`scaleNormalizedStress` / `evaluateMetrics`)
|
|
159
|
-
5. Migrating from `egraph/dist/web/egraph_wasm` to pure ESM, `coordsView()`, and `runProgressive`
|
|
232
|
+
2. Migrating legacy v5 overlap removal classes to `PrismOverlapRemoval` / `ForbidOverlapRemoval` / `TwinDeclutterer`
|
|
233
|
+
3. Consolidating `TsNet` / `BhTsNet` / `FitTsNet` / `LTsNet` into `TsNetSolver` (`pure2Hop`, `fromGraphRowNormalized`, `"auto"`)
|
|
234
|
+
4. Replacing `stress` (`NS`) with Scale-Normalized Stress (`scaleNormalizedStress` / `evaluateMetrics` -> `MetricReport`)
|
|
235
|
+
5. Migrating from `egraph/dist/web/egraph_wasm` to pure ESM, `coordsView()`, `labelsView()`, and polymorphic `runProgressive`, plus `iterations`/`maxIterations` option unification
|
|
160
236
|
|
|
161
237
|
## License
|
|
162
238
|
|