egraph 5.0.0 → 6.0.0-alpha.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/dist/bundler/LICENSE +21 -0
- package/dist/bundler/README.md +161 -0
- package/dist/no-modules/LICENSE +21 -0
- package/dist/no-modules/README.md +161 -0
- package/dist/nodejs/LICENSE +21 -0
- package/dist/nodejs/README.md +161 -0
- package/dist/web/LICENSE +21 -0
- package/dist/web/README.md +161 -0
- package/package.json +1 -1
- package/dist/bundler/egraph_wasm.d.ts +0 -228
- package/dist/bundler/egraph_wasm.js +0 -2
- package/dist/bundler/egraph_wasm_bg.wasm +0 -0
- package/dist/no-modules/egraph_wasm.d.ts +0 -298
- package/dist/no-modules/egraph_wasm.js +0 -834
- package/dist/no-modules/egraph_wasm_bg.wasm +0 -0
- package/dist/nodejs/egraph_wasm.d.ts +0 -228
- package/dist/nodejs/egraph_wasm.js +0 -798
- package/dist/nodejs/egraph_wasm_bg.wasm +0 -0
- package/dist/web/egraph_wasm.d.ts +0 -298
- package/dist/web/egraph_wasm.js +0 -819
- package/dist/web/egraph_wasm_bg.wasm +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# egraph
|
|
2
|
+
|
|
3
|
+
egraph is a fast graph drawing library implemented in Rust and WebAssembly.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```shell-session
|
|
8
|
+
$ npm install egraph
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import { Graph } from 'egraph'
|
|
15
|
+
import {
|
|
16
|
+
Simulation,
|
|
17
|
+
ManyBodyForce,
|
|
18
|
+
LinkForce,
|
|
19
|
+
CenterForce
|
|
20
|
+
} from 'egraph/layout/force-directed'
|
|
21
|
+
|
|
22
|
+
// creating a graph
|
|
23
|
+
const graph = new Graph()
|
|
24
|
+
|
|
25
|
+
// adding vertices
|
|
26
|
+
graph.addNode(0)
|
|
27
|
+
graph.addNode(1)
|
|
28
|
+
graph.addNode(2)
|
|
29
|
+
|
|
30
|
+
// adding edges
|
|
31
|
+
graph.addEdge(0, 1)
|
|
32
|
+
graph.addEdge(0, 2)
|
|
33
|
+
graph.addEdge(1, 2)
|
|
34
|
+
|
|
35
|
+
// creating forces
|
|
36
|
+
const manyBodyForce = new ManyBodyForce()
|
|
37
|
+
const linkForce = new LinkForce()
|
|
38
|
+
const centerForce = new CenterForce()
|
|
39
|
+
|
|
40
|
+
// creating simulation
|
|
41
|
+
const simulation = new Simulation()
|
|
42
|
+
simulation.add(manyBodyForce)
|
|
43
|
+
simulation.add(linkForce)
|
|
44
|
+
simulation.add(centerForce)
|
|
45
|
+
|
|
46
|
+
// position calculation
|
|
47
|
+
const layout = simulation.start(graph)
|
|
48
|
+
|
|
49
|
+
// printing result
|
|
50
|
+
for (const u of graph.nodes()) {
|
|
51
|
+
console.log(layout.nodes[u])
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
egraph-wasm is implemented using wasm-bindgen.
|
|
56
|
+
For more detailed usage, please read [wasm-bindgen document](https://rustwasm.github.io/wasm-bindgen/).
|
|
57
|
+
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
### Drawing SVG with React.js
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
import React from 'react'
|
|
64
|
+
import { render } from 'react-dom'
|
|
65
|
+
import { Graph } from 'egraph'
|
|
66
|
+
import {
|
|
67
|
+
Simulation,
|
|
68
|
+
ManyBodyForce,
|
|
69
|
+
LinkForce,
|
|
70
|
+
CenterForce
|
|
71
|
+
} from 'egraph/layout/force-directed'
|
|
72
|
+
|
|
73
|
+
const graph = new Graph()
|
|
74
|
+
graph.addNode(0)
|
|
75
|
+
graph.addNode(1)
|
|
76
|
+
graph.addNode(2)
|
|
77
|
+
graph.addEdge(0, 1)
|
|
78
|
+
graph.addEdge(0, 2)
|
|
79
|
+
graph.addEdge(1, 2)
|
|
80
|
+
|
|
81
|
+
const manyBodyForce = new ManyBodyForce()
|
|
82
|
+
const linkForce = new LinkForce()
|
|
83
|
+
linkForce.distance = () => 200
|
|
84
|
+
const centerForce = new CenterForce()
|
|
85
|
+
|
|
86
|
+
const simulation = new Simulation()
|
|
87
|
+
simulation.add(manyBodyForce)
|
|
88
|
+
simulation.add(linkForce)
|
|
89
|
+
simulation.add(centerForce)
|
|
90
|
+
|
|
91
|
+
const layout = simulation.start(graph)
|
|
92
|
+
|
|
93
|
+
const width = 600
|
|
94
|
+
const height = 400
|
|
95
|
+
render(
|
|
96
|
+
<div>
|
|
97
|
+
<svg width={width} height={height}>
|
|
98
|
+
<g transform={`translate(${width / 2},${height / 2})`}>
|
|
99
|
+
<g>
|
|
100
|
+
{Array.from(graph.edges()).map(([u, v]) => {
|
|
101
|
+
const { x: x0, y: y0 } = positions[u]
|
|
102
|
+
const { x: x1, y: y1 } = positions[v]
|
|
103
|
+
return (
|
|
104
|
+
<g key={e}>
|
|
105
|
+
<path d={`M ${x0} ${y0} L ${x1} ${y1}`} stroke='#000' />
|
|
106
|
+
</g>
|
|
107
|
+
)
|
|
108
|
+
})}
|
|
109
|
+
</g>
|
|
110
|
+
<g>
|
|
111
|
+
{Array.from(graph.nodes()).map((u) => {
|
|
112
|
+
const { x, y } = positions[u]
|
|
113
|
+
return (
|
|
114
|
+
<g key={i} transform={`translate(${x},${y})`}>
|
|
115
|
+
<circle r='10' fill='#000' />
|
|
116
|
+
</g>
|
|
117
|
+
)
|
|
118
|
+
})}
|
|
119
|
+
</g>
|
|
120
|
+
</g>
|
|
121
|
+
</svg>
|
|
122
|
+
</div>,
|
|
123
|
+
document.querySelector('#display')
|
|
124
|
+
)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Loading JSON
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
import { Graph } from 'egraph'
|
|
131
|
+
import {
|
|
132
|
+
Simulation,
|
|
133
|
+
ManyBodyForce,
|
|
134
|
+
LinkForce,
|
|
135
|
+
CenterForce
|
|
136
|
+
} from 'egraph/layout/force-directed'
|
|
137
|
+
;(async () => {
|
|
138
|
+
const request = await fetch('miserables.json')
|
|
139
|
+
const data = await request.json()
|
|
140
|
+
|
|
141
|
+
const { Graph } = mod
|
|
142
|
+
const graph = new Graph()
|
|
143
|
+
for (const node of data.nodes) {
|
|
144
|
+
graph.addNode(node.id, node)
|
|
145
|
+
}
|
|
146
|
+
for (const link of data.links) {
|
|
147
|
+
graph.addEdge(link.source, link.target, link)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
for (const u of graph.nodes()) {
|
|
151
|
+
console.log(graph.node(u))
|
|
152
|
+
}
|
|
153
|
+
for (const [u, v] of graph.edges()) {
|
|
154
|
+
console.log(graph.edge(u, v))
|
|
155
|
+
}
|
|
156
|
+
})()
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* @param {Graph} graph
|
|
5
|
-
* @returns {any}
|
|
6
|
-
*/
|
|
7
|
-
export function initialPlacement(graph: Graph): any;
|
|
8
|
-
/**
|
|
9
|
-
* @param {Graph} graph
|
|
10
|
-
* @returns {Array<any>}
|
|
11
|
-
*/
|
|
12
|
-
export function forceConnected(graph: Graph): Array<any>;
|
|
13
|
-
/**
|
|
14
|
-
* @param {Graph} graph
|
|
15
|
-
* @returns {Array<any>}
|
|
16
|
-
*/
|
|
17
|
-
export function forceNonconnected(graph: Graph): Array<any>;
|
|
18
|
-
/**
|
|
19
|
-
* @param {Graph} graph
|
|
20
|
-
* @param {Function} group_accessor
|
|
21
|
-
* @returns {Array<any>}
|
|
22
|
-
*/
|
|
23
|
-
export function forceGrouped(graph: Graph, group_accessor: Function): Array<any>;
|
|
24
|
-
/**
|
|
25
|
-
* @param {Graph} graph
|
|
26
|
-
* @param {any} coordinates
|
|
27
|
-
* @param {Function} _length
|
|
28
|
-
* @param {number} eps
|
|
29
|
-
* @param {number} width
|
|
30
|
-
* @param {number} height
|
|
31
|
-
* @returns {any}
|
|
32
|
-
*/
|
|
33
|
-
export function kamadaKawai(graph: Graph, coordinates: any, _length: Function, eps: number, width: number, height: number): any;
|
|
34
|
-
/**
|
|
35
|
-
* @param {Graph} graph
|
|
36
|
-
* @param {number} min_size
|
|
37
|
-
* @param {number} step_iteration
|
|
38
|
-
* @param {Function} _shrink_node
|
|
39
|
-
* @param {Function} _shrink_edge
|
|
40
|
-
* @param {Function} _link_distance_accessor
|
|
41
|
-
* @returns {any}
|
|
42
|
-
*/
|
|
43
|
-
export function fm3(graph: Graph, min_size: number, step_iteration: number, _shrink_node: Function, _shrink_edge: Function, _link_distance_accessor: Function): any;
|
|
44
|
-
/**
|
|
45
|
-
* @param {Graph} graph
|
|
46
|
-
* @param {any} coordinates
|
|
47
|
-
* @returns {any}
|
|
48
|
-
*/
|
|
49
|
-
export function fdeb(graph: Graph, coordinates: any): any;
|
|
50
|
-
/**
|
|
51
|
-
*/
|
|
52
|
-
export class CenterForce {
|
|
53
|
-
free(): void;
|
|
54
|
-
/**
|
|
55
|
-
*/
|
|
56
|
-
constructor();
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
*/
|
|
60
|
-
export class Force {
|
|
61
|
-
free(): void;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
*/
|
|
65
|
-
export class Graph {
|
|
66
|
-
free(): void;
|
|
67
|
-
/**
|
|
68
|
-
*/
|
|
69
|
-
constructor();
|
|
70
|
-
/**
|
|
71
|
-
* @returns {number}
|
|
72
|
-
*/
|
|
73
|
-
nodeCount(): number;
|
|
74
|
-
/**
|
|
75
|
-
* @returns {number}
|
|
76
|
-
*/
|
|
77
|
-
edgeCount(): number;
|
|
78
|
-
/**
|
|
79
|
-
* @param {any} value
|
|
80
|
-
* @returns {number}
|
|
81
|
-
*/
|
|
82
|
-
addNode(value: any): number;
|
|
83
|
-
/**
|
|
84
|
-
* @param {number} a
|
|
85
|
-
* @returns {any}
|
|
86
|
-
*/
|
|
87
|
-
nodeWeight(a: number): any;
|
|
88
|
-
/**
|
|
89
|
-
* @param {number} a
|
|
90
|
-
* @param {number} b
|
|
91
|
-
* @param {any} value
|
|
92
|
-
* @returns {number}
|
|
93
|
-
*/
|
|
94
|
-
addEdge(a: number, b: number, value: any): number;
|
|
95
|
-
/**
|
|
96
|
-
* @param {number} e
|
|
97
|
-
* @returns {any}
|
|
98
|
-
*/
|
|
99
|
-
edgeWeight(e: number): any;
|
|
100
|
-
/**
|
|
101
|
-
* @param {number} e
|
|
102
|
-
* @returns {Array<any>}
|
|
103
|
-
*/
|
|
104
|
-
edgeEndpoints(e: number): Array<any>;
|
|
105
|
-
/**
|
|
106
|
-
* @param {number} a
|
|
107
|
-
* @returns {any}
|
|
108
|
-
*/
|
|
109
|
-
removeNode(a: number): any;
|
|
110
|
-
/**
|
|
111
|
-
* @param {number} e
|
|
112
|
-
* @returns {any}
|
|
113
|
-
*/
|
|
114
|
-
removeEdge(e: number): any;
|
|
115
|
-
/**
|
|
116
|
-
* @param {number} a
|
|
117
|
-
* @returns {Array<any>}
|
|
118
|
-
*/
|
|
119
|
-
neighbors(a: number): Array<any>;
|
|
120
|
-
/**
|
|
121
|
-
* @param {number} a
|
|
122
|
-
* @param {number} dir
|
|
123
|
-
* @returns {Array<any>}
|
|
124
|
-
*/
|
|
125
|
-
neighborsDirected(a: number, dir: number): Array<any>;
|
|
126
|
-
/**
|
|
127
|
-
* @param {number} a
|
|
128
|
-
* @returns {Array<any>}
|
|
129
|
-
*/
|
|
130
|
-
neighborsUndirected(a: number): Array<any>;
|
|
131
|
-
/**
|
|
132
|
-
* @param {number} a
|
|
133
|
-
* @returns {Array<any>}
|
|
134
|
-
*/
|
|
135
|
-
edges(a: number): Array<any>;
|
|
136
|
-
/**
|
|
137
|
-
* @param {number} a
|
|
138
|
-
* @param {number} b
|
|
139
|
-
* @returns {boolean}
|
|
140
|
-
*/
|
|
141
|
-
containsEdge(a: number, b: number): boolean;
|
|
142
|
-
/**
|
|
143
|
-
* @param {number} a
|
|
144
|
-
* @param {number} b
|
|
145
|
-
* @returns {number}
|
|
146
|
-
*/
|
|
147
|
-
findEdge(a: number, b: number): number;
|
|
148
|
-
/**
|
|
149
|
-
* @param {number} dir
|
|
150
|
-
* @returns {Array<any>}
|
|
151
|
-
*/
|
|
152
|
-
externals(dir: number): Array<any>;
|
|
153
|
-
/**
|
|
154
|
-
* @returns {Array<any>}
|
|
155
|
-
*/
|
|
156
|
-
nodeIndices(): Array<any>;
|
|
157
|
-
/**
|
|
158
|
-
* @returns {Array<any>}
|
|
159
|
-
*/
|
|
160
|
-
edgeIndices(): Array<any>;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
*/
|
|
164
|
-
export class LinkForce {
|
|
165
|
-
free(): void;
|
|
166
|
-
/**
|
|
167
|
-
* @param {Graph} graph
|
|
168
|
-
*/
|
|
169
|
-
constructor(graph: Graph);
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
*/
|
|
173
|
-
export class ManyBodyForce {
|
|
174
|
-
free(): void;
|
|
175
|
-
/**
|
|
176
|
-
* @param {Graph} graph
|
|
177
|
-
*/
|
|
178
|
-
constructor(graph: Graph);
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
*/
|
|
182
|
-
export class Simulation {
|
|
183
|
-
free(): void;
|
|
184
|
-
/**
|
|
185
|
-
* @param {Graph} graph
|
|
186
|
-
* @param {Function} f
|
|
187
|
-
*/
|
|
188
|
-
constructor(graph: Graph, f: Function);
|
|
189
|
-
/**
|
|
190
|
-
* @param {any[]} js_forces
|
|
191
|
-
* @returns {any}
|
|
192
|
-
*/
|
|
193
|
-
run(js_forces: any[]): any;
|
|
194
|
-
/**
|
|
195
|
-
* @param {number} n
|
|
196
|
-
* @param {any[]} js_forces
|
|
197
|
-
* @returns {any}
|
|
198
|
-
*/
|
|
199
|
-
runStep(n: number, js_forces: any[]): any;
|
|
200
|
-
/**
|
|
201
|
-
* @returns {boolean}
|
|
202
|
-
*/
|
|
203
|
-
isFinished(): boolean;
|
|
204
|
-
/**
|
|
205
|
-
* @param {number} alpha_start
|
|
206
|
-
*/
|
|
207
|
-
reset(alpha_start: number): void;
|
|
208
|
-
/**
|
|
209
|
-
* @returns {number}
|
|
210
|
-
*/
|
|
211
|
-
alphaMin: number;
|
|
212
|
-
/**
|
|
213
|
-
* @returns {number}
|
|
214
|
-
*/
|
|
215
|
-
alphaStart: number;
|
|
216
|
-
/**
|
|
217
|
-
* @returns {number}
|
|
218
|
-
*/
|
|
219
|
-
alphaTarget: number;
|
|
220
|
-
/**
|
|
221
|
-
* @returns {number}
|
|
222
|
-
*/
|
|
223
|
-
iterations: number;
|
|
224
|
-
/**
|
|
225
|
-
* @returns {number}
|
|
226
|
-
*/
|
|
227
|
-
velocityDecay: number;
|
|
228
|
-
}
|
|
Binary file
|
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* @param {Graph} graph
|
|
5
|
-
* @returns {any}
|
|
6
|
-
*/
|
|
7
|
-
export function initialPlacement(graph: Graph): any;
|
|
8
|
-
/**
|
|
9
|
-
* @param {Graph} graph
|
|
10
|
-
* @returns {Array<any>}
|
|
11
|
-
*/
|
|
12
|
-
export function forceConnected(graph: Graph): Array<any>;
|
|
13
|
-
/**
|
|
14
|
-
* @param {Graph} graph
|
|
15
|
-
* @returns {Array<any>}
|
|
16
|
-
*/
|
|
17
|
-
export function forceNonconnected(graph: Graph): Array<any>;
|
|
18
|
-
/**
|
|
19
|
-
* @param {Graph} graph
|
|
20
|
-
* @param {Function} group_accessor
|
|
21
|
-
* @returns {Array<any>}
|
|
22
|
-
*/
|
|
23
|
-
export function forceGrouped(graph: Graph, group_accessor: Function): Array<any>;
|
|
24
|
-
/**
|
|
25
|
-
* @param {Graph} graph
|
|
26
|
-
* @param {any} coordinates
|
|
27
|
-
* @param {Function} _length
|
|
28
|
-
* @param {number} eps
|
|
29
|
-
* @param {number} width
|
|
30
|
-
* @param {number} height
|
|
31
|
-
* @returns {any}
|
|
32
|
-
*/
|
|
33
|
-
export function kamadaKawai(graph: Graph, coordinates: any, _length: Function, eps: number, width: number, height: number): any;
|
|
34
|
-
/**
|
|
35
|
-
* @param {Graph} graph
|
|
36
|
-
* @param {number} min_size
|
|
37
|
-
* @param {number} step_iteration
|
|
38
|
-
* @param {Function} _shrink_node
|
|
39
|
-
* @param {Function} _shrink_edge
|
|
40
|
-
* @param {Function} _link_distance_accessor
|
|
41
|
-
* @returns {any}
|
|
42
|
-
*/
|
|
43
|
-
export function fm3(graph: Graph, min_size: number, step_iteration: number, _shrink_node: Function, _shrink_edge: Function, _link_distance_accessor: Function): any;
|
|
44
|
-
/**
|
|
45
|
-
* @param {Graph} graph
|
|
46
|
-
* @param {any} coordinates
|
|
47
|
-
* @returns {any}
|
|
48
|
-
*/
|
|
49
|
-
export function fdeb(graph: Graph, coordinates: any): any;
|
|
50
|
-
/**
|
|
51
|
-
*/
|
|
52
|
-
export class CenterForce {
|
|
53
|
-
free(): void;
|
|
54
|
-
/**
|
|
55
|
-
*/
|
|
56
|
-
constructor();
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
*/
|
|
60
|
-
export class Force {
|
|
61
|
-
free(): void;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
*/
|
|
65
|
-
export class Graph {
|
|
66
|
-
free(): void;
|
|
67
|
-
/**
|
|
68
|
-
*/
|
|
69
|
-
constructor();
|
|
70
|
-
/**
|
|
71
|
-
* @returns {number}
|
|
72
|
-
*/
|
|
73
|
-
nodeCount(): number;
|
|
74
|
-
/**
|
|
75
|
-
* @returns {number}
|
|
76
|
-
*/
|
|
77
|
-
edgeCount(): number;
|
|
78
|
-
/**
|
|
79
|
-
* @param {any} value
|
|
80
|
-
* @returns {number}
|
|
81
|
-
*/
|
|
82
|
-
addNode(value: any): number;
|
|
83
|
-
/**
|
|
84
|
-
* @param {number} a
|
|
85
|
-
* @returns {any}
|
|
86
|
-
*/
|
|
87
|
-
nodeWeight(a: number): any;
|
|
88
|
-
/**
|
|
89
|
-
* @param {number} a
|
|
90
|
-
* @param {number} b
|
|
91
|
-
* @param {any} value
|
|
92
|
-
* @returns {number}
|
|
93
|
-
*/
|
|
94
|
-
addEdge(a: number, b: number, value: any): number;
|
|
95
|
-
/**
|
|
96
|
-
* @param {number} e
|
|
97
|
-
* @returns {any}
|
|
98
|
-
*/
|
|
99
|
-
edgeWeight(e: number): any;
|
|
100
|
-
/**
|
|
101
|
-
* @param {number} e
|
|
102
|
-
* @returns {Array<any>}
|
|
103
|
-
*/
|
|
104
|
-
edgeEndpoints(e: number): Array<any>;
|
|
105
|
-
/**
|
|
106
|
-
* @param {number} a
|
|
107
|
-
* @returns {any}
|
|
108
|
-
*/
|
|
109
|
-
removeNode(a: number): any;
|
|
110
|
-
/**
|
|
111
|
-
* @param {number} e
|
|
112
|
-
* @returns {any}
|
|
113
|
-
*/
|
|
114
|
-
removeEdge(e: number): any;
|
|
115
|
-
/**
|
|
116
|
-
* @param {number} a
|
|
117
|
-
* @returns {Array<any>}
|
|
118
|
-
*/
|
|
119
|
-
neighbors(a: number): Array<any>;
|
|
120
|
-
/**
|
|
121
|
-
* @param {number} a
|
|
122
|
-
* @param {number} dir
|
|
123
|
-
* @returns {Array<any>}
|
|
124
|
-
*/
|
|
125
|
-
neighborsDirected(a: number, dir: number): Array<any>;
|
|
126
|
-
/**
|
|
127
|
-
* @param {number} a
|
|
128
|
-
* @returns {Array<any>}
|
|
129
|
-
*/
|
|
130
|
-
neighborsUndirected(a: number): Array<any>;
|
|
131
|
-
/**
|
|
132
|
-
* @param {number} a
|
|
133
|
-
* @returns {Array<any>}
|
|
134
|
-
*/
|
|
135
|
-
edges(a: number): Array<any>;
|
|
136
|
-
/**
|
|
137
|
-
* @param {number} a
|
|
138
|
-
* @param {number} b
|
|
139
|
-
* @returns {boolean}
|
|
140
|
-
*/
|
|
141
|
-
containsEdge(a: number, b: number): boolean;
|
|
142
|
-
/**
|
|
143
|
-
* @param {number} a
|
|
144
|
-
* @param {number} b
|
|
145
|
-
* @returns {number}
|
|
146
|
-
*/
|
|
147
|
-
findEdge(a: number, b: number): number;
|
|
148
|
-
/**
|
|
149
|
-
* @param {number} dir
|
|
150
|
-
* @returns {Array<any>}
|
|
151
|
-
*/
|
|
152
|
-
externals(dir: number): Array<any>;
|
|
153
|
-
/**
|
|
154
|
-
* @returns {Array<any>}
|
|
155
|
-
*/
|
|
156
|
-
nodeIndices(): Array<any>;
|
|
157
|
-
/**
|
|
158
|
-
* @returns {Array<any>}
|
|
159
|
-
*/
|
|
160
|
-
edgeIndices(): Array<any>;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
*/
|
|
164
|
-
export class LinkForce {
|
|
165
|
-
free(): void;
|
|
166
|
-
/**
|
|
167
|
-
* @param {Graph} graph
|
|
168
|
-
*/
|
|
169
|
-
constructor(graph: Graph);
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
*/
|
|
173
|
-
export class ManyBodyForce {
|
|
174
|
-
free(): void;
|
|
175
|
-
/**
|
|
176
|
-
* @param {Graph} graph
|
|
177
|
-
*/
|
|
178
|
-
constructor(graph: Graph);
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
*/
|
|
182
|
-
export class Simulation {
|
|
183
|
-
free(): void;
|
|
184
|
-
/**
|
|
185
|
-
* @param {Graph} graph
|
|
186
|
-
* @param {Function} f
|
|
187
|
-
*/
|
|
188
|
-
constructor(graph: Graph, f: Function);
|
|
189
|
-
/**
|
|
190
|
-
* @param {any[]} js_forces
|
|
191
|
-
* @returns {any}
|
|
192
|
-
*/
|
|
193
|
-
run(js_forces: any[]): any;
|
|
194
|
-
/**
|
|
195
|
-
* @param {number} n
|
|
196
|
-
* @param {any[]} js_forces
|
|
197
|
-
* @returns {any}
|
|
198
|
-
*/
|
|
199
|
-
runStep(n: number, js_forces: any[]): any;
|
|
200
|
-
/**
|
|
201
|
-
* @returns {boolean}
|
|
202
|
-
*/
|
|
203
|
-
isFinished(): boolean;
|
|
204
|
-
/**
|
|
205
|
-
* @param {number} alpha_start
|
|
206
|
-
*/
|
|
207
|
-
reset(alpha_start: number): void;
|
|
208
|
-
/**
|
|
209
|
-
* @returns {number}
|
|
210
|
-
*/
|
|
211
|
-
alphaMin: number;
|
|
212
|
-
/**
|
|
213
|
-
* @returns {number}
|
|
214
|
-
*/
|
|
215
|
-
alphaStart: number;
|
|
216
|
-
/**
|
|
217
|
-
* @returns {number}
|
|
218
|
-
*/
|
|
219
|
-
alphaTarget: number;
|
|
220
|
-
/**
|
|
221
|
-
* @returns {number}
|
|
222
|
-
*/
|
|
223
|
-
iterations: number;
|
|
224
|
-
/**
|
|
225
|
-
* @returns {number}
|
|
226
|
-
*/
|
|
227
|
-
velocityDecay: number;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
231
|
-
|
|
232
|
-
export interface InitOutput {
|
|
233
|
-
readonly memory: WebAssembly.Memory;
|
|
234
|
-
readonly initialPlacement: (a: number) => number;
|
|
235
|
-
readonly forceConnected: (a: number) => number;
|
|
236
|
-
readonly forceNonconnected: (a: number) => number;
|
|
237
|
-
readonly __wbg_force_free: (a: number) => void;
|
|
238
|
-
readonly __wbg_centerforce_free: (a: number) => void;
|
|
239
|
-
readonly centerforce_new: () => number;
|
|
240
|
-
readonly linkforce_new: (a: number) => number;
|
|
241
|
-
readonly manybodyforce_new: (a: number) => number;
|
|
242
|
-
readonly forceGrouped: (a: number, b: number) => number;
|
|
243
|
-
readonly __wbg_linkforce_free: (a: number) => void;
|
|
244
|
-
readonly __wbg_manybodyforce_free: (a: number) => void;
|
|
245
|
-
readonly __wbg_simulation_free: (a: number) => void;
|
|
246
|
-
readonly simulation_new: (a: number, b: number) => number;
|
|
247
|
-
readonly simulation_run: (a: number, b: number, c: number) => number;
|
|
248
|
-
readonly simulation_runStep: (a: number, b: number, c: number, d: number) => number;
|
|
249
|
-
readonly simulation_isFinished: (a: number) => number;
|
|
250
|
-
readonly simulation_reset: (a: number, b: number) => void;
|
|
251
|
-
readonly simulation_alpha: (a: number) => number;
|
|
252
|
-
readonly simulation_alpha_min: (a: number) => number;
|
|
253
|
-
readonly simulation_set_alpha_min: (a: number, b: number) => void;
|
|
254
|
-
readonly simulation_alpha_target: (a: number) => number;
|
|
255
|
-
readonly simulation_set_alpha_target: (a: number, b: number) => void;
|
|
256
|
-
readonly simulation_velocity_decay: (a: number) => number;
|
|
257
|
-
readonly simulation_set_velocity_decay: (a: number, b: number) => void;
|
|
258
|
-
readonly simulation_iterations: (a: number) => number;
|
|
259
|
-
readonly simulation_set_iterations: (a: number, b: number) => void;
|
|
260
|
-
readonly simulation_set_alpha: (a: number, b: number) => void;
|
|
261
|
-
readonly kamadaKawai: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
262
|
-
readonly __wbg_graph_free: (a: number) => void;
|
|
263
|
-
readonly graph_new: () => number;
|
|
264
|
-
readonly graph_nodeCount: (a: number) => number;
|
|
265
|
-
readonly graph_edgeCount: (a: number) => number;
|
|
266
|
-
readonly graph_addNode: (a: number, b: number) => number;
|
|
267
|
-
readonly graph_nodeWeight: (a: number, b: number) => number;
|
|
268
|
-
readonly graph_addEdge: (a: number, b: number, c: number, d: number) => number;
|
|
269
|
-
readonly graph_edgeWeight: (a: number, b: number) => number;
|
|
270
|
-
readonly graph_edgeEndpoints: (a: number, b: number) => number;
|
|
271
|
-
readonly graph_removeNode: (a: number, b: number) => number;
|
|
272
|
-
readonly graph_removeEdge: (a: number, b: number) => number;
|
|
273
|
-
readonly graph_neighbors: (a: number, b: number) => number;
|
|
274
|
-
readonly graph_neighborsDirected: (a: number, b: number, c: number) => number;
|
|
275
|
-
readonly graph_neighborsUndirected: (a: number, b: number) => number;
|
|
276
|
-
readonly graph_edges: (a: number, b: number) => number;
|
|
277
|
-
readonly graph_containsEdge: (a: number, b: number, c: number) => number;
|
|
278
|
-
readonly graph_findEdge: (a: number, b: number, c: number) => number;
|
|
279
|
-
readonly graph_externals: (a: number, b: number) => number;
|
|
280
|
-
readonly graph_nodeIndices: (a: number) => number;
|
|
281
|
-
readonly graph_edgeIndices: (a: number) => number;
|
|
282
|
-
readonly fm3: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
283
|
-
readonly fdeb: (a: number, b: number) => number;
|
|
284
|
-
readonly __wbindgen_malloc: (a: number) => number;
|
|
285
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
286
|
-
readonly __wbindgen_exn_store: (a: number) => void;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
291
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
292
|
-
*
|
|
293
|
-
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
294
|
-
*
|
|
295
|
-
* @returns {Promise<InitOutput>}
|
|
296
|
-
*/
|
|
297
|
-
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
298
|
-
|