egraph 6.0.0-beta.4 → 6.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -13
- package/package.json +1 -1
- package/pkg/README.md +16 -13
- package/pkg/egraph_wasm.d.ts +792 -412
- package/pkg/egraph_wasm.js +2572 -1197
- package/pkg/egraph_wasm_bg.wasm +0 -0
- package/pkg/index.d.ts +1130 -465
- package/pkg/index.js +69 -8
package/README.md
CHANGED
|
@@ -14,14 +14,14 @@ npm install egraph
|
|
|
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
15
|
- **Zero-Copy Linear Memory Views**: `coordsView()` on `Layout2d`, `Layout3d`, `LayoutNd`, and `ManifoldLayout2d` (plus `edgeOffsetsView()` / `pointsView()` on `EdgePolylines`, `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
16
|
- **Target-Checked Cooperative Execution & TS Contracts**: TypeScript interfaces (`LayoutStorage`, `IterativeSolver`, `LayoutGenerator`, `LayoutTransform`), typed `#[wasm_bindgen]` enums (`TargetKind`, `WeightDtype`, `ManifoldKind`, `TsNetBackend`, `FieldRepulsionBackend`, `ForceBackend`, `MetricTarget`, `SolverStatus`, etc.), `step(layout)`, `runSteps(layout, k)`, `run(layout)`, and `runProgressive(solver, layout, onFrame, options?)`.
|
|
17
|
-
- **Strict `camelCase`, `BigInt` Seeds, `.code` Errors & `f32` CSR**: `number | bigint` 64-bit seeds, structured `Error` `.code` (`EgraphErrorCode`), and strict `WeightDtype.Float32` validation on `
|
|
18
|
-
- **Comprehensive Layout, 3D & Non-Euclidean Engines**: `SgdSolver` (`full`, `randomPair`, `ortmannSparseStress`, `omega`), `StressMajorizationSolver`, `KamadaKawaiSolver`, `MaxentStressSolver`, `TsNetSolver` (`fromKnn`, `fromProbabilities`, `fromGraphPartialBfs`), `TFdpSolver`, `IbUmapSolver`, `GuMapSolver`, `SnapTFdpSolver`, `LargeVisSolver`, `DrGraphSolver`, `GraphCneSolver`, `ForceAtlas2Solver`, `YifanHuSolver`, `LinLogSolver`, `FruchtermanReingoldSolver`, `GemSolver`, `GripSolver`, `Layout3d` + `ArenaOctree3d`, `DynamicKdTree`, `EdgePolylines` + `FdebSolver(polylines)`, `ManifoldLayout2d` (`ManifoldKind.HyperbolicLorentz`, `toPoincareLayout`, `metric()` (`ManifoldMetricRecord`), `torusAutoPan`, geodesic crossings), `LayoutGenerator`s (`ClassicalMds`, `PivotMds`, `Hde`, `RdMds`, `KorenSpectral`, `SfcLayout`), `
|
|
17
|
+
- **Strict `camelCase`, `BigInt` Seeds, `.code` Errors & `f32` CSR**: `number | bigint` 64-bit seeds, structured `Error` `.code` (`EgraphErrorCode`), and strict `WeightDtype.Float32` validation on `Graph`.
|
|
18
|
+
- **Comprehensive Layout, 3D & Non-Euclidean Engines**: `SgdSolver` (`full`, `randomPair`, `ortmannSparseStress`, `omega`), `StressMajorizationSolver`, `KamadaKawaiSolver`, `MaxentStressSolver`, `TsNetSolver` (`fromKnn`, `fromProbabilities`, `fromGraphPartialBfs`), `TFdpSolver`, `IbUmapSolver`, `GuMapSolver`, `SnapTFdpSolver`, `LargeVisSolver`, `DrGraphSolver`, `GraphCneSolver`, `ForceAtlas2Solver`, `YifanHuSolver`, `LinLogSolver`, `FruchtermanReingoldSolver`, `GemSolver`, `GripSolver`, `Layout3d` + `ArenaOctree3d`, `DynamicKdTree`, `EdgePolylines` + `FdebSolver(polylines)`, `ManifoldLayout2d` (`ManifoldKind.HyperbolicLorentz`, `toPoincareLayout`, `metric()` (`ManifoldMetricRecord`), `torusAutoPan`, geodesic crossings), `LayoutGenerator`s (`ClassicalMds`, `PivotMds`, `Hde`, `RdMds`, `KorenSpectral`, `SfcLayout`), `PfsPrimeOverlapRemoval`, `MetricReport` (`toRecord()`), `listDatasets` / synthetic generators, and `DijkstraWorkspace`.
|
|
19
19
|
|
|
20
20
|
## Quick Start (Browser / Bundler ESM)
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
23
|
import init, {
|
|
24
|
-
|
|
24
|
+
Graph,
|
|
25
25
|
FieldRepulsionBackend,
|
|
26
26
|
MetricTarget,
|
|
27
27
|
PivotMds,
|
|
@@ -35,13 +35,14 @@ await init();
|
|
|
35
35
|
// Build an undirected CSR graph (0 - 1 - 2 - 3 - 0)
|
|
36
36
|
const indptr = new Uint32Array([0, 2, 4, 6, 8]);
|
|
37
37
|
const indices = new Uint32Array([1, 3, 0, 2, 1, 3, 2, 0]);
|
|
38
|
-
const graph =
|
|
38
|
+
const graph = Graph.fromCsr(indptr, indices);
|
|
39
39
|
|
|
40
40
|
// Initialize with normalized PivotMDS (f32 Layout2d)
|
|
41
41
|
const layout = new PivotMds({ numPivots: 4, seed: 42 }).generate(graph);
|
|
42
42
|
|
|
43
|
-
// Run t-FDP (Zhong et al.,
|
|
43
|
+
// Run t-FDP (Zhong et al., 2024) progressively in requestAnimationFrame
|
|
44
44
|
const solver = new TFdpSolver(graph, {
|
|
45
|
+
alpha: 0.1,
|
|
45
46
|
backend: FieldRepulsionBackend.IbFft,
|
|
46
47
|
iterations: 200,
|
|
47
48
|
seed: 42,
|
|
@@ -71,13 +72,14 @@ console.log(report.toRecord());
|
|
|
71
72
|
The same `"egraph"` import automatically resolves to the Node ESM loader via `"exports"`:
|
|
72
73
|
|
|
73
74
|
```js
|
|
74
|
-
import init, {
|
|
75
|
+
import init, { Graph, FieldRepulsionBackend, PivotMds, TFdpSolver } from "egraph";
|
|
75
76
|
|
|
76
77
|
await init();
|
|
77
78
|
|
|
78
|
-
const graph =
|
|
79
|
+
const graph = Graph.fromEdgeList(4, new Uint32Array([0, 1, 1, 2, 2, 3, 3, 0]));
|
|
79
80
|
const layout = new PivotMds({ numPivots: 4, seed: 42 }).generate(graph);
|
|
80
81
|
const solver = new TFdpSolver(graph, {
|
|
82
|
+
alpha: 0.1,
|
|
81
83
|
backend: FieldRepulsionBackend.IbFft,
|
|
82
84
|
iterations: 200,
|
|
83
85
|
seed: 42,
|
|
@@ -90,7 +92,7 @@ console.log(Array.from(xy));
|
|
|
90
92
|
|
|
91
93
|
## Solver & Engine Examples
|
|
92
94
|
|
|
93
|
-
###
|
|
95
|
+
### Neighborhood, Force & Embedding Models
|
|
94
96
|
|
|
95
97
|
```js
|
|
96
98
|
import {
|
|
@@ -104,7 +106,7 @@ import {
|
|
|
104
106
|
TsNetSolver,
|
|
105
107
|
} from "egraph";
|
|
106
108
|
|
|
107
|
-
// tsNET from Partial BFS k-NN (
|
|
109
|
+
// tsNET from Partial BFS k-NN (Meidiana et al., 2025)
|
|
108
110
|
const tsnet = TsNetSolver.fromGraphPartialBfs(graph, {
|
|
109
111
|
k: 4,
|
|
110
112
|
uniformPerplexity: 3.0,
|
|
@@ -113,15 +115,16 @@ const tsnet = TsNetSolver.fromGraphPartialBfs(graph, {
|
|
|
113
115
|
});
|
|
114
116
|
tsnet.run(layout);
|
|
115
117
|
|
|
116
|
-
// t-FDP with ibFFT repulsion (Zhong et al.,
|
|
118
|
+
// t-FDP with ibFFT repulsion (Zhong et al., 2024)
|
|
117
119
|
const tfdp = new TFdpSolver(graph, {
|
|
120
|
+
alpha: 0.1,
|
|
118
121
|
backend: FieldRepulsionBackend.IbFft,
|
|
119
122
|
iterations: 200,
|
|
120
123
|
seed: 42,
|
|
121
124
|
});
|
|
122
125
|
tfdp.run(layout);
|
|
123
126
|
|
|
124
|
-
// ForceAtlas2 with Barnes
|
|
127
|
+
// ForceAtlas2 with Barnes–Hut (Jacomy et al., 2014)
|
|
125
128
|
const fa2 = new ForceAtlas2Solver(graph, {
|
|
126
129
|
backend: ForceBackend.BarnesHut,
|
|
127
130
|
iterations: 200,
|
|
@@ -183,7 +186,7 @@ await runProgressive(
|
|
|
183
186
|
const poincare = lorentz.toPoincareLayout();
|
|
184
187
|
console.log("geodesicDistortion:", geodesicDistortion(graph, poincare));
|
|
185
188
|
|
|
186
|
-
// Torus layout + optimal boundary auto-pan (Chen et al.,
|
|
189
|
+
// Torus layout + optimal boundary auto-pan (Chen et al., 2020)
|
|
187
190
|
const torus = ManifoldLayout2d.init(ManifoldKind.Torus2d, graph.numNodes(), { seed: 42 });
|
|
188
191
|
SgdSolver.full(graph, { target: TargetKind.Manifold2d, iterations: 60, seed: 42 }).run(torus);
|
|
189
192
|
const panned = torus.torusAutoPan(graph);
|
|
@@ -263,7 +266,7 @@ console.log(dists.length, mdsNd.dims, mds3d.len(), mds2d.numNodes, mds2dFn.numNo
|
|
|
263
266
|
|
|
264
267
|
## Migration & Literature Attribution
|
|
265
268
|
|
|
266
|
-
See [docs/MIGRATION_V6.md](https://github.com/likr/egraph-rs/blob/master/docs/MIGRATION_V6.md) for upgrading from v5, earlier v6 prereleases, and string-based modes to typed enums,
|
|
269
|
+
See [docs/MIGRATION_V6.md](https://github.com/likr/egraph-rs/blob/master/docs/MIGRATION_V6.md) for upgrading from v5, earlier v6 prereleases, and string-based modes to typed enums, [docs/PAPER_MAPPING.md](https://github.com/likr/egraph-rs/blob/master/docs/PAPER_MAPPING.md) for the complete algorithm-to-literature mapping table, and [docs/UNIMPLEMENTED_PAPERS.md](https://github.com/likr/egraph-rs/blob/master/docs/UNIMPLEMENTED_PAPERS.md) for major graph-drawing literature not yet implemented.
|
|
267
270
|
|
|
268
271
|
## License
|
|
269
272
|
|
package/package.json
CHANGED
package/pkg/README.md
CHANGED
|
@@ -14,14 +14,14 @@ npm install egraph
|
|
|
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
15
|
- **Zero-Copy Linear Memory Views**: `coordsView()` on `Layout2d`, `Layout3d`, `LayoutNd`, and `ManifoldLayout2d` (plus `edgeOffsetsView()` / `pointsView()` on `EdgePolylines`, `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
16
|
- **Target-Checked Cooperative Execution & TS Contracts**: TypeScript interfaces (`LayoutStorage`, `IterativeSolver`, `LayoutGenerator`, `LayoutTransform`), typed `#[wasm_bindgen]` enums (`TargetKind`, `WeightDtype`, `ManifoldKind`, `TsNetBackend`, `FieldRepulsionBackend`, `ForceBackend`, `MetricTarget`, `SolverStatus`, etc.), `step(layout)`, `runSteps(layout, k)`, `run(layout)`, and `runProgressive(solver, layout, onFrame, options?)`.
|
|
17
|
-
- **Strict `camelCase`, `BigInt` Seeds, `.code` Errors & `f32` CSR**: `number | bigint` 64-bit seeds, structured `Error` `.code` (`EgraphErrorCode`), and strict `WeightDtype.Float32` validation on `
|
|
18
|
-
- **Comprehensive Layout, 3D & Non-Euclidean Engines**: `SgdSolver` (`full`, `randomPair`, `ortmannSparseStress`, `omega`), `StressMajorizationSolver`, `KamadaKawaiSolver`, `MaxentStressSolver`, `TsNetSolver` (`fromKnn`, `fromProbabilities`, `fromGraphPartialBfs`), `TFdpSolver`, `IbUmapSolver`, `GuMapSolver`, `SnapTFdpSolver`, `LargeVisSolver`, `DrGraphSolver`, `GraphCneSolver`, `ForceAtlas2Solver`, `YifanHuSolver`, `LinLogSolver`, `FruchtermanReingoldSolver`, `GemSolver`, `GripSolver`, `Layout3d` + `ArenaOctree3d`, `DynamicKdTree`, `EdgePolylines` + `FdebSolver(polylines)`, `ManifoldLayout2d` (`ManifoldKind.HyperbolicLorentz`, `toPoincareLayout`, `metric()` (`ManifoldMetricRecord`), `torusAutoPan`, geodesic crossings), `LayoutGenerator`s (`ClassicalMds`, `PivotMds`, `Hde`, `RdMds`, `KorenSpectral`, `SfcLayout`), `
|
|
17
|
+
- **Strict `camelCase`, `BigInt` Seeds, `.code` Errors & `f32` CSR**: `number | bigint` 64-bit seeds, structured `Error` `.code` (`EgraphErrorCode`), and strict `WeightDtype.Float32` validation on `Graph`.
|
|
18
|
+
- **Comprehensive Layout, 3D & Non-Euclidean Engines**: `SgdSolver` (`full`, `randomPair`, `ortmannSparseStress`, `omega`), `StressMajorizationSolver`, `KamadaKawaiSolver`, `MaxentStressSolver`, `TsNetSolver` (`fromKnn`, `fromProbabilities`, `fromGraphPartialBfs`), `TFdpSolver`, `IbUmapSolver`, `GuMapSolver`, `SnapTFdpSolver`, `LargeVisSolver`, `DrGraphSolver`, `GraphCneSolver`, `ForceAtlas2Solver`, `YifanHuSolver`, `LinLogSolver`, `FruchtermanReingoldSolver`, `GemSolver`, `GripSolver`, `Layout3d` + `ArenaOctree3d`, `DynamicKdTree`, `EdgePolylines` + `FdebSolver(polylines)`, `ManifoldLayout2d` (`ManifoldKind.HyperbolicLorentz`, `toPoincareLayout`, `metric()` (`ManifoldMetricRecord`), `torusAutoPan`, geodesic crossings), `LayoutGenerator`s (`ClassicalMds`, `PivotMds`, `Hde`, `RdMds`, `KorenSpectral`, `SfcLayout`), `PfsPrimeOverlapRemoval`, `MetricReport` (`toRecord()`), `listDatasets` / synthetic generators, and `DijkstraWorkspace`.
|
|
19
19
|
|
|
20
20
|
## Quick Start (Browser / Bundler ESM)
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
23
|
import init, {
|
|
24
|
-
|
|
24
|
+
Graph,
|
|
25
25
|
FieldRepulsionBackend,
|
|
26
26
|
MetricTarget,
|
|
27
27
|
PivotMds,
|
|
@@ -35,13 +35,14 @@ await init();
|
|
|
35
35
|
// Build an undirected CSR graph (0 - 1 - 2 - 3 - 0)
|
|
36
36
|
const indptr = new Uint32Array([0, 2, 4, 6, 8]);
|
|
37
37
|
const indices = new Uint32Array([1, 3, 0, 2, 1, 3, 2, 0]);
|
|
38
|
-
const graph =
|
|
38
|
+
const graph = Graph.fromCsr(indptr, indices);
|
|
39
39
|
|
|
40
40
|
// Initialize with normalized PivotMDS (f32 Layout2d)
|
|
41
41
|
const layout = new PivotMds({ numPivots: 4, seed: 42 }).generate(graph);
|
|
42
42
|
|
|
43
|
-
// Run t-FDP (Zhong et al.,
|
|
43
|
+
// Run t-FDP (Zhong et al., 2024) progressively in requestAnimationFrame
|
|
44
44
|
const solver = new TFdpSolver(graph, {
|
|
45
|
+
alpha: 0.1,
|
|
45
46
|
backend: FieldRepulsionBackend.IbFft,
|
|
46
47
|
iterations: 200,
|
|
47
48
|
seed: 42,
|
|
@@ -71,13 +72,14 @@ console.log(report.toRecord());
|
|
|
71
72
|
The same `"egraph"` import automatically resolves to the Node ESM loader via `"exports"`:
|
|
72
73
|
|
|
73
74
|
```js
|
|
74
|
-
import init, {
|
|
75
|
+
import init, { Graph, FieldRepulsionBackend, PivotMds, TFdpSolver } from "egraph";
|
|
75
76
|
|
|
76
77
|
await init();
|
|
77
78
|
|
|
78
|
-
const graph =
|
|
79
|
+
const graph = Graph.fromEdgeList(4, new Uint32Array([0, 1, 1, 2, 2, 3, 3, 0]));
|
|
79
80
|
const layout = new PivotMds({ numPivots: 4, seed: 42 }).generate(graph);
|
|
80
81
|
const solver = new TFdpSolver(graph, {
|
|
82
|
+
alpha: 0.1,
|
|
81
83
|
backend: FieldRepulsionBackend.IbFft,
|
|
82
84
|
iterations: 200,
|
|
83
85
|
seed: 42,
|
|
@@ -90,7 +92,7 @@ console.log(Array.from(xy));
|
|
|
90
92
|
|
|
91
93
|
## Solver & Engine Examples
|
|
92
94
|
|
|
93
|
-
###
|
|
95
|
+
### Neighborhood, Force & Embedding Models
|
|
94
96
|
|
|
95
97
|
```js
|
|
96
98
|
import {
|
|
@@ -104,7 +106,7 @@ import {
|
|
|
104
106
|
TsNetSolver,
|
|
105
107
|
} from "egraph";
|
|
106
108
|
|
|
107
|
-
// tsNET from Partial BFS k-NN (
|
|
109
|
+
// tsNET from Partial BFS k-NN (Meidiana et al., 2025)
|
|
108
110
|
const tsnet = TsNetSolver.fromGraphPartialBfs(graph, {
|
|
109
111
|
k: 4,
|
|
110
112
|
uniformPerplexity: 3.0,
|
|
@@ -113,15 +115,16 @@ const tsnet = TsNetSolver.fromGraphPartialBfs(graph, {
|
|
|
113
115
|
});
|
|
114
116
|
tsnet.run(layout);
|
|
115
117
|
|
|
116
|
-
// t-FDP with ibFFT repulsion (Zhong et al.,
|
|
118
|
+
// t-FDP with ibFFT repulsion (Zhong et al., 2024)
|
|
117
119
|
const tfdp = new TFdpSolver(graph, {
|
|
120
|
+
alpha: 0.1,
|
|
118
121
|
backend: FieldRepulsionBackend.IbFft,
|
|
119
122
|
iterations: 200,
|
|
120
123
|
seed: 42,
|
|
121
124
|
});
|
|
122
125
|
tfdp.run(layout);
|
|
123
126
|
|
|
124
|
-
// ForceAtlas2 with Barnes
|
|
127
|
+
// ForceAtlas2 with Barnes–Hut (Jacomy et al., 2014)
|
|
125
128
|
const fa2 = new ForceAtlas2Solver(graph, {
|
|
126
129
|
backend: ForceBackend.BarnesHut,
|
|
127
130
|
iterations: 200,
|
|
@@ -183,7 +186,7 @@ await runProgressive(
|
|
|
183
186
|
const poincare = lorentz.toPoincareLayout();
|
|
184
187
|
console.log("geodesicDistortion:", geodesicDistortion(graph, poincare));
|
|
185
188
|
|
|
186
|
-
// Torus layout + optimal boundary auto-pan (Chen et al.,
|
|
189
|
+
// Torus layout + optimal boundary auto-pan (Chen et al., 2020)
|
|
187
190
|
const torus = ManifoldLayout2d.init(ManifoldKind.Torus2d, graph.numNodes(), { seed: 42 });
|
|
188
191
|
SgdSolver.full(graph, { target: TargetKind.Manifold2d, iterations: 60, seed: 42 }).run(torus);
|
|
189
192
|
const panned = torus.torusAutoPan(graph);
|
|
@@ -263,7 +266,7 @@ console.log(dists.length, mdsNd.dims, mds3d.len(), mds2d.numNodes, mds2dFn.numNo
|
|
|
263
266
|
|
|
264
267
|
## Migration & Literature Attribution
|
|
265
268
|
|
|
266
|
-
See [docs/MIGRATION_V6.md](https://github.com/likr/egraph-rs/blob/master/docs/MIGRATION_V6.md) for upgrading from v5, earlier v6 prereleases, and string-based modes to typed enums,
|
|
269
|
+
See [docs/MIGRATION_V6.md](https://github.com/likr/egraph-rs/blob/master/docs/MIGRATION_V6.md) for upgrading from v5, earlier v6 prereleases, and string-based modes to typed enums, [docs/PAPER_MAPPING.md](https://github.com/likr/egraph-rs/blob/master/docs/PAPER_MAPPING.md) for the complete algorithm-to-literature mapping table, and [docs/UNIMPLEMENTED_PAPERS.md](https://github.com/likr/egraph-rs/blob/master/docs/UNIMPLEMENTED_PAPERS.md) for major graph-drawing literature not yet implemented.
|
|
267
270
|
|
|
268
271
|
## License
|
|
269
272
|
|