egraph 5.0.0 → 6.0.0-alpha.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.
- package/dist/bundler/egraph_wasm.d.ts +333 -37
- package/dist/bundler/egraph_wasm_bg.wasm +0 -0
- package/dist/no-modules/egraph_wasm.d.ts +614 -261
- package/dist/no-modules/egraph_wasm.js +938 -203
- package/dist/no-modules/egraph_wasm_bg.wasm +0 -0
- package/dist/nodejs/egraph_wasm.d.ts +333 -37
- package/dist/nodejs/egraph_wasm.js +940 -204
- package/dist/nodejs/egraph_wasm_bg.wasm +0 -0
- package/dist/web/egraph_wasm.d.ts +418 -68
- package/dist/web/egraph_wasm.js +925 -200
- package/dist/web/egraph_wasm_bg.wasm +0 -0
- package/package.json +1 -1
- package/umd/egraph.js +0 -840
- package/umd/egraph_bg.wasm +0 -0
package/dist/web/egraph_wasm.js
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
let wasm;
|
|
3
3
|
|
|
4
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
5
|
-
|
|
6
|
-
cachedTextDecoder.decode();
|
|
7
|
-
|
|
8
|
-
let cachegetUint8Memory0 = null;
|
|
9
|
-
function getUint8Memory0() {
|
|
10
|
-
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
|
11
|
-
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
-
}
|
|
13
|
-
return cachegetUint8Memory0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function getStringFromWasm0(ptr, len) {
|
|
17
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
4
|
const heap = new Array(32).fill(undefined);
|
|
21
5
|
|
|
22
6
|
heap.push(undefined, null, true, false);
|
|
@@ -46,6 +30,42 @@ function takeObject(idx) {
|
|
|
46
30
|
return ret;
|
|
47
31
|
}
|
|
48
32
|
|
|
33
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
34
|
+
|
|
35
|
+
cachedTextDecoder.decode();
|
|
36
|
+
|
|
37
|
+
let cachegetUint8Memory0 = null;
|
|
38
|
+
function getUint8Memory0() {
|
|
39
|
+
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
|
40
|
+
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
41
|
+
}
|
|
42
|
+
return cachegetUint8Memory0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getStringFromWasm0(ptr, len) {
|
|
46
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function isLikeNone(x) {
|
|
50
|
+
return x === undefined || x === null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let cachegetFloat64Memory0 = null;
|
|
54
|
+
function getFloat64Memory0() {
|
|
55
|
+
if (cachegetFloat64Memory0 === null || cachegetFloat64Memory0.buffer !== wasm.memory.buffer) {
|
|
56
|
+
cachegetFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
57
|
+
}
|
|
58
|
+
return cachegetFloat64Memory0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let cachegetInt32Memory0 = null;
|
|
62
|
+
function getInt32Memory0() {
|
|
63
|
+
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
|
64
|
+
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
65
|
+
}
|
|
66
|
+
return cachegetInt32Memory0;
|
|
67
|
+
}
|
|
68
|
+
|
|
49
69
|
let WASM_VECTOR_LEN = 0;
|
|
50
70
|
|
|
51
71
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -101,26 +121,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
101
121
|
return ptr;
|
|
102
122
|
}
|
|
103
123
|
|
|
104
|
-
let cachegetInt32Memory0 = null;
|
|
105
|
-
function getInt32Memory0() {
|
|
106
|
-
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
|
107
|
-
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
108
|
-
}
|
|
109
|
-
return cachegetInt32Memory0;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function isLikeNone(x) {
|
|
113
|
-
return x === undefined || x === null;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
let cachegetFloat64Memory0 = null;
|
|
117
|
-
function getFloat64Memory0() {
|
|
118
|
-
if (cachegetFloat64Memory0 === null || cachegetFloat64Memory0.buffer !== wasm.memory.buffer) {
|
|
119
|
-
cachegetFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
120
|
-
}
|
|
121
|
-
return cachegetFloat64Memory0;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
124
|
function debugString(val) {
|
|
125
125
|
// primitive types
|
|
126
126
|
const type = typeof val;
|
|
@@ -192,35 +192,6 @@ function _assertClass(instance, klass) {
|
|
|
192
192
|
}
|
|
193
193
|
return instance.ptr;
|
|
194
194
|
}
|
|
195
|
-
/**
|
|
196
|
-
* @param {Graph} graph
|
|
197
|
-
* @returns {any}
|
|
198
|
-
*/
|
|
199
|
-
export function initialPlacement(graph) {
|
|
200
|
-
_assertClass(graph, Graph);
|
|
201
|
-
var ret = wasm.initialPlacement(graph.ptr);
|
|
202
|
-
return takeObject(ret);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* @param {Graph} graph
|
|
207
|
-
* @returns {Array<any>}
|
|
208
|
-
*/
|
|
209
|
-
export function forceConnected(graph) {
|
|
210
|
-
_assertClass(graph, Graph);
|
|
211
|
-
var ret = wasm.forceConnected(graph.ptr);
|
|
212
|
-
return takeObject(ret);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* @param {Graph} graph
|
|
217
|
-
* @returns {Array<any>}
|
|
218
|
-
*/
|
|
219
|
-
export function forceNonconnected(graph) {
|
|
220
|
-
_assertClass(graph, Graph);
|
|
221
|
-
var ret = wasm.forceNonconnected(graph.ptr);
|
|
222
|
-
return takeObject(ret);
|
|
223
|
-
}
|
|
224
195
|
|
|
225
196
|
let stack_pointer = 32;
|
|
226
197
|
|
|
@@ -231,49 +202,36 @@ function addBorrowedObject(obj) {
|
|
|
231
202
|
}
|
|
232
203
|
/**
|
|
233
204
|
* @param {Graph} graph
|
|
234
|
-
* @param {Function}
|
|
235
|
-
* @
|
|
205
|
+
* @param {Function} groups
|
|
206
|
+
* @param {Function} shrink_node
|
|
207
|
+
* @param {Function} shrink_edge
|
|
208
|
+
* @returns {any}
|
|
236
209
|
*/
|
|
237
|
-
export function
|
|
210
|
+
export function coarsen(graph, groups, shrink_node, shrink_edge) {
|
|
238
211
|
try {
|
|
239
212
|
_assertClass(graph, Graph);
|
|
240
|
-
var ret = wasm.
|
|
213
|
+
var ret = wasm.coarsen(graph.ptr, addBorrowedObject(groups), addBorrowedObject(shrink_node), addBorrowedObject(shrink_edge));
|
|
241
214
|
return takeObject(ret);
|
|
242
215
|
} finally {
|
|
243
216
|
heap[stack_pointer++] = undefined;
|
|
217
|
+
heap[stack_pointer++] = undefined;
|
|
218
|
+
heap[stack_pointer++] = undefined;
|
|
244
219
|
}
|
|
245
220
|
}
|
|
246
221
|
|
|
247
|
-
let cachegetUint32Memory0 = null;
|
|
248
|
-
function getUint32Memory0() {
|
|
249
|
-
if (cachegetUint32Memory0 === null || cachegetUint32Memory0.buffer !== wasm.memory.buffer) {
|
|
250
|
-
cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
|
251
|
-
}
|
|
252
|
-
return cachegetUint32Memory0;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
256
|
-
const ptr = malloc(array.length * 4);
|
|
257
|
-
const mem = getUint32Memory0();
|
|
258
|
-
for (let i = 0; i < array.length; i++) {
|
|
259
|
-
mem[ptr / 4 + i] = addHeapObject(array[i]);
|
|
260
|
-
}
|
|
261
|
-
WASM_VECTOR_LEN = array.length;
|
|
262
|
-
return ptr;
|
|
263
|
-
}
|
|
264
222
|
/**
|
|
265
223
|
* @param {Graph} graph
|
|
266
224
|
* @param {any} coordinates
|
|
267
|
-
* @param {Function} _length
|
|
268
|
-
* @param {number} eps
|
|
269
|
-
* @param {number} width
|
|
270
|
-
* @param {number} height
|
|
271
225
|
* @returns {any}
|
|
272
226
|
*/
|
|
273
|
-
export function
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
227
|
+
export function fdeb(graph, coordinates) {
|
|
228
|
+
try {
|
|
229
|
+
_assertClass(graph, Graph);
|
|
230
|
+
var ret = wasm.fdeb(graph.ptr, addBorrowedObject(coordinates));
|
|
231
|
+
return takeObject(ret);
|
|
232
|
+
} finally {
|
|
233
|
+
heap[stack_pointer++] = undefined;
|
|
234
|
+
}
|
|
277
235
|
}
|
|
278
236
|
|
|
279
237
|
/**
|
|
@@ -283,72 +241,278 @@ export function kamadaKawai(graph, coordinates, _length, eps, width, height) {
|
|
|
283
241
|
* @param {Function} _shrink_node
|
|
284
242
|
* @param {Function} _shrink_edge
|
|
285
243
|
* @param {Function} _link_distance_accessor
|
|
286
|
-
* @returns {
|
|
244
|
+
* @returns {Coordinates}
|
|
287
245
|
*/
|
|
288
246
|
export function fm3(graph, min_size, step_iteration, _shrink_node, _shrink_edge, _link_distance_accessor) {
|
|
289
247
|
_assertClass(graph, Graph);
|
|
290
248
|
var ret = wasm.fm3(graph.ptr, min_size, step_iteration, addHeapObject(_shrink_node), addHeapObject(_shrink_edge), addHeapObject(_link_distance_accessor));
|
|
291
|
-
return
|
|
249
|
+
return Coordinates.__wrap(ret);
|
|
292
250
|
}
|
|
293
251
|
|
|
252
|
+
let cachegetFloat32Memory0 = null;
|
|
253
|
+
function getFloat32Memory0() {
|
|
254
|
+
if (cachegetFloat32Memory0 === null || cachegetFloat32Memory0.buffer !== wasm.memory.buffer) {
|
|
255
|
+
cachegetFloat32Memory0 = new Float32Array(wasm.memory.buffer);
|
|
256
|
+
}
|
|
257
|
+
return cachegetFloat32Memory0;
|
|
258
|
+
}
|
|
294
259
|
/**
|
|
295
260
|
* @param {Graph} graph
|
|
296
|
-
* @param {
|
|
261
|
+
* @param {Coordinates} coordinates
|
|
262
|
+
* @param {Function} _length
|
|
263
|
+
* @param {number} eps
|
|
264
|
+
* @param {number} width
|
|
265
|
+
* @param {number} height
|
|
297
266
|
* @returns {any}
|
|
298
267
|
*/
|
|
299
|
-
export function
|
|
268
|
+
export function kamadaKawai(graph, coordinates, _length, eps, width, height) {
|
|
269
|
+
_assertClass(graph, Graph);
|
|
270
|
+
_assertClass(coordinates, Coordinates);
|
|
271
|
+
var ret = wasm.kamadaKawai(graph.ptr, coordinates.ptr, addHeapObject(_length), eps, width, height);
|
|
272
|
+
return takeObject(ret);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function handleError(f, args) {
|
|
300
276
|
try {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
} finally {
|
|
305
|
-
heap[stack_pointer++] = undefined;
|
|
277
|
+
return f.apply(this, args);
|
|
278
|
+
} catch (e) {
|
|
279
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
306
280
|
}
|
|
307
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
*/
|
|
284
|
+
export class CollideForce {
|
|
308
285
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
286
|
+
static __wrap(ptr) {
|
|
287
|
+
const obj = Object.create(CollideForce.prototype);
|
|
288
|
+
obj.ptr = ptr;
|
|
289
|
+
|
|
290
|
+
return obj;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
__destroy_into_raw() {
|
|
294
|
+
const ptr = this.ptr;
|
|
295
|
+
this.ptr = 0;
|
|
313
296
|
|
|
314
|
-
|
|
315
|
-
|
|
297
|
+
return ptr;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
free() {
|
|
301
|
+
const ptr = this.__destroy_into_raw();
|
|
302
|
+
wasm.__wbg_collideforce_free(ptr);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* @param {Graph} graph
|
|
306
|
+
* @param {Function} f
|
|
307
|
+
* @param {any} options
|
|
308
|
+
*/
|
|
309
|
+
constructor(graph, f, options) {
|
|
310
|
+
try {
|
|
311
|
+
_assertClass(graph, Graph);
|
|
312
|
+
var ret = wasm.collideforce_new(graph.ptr, addBorrowedObject(f), addBorrowedObject(options));
|
|
313
|
+
return CollideForce.__wrap(ret);
|
|
314
|
+
} finally {
|
|
315
|
+
heap[stack_pointer++] = undefined;
|
|
316
|
+
heap[stack_pointer++] = undefined;
|
|
316
317
|
}
|
|
317
|
-
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* @param {Coordinates} context
|
|
321
|
+
* @param {number} alpha
|
|
322
|
+
*/
|
|
323
|
+
apply(context, alpha) {
|
|
324
|
+
_assertClass(context, Coordinates);
|
|
325
|
+
wasm.collideforce_apply(this.ptr, context.ptr, alpha);
|
|
326
|
+
}
|
|
318
327
|
}
|
|
319
328
|
/**
|
|
320
329
|
*/
|
|
321
|
-
export class
|
|
330
|
+
export class Coordinates {
|
|
322
331
|
|
|
323
|
-
|
|
332
|
+
static __wrap(ptr) {
|
|
333
|
+
const obj = Object.create(Coordinates.prototype);
|
|
334
|
+
obj.ptr = ptr;
|
|
335
|
+
|
|
336
|
+
return obj;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
__destroy_into_raw() {
|
|
324
340
|
const ptr = this.ptr;
|
|
325
341
|
this.ptr = 0;
|
|
326
342
|
|
|
327
|
-
|
|
343
|
+
return ptr;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
free() {
|
|
347
|
+
const ptr = this.__destroy_into_raw();
|
|
348
|
+
wasm.__wbg_coordinates_free(ptr);
|
|
328
349
|
}
|
|
329
350
|
/**
|
|
351
|
+
* @param {number} u
|
|
352
|
+
* @returns {number | undefined}
|
|
330
353
|
*/
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
354
|
+
x(u) {
|
|
355
|
+
try {
|
|
356
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
357
|
+
wasm.coordinates_x(retptr, this.ptr, u);
|
|
358
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
359
|
+
var r1 = getFloat32Memory0()[retptr / 4 + 1];
|
|
360
|
+
return r0 === 0 ? undefined : r1;
|
|
361
|
+
} finally {
|
|
362
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* @param {number} u
|
|
367
|
+
* @returns {number | undefined}
|
|
368
|
+
*/
|
|
369
|
+
y(u) {
|
|
370
|
+
try {
|
|
371
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
372
|
+
wasm.coordinates_y(retptr, this.ptr, u);
|
|
373
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
374
|
+
var r1 = getFloat32Memory0()[retptr / 4 + 1];
|
|
375
|
+
return r0 === 0 ? undefined : r1;
|
|
376
|
+
} finally {
|
|
377
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* @param {number} u
|
|
382
|
+
* @param {number} x
|
|
383
|
+
*/
|
|
384
|
+
setX(u, x) {
|
|
385
|
+
wasm.coordinates_setX(this.ptr, u, x);
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* @param {number} u
|
|
389
|
+
* @param {number} y
|
|
390
|
+
*/
|
|
391
|
+
setY(u, y) {
|
|
392
|
+
wasm.coordinates_setY(this.ptr, u, y);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* @param {number} u
|
|
396
|
+
* @returns {number | undefined}
|
|
397
|
+
*/
|
|
398
|
+
vx(u) {
|
|
399
|
+
try {
|
|
400
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
401
|
+
wasm.coordinates_vx(retptr, this.ptr, u);
|
|
402
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
403
|
+
var r1 = getFloat32Memory0()[retptr / 4 + 1];
|
|
404
|
+
return r0 === 0 ? undefined : r1;
|
|
405
|
+
} finally {
|
|
406
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* @param {number} u
|
|
411
|
+
* @returns {number | undefined}
|
|
412
|
+
*/
|
|
413
|
+
vy(u) {
|
|
414
|
+
try {
|
|
415
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
416
|
+
wasm.coordinates_vy(retptr, this.ptr, u);
|
|
417
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
418
|
+
var r1 = getFloat32Memory0()[retptr / 4 + 1];
|
|
419
|
+
return r0 === 0 ? undefined : r1;
|
|
420
|
+
} finally {
|
|
421
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* @returns {number}
|
|
426
|
+
*/
|
|
427
|
+
len() {
|
|
428
|
+
var ret = wasm.coordinates_len(this.ptr);
|
|
429
|
+
return ret >>> 0;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* @returns {any}
|
|
433
|
+
*/
|
|
434
|
+
toJSON() {
|
|
435
|
+
var ret = wasm.coordinates_toJSON(this.ptr);
|
|
436
|
+
return takeObject(ret);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
*/
|
|
440
|
+
centralize() {
|
|
441
|
+
wasm.coordinates_centralize(this.ptr);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* @param {number} velocity_decay
|
|
445
|
+
*/
|
|
446
|
+
updatePosition(velocity_decay) {
|
|
447
|
+
wasm.coordinates_updatePosition(this.ptr, velocity_decay);
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* @param {number} x0
|
|
451
|
+
* @param {number} y0
|
|
452
|
+
* @param {number} x1
|
|
453
|
+
* @param {number} y1
|
|
454
|
+
*/
|
|
455
|
+
clampRegion(x0, y0, x1, y1) {
|
|
456
|
+
wasm.coordinates_clampRegion(this.ptr, x0, y0, x1, y1);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* @param {Graph} graph
|
|
460
|
+
* @returns {Coordinates}
|
|
461
|
+
*/
|
|
462
|
+
static initialPlacement(graph) {
|
|
463
|
+
_assertClass(graph, Graph);
|
|
464
|
+
var ret = wasm.coordinates_initialPlacement(graph.ptr);
|
|
465
|
+
return Coordinates.__wrap(ret);
|
|
334
466
|
}
|
|
335
467
|
}
|
|
336
468
|
/**
|
|
337
469
|
*/
|
|
338
|
-
export class
|
|
470
|
+
export class FruchtermanReingoldForce {
|
|
339
471
|
|
|
340
472
|
static __wrap(ptr) {
|
|
341
|
-
const obj = Object.create(
|
|
473
|
+
const obj = Object.create(FruchtermanReingoldForce.prototype);
|
|
342
474
|
obj.ptr = ptr;
|
|
343
475
|
|
|
344
476
|
return obj;
|
|
345
477
|
}
|
|
346
478
|
|
|
347
|
-
|
|
479
|
+
__destroy_into_raw() {
|
|
348
480
|
const ptr = this.ptr;
|
|
349
481
|
this.ptr = 0;
|
|
350
482
|
|
|
351
|
-
|
|
483
|
+
return ptr;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
free() {
|
|
487
|
+
const ptr = this.__destroy_into_raw();
|
|
488
|
+
wasm.__wbg_fruchtermanreingoldforce_free(ptr);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* @param {Graph} graph
|
|
492
|
+
* @param {number} k
|
|
493
|
+
* @param {number} min_distance
|
|
494
|
+
*/
|
|
495
|
+
constructor(graph, k, min_distance) {
|
|
496
|
+
_assertClass(graph, Graph);
|
|
497
|
+
var ret = wasm.fruchtermanreingoldforce_new(graph.ptr, k, min_distance);
|
|
498
|
+
return FruchtermanReingoldForce.__wrap(ret);
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* @param {Coordinates} coordinates
|
|
502
|
+
* @param {number} alpha
|
|
503
|
+
*/
|
|
504
|
+
apply(coordinates, alpha) {
|
|
505
|
+
_assertClass(coordinates, Coordinates);
|
|
506
|
+
wasm.fruchtermanreingoldforce_apply(this.ptr, coordinates.ptr, alpha);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* @param {number} u
|
|
510
|
+
* @param {Coordinates} coordinates
|
|
511
|
+
* @param {number} alpha
|
|
512
|
+
*/
|
|
513
|
+
applyToNode(u, coordinates, alpha) {
|
|
514
|
+
_assertClass(coordinates, Coordinates);
|
|
515
|
+
wasm.fruchtermanreingoldforce_applyToNode(this.ptr, u, coordinates.ptr, alpha);
|
|
352
516
|
}
|
|
353
517
|
}
|
|
354
518
|
/**
|
|
@@ -362,10 +526,15 @@ export class Graph {
|
|
|
362
526
|
return obj;
|
|
363
527
|
}
|
|
364
528
|
|
|
365
|
-
|
|
529
|
+
__destroy_into_raw() {
|
|
366
530
|
const ptr = this.ptr;
|
|
367
531
|
this.ptr = 0;
|
|
368
532
|
|
|
533
|
+
return ptr;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
free() {
|
|
537
|
+
const ptr = this.__destroy_into_raw();
|
|
369
538
|
wasm.__wbg_graph_free(ptr);
|
|
370
539
|
}
|
|
371
540
|
/**
|
|
@@ -519,61 +688,422 @@ export class Graph {
|
|
|
519
688
|
var ret = wasm.graph_edgeIndices(this.ptr);
|
|
520
689
|
return takeObject(ret);
|
|
521
690
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
691
|
+
/**
|
|
692
|
+
* @param {Function} node_map
|
|
693
|
+
* @param {Function} edge_map
|
|
694
|
+
* @returns {Graph}
|
|
695
|
+
*/
|
|
696
|
+
map(node_map, edge_map) {
|
|
697
|
+
try {
|
|
698
|
+
var ret = wasm.graph_map(this.ptr, addBorrowedObject(node_map), addBorrowedObject(edge_map));
|
|
699
|
+
return Graph.__wrap(ret);
|
|
700
|
+
} finally {
|
|
701
|
+
heap[stack_pointer++] = undefined;
|
|
702
|
+
heap[stack_pointer++] = undefined;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* @param {Function} node_map
|
|
707
|
+
* @param {Function} edge_map
|
|
708
|
+
* @returns {Graph}
|
|
709
|
+
*/
|
|
710
|
+
filterMap(node_map, edge_map) {
|
|
711
|
+
try {
|
|
712
|
+
var ret = wasm.graph_filterMap(this.ptr, addBorrowedObject(node_map), addBorrowedObject(edge_map));
|
|
713
|
+
return Graph.__wrap(ret);
|
|
714
|
+
} finally {
|
|
715
|
+
heap[stack_pointer++] = undefined;
|
|
716
|
+
heap[stack_pointer++] = undefined;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
*/
|
|
722
|
+
export class GroupLinkForce {
|
|
723
|
+
|
|
724
|
+
static __wrap(ptr) {
|
|
725
|
+
const obj = Object.create(GroupLinkForce.prototype);
|
|
726
|
+
obj.ptr = ptr;
|
|
727
|
+
|
|
728
|
+
return obj;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
__destroy_into_raw() {
|
|
732
|
+
const ptr = this.ptr;
|
|
733
|
+
this.ptr = 0;
|
|
734
|
+
|
|
735
|
+
return ptr;
|
|
736
|
+
}
|
|
737
|
+
|
|
527
738
|
free() {
|
|
739
|
+
const ptr = this.__destroy_into_raw();
|
|
740
|
+
wasm.__wbg_grouplinkforce_free(ptr);
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* @param {Graph} graph
|
|
744
|
+
* @param {Function} group_accessor
|
|
745
|
+
* @param {Function} inter_link_accessor
|
|
746
|
+
* @param {Function} intra_link_accessor
|
|
747
|
+
*/
|
|
748
|
+
constructor(graph, group_accessor, inter_link_accessor, intra_link_accessor) {
|
|
749
|
+
try {
|
|
750
|
+
_assertClass(graph, Graph);
|
|
751
|
+
var ret = wasm.grouplinkforce_new(graph.ptr, addBorrowedObject(group_accessor), addBorrowedObject(inter_link_accessor), addBorrowedObject(intra_link_accessor));
|
|
752
|
+
return GroupLinkForce.__wrap(ret);
|
|
753
|
+
} finally {
|
|
754
|
+
heap[stack_pointer++] = undefined;
|
|
755
|
+
heap[stack_pointer++] = undefined;
|
|
756
|
+
heap[stack_pointer++] = undefined;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* @param {Coordinates} coordinates
|
|
761
|
+
* @param {number} alpha
|
|
762
|
+
*/
|
|
763
|
+
apply(coordinates, alpha) {
|
|
764
|
+
_assertClass(coordinates, Coordinates);
|
|
765
|
+
wasm.grouplinkforce_apply(this.ptr, coordinates.ptr, alpha);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
*/
|
|
770
|
+
export class GroupManyBodyForce {
|
|
771
|
+
|
|
772
|
+
static __wrap(ptr) {
|
|
773
|
+
const obj = Object.create(GroupManyBodyForce.prototype);
|
|
774
|
+
obj.ptr = ptr;
|
|
775
|
+
|
|
776
|
+
return obj;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
__destroy_into_raw() {
|
|
528
780
|
const ptr = this.ptr;
|
|
529
781
|
this.ptr = 0;
|
|
530
782
|
|
|
783
|
+
return ptr;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
free() {
|
|
787
|
+
const ptr = this.__destroy_into_raw();
|
|
788
|
+
wasm.__wbg_groupmanybodyforce_free(ptr);
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* @param {Graph} graph
|
|
792
|
+
* @param {Function} node_accessor
|
|
793
|
+
*/
|
|
794
|
+
constructor(graph, node_accessor) {
|
|
795
|
+
try {
|
|
796
|
+
_assertClass(graph, Graph);
|
|
797
|
+
var ret = wasm.groupmanybodyforce_new(graph.ptr, addBorrowedObject(node_accessor));
|
|
798
|
+
return GroupManyBodyForce.__wrap(ret);
|
|
799
|
+
} finally {
|
|
800
|
+
heap[stack_pointer++] = undefined;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* @param {Coordinates} coordinates
|
|
805
|
+
* @param {number} alpha
|
|
806
|
+
*/
|
|
807
|
+
apply(coordinates, alpha) {
|
|
808
|
+
_assertClass(coordinates, Coordinates);
|
|
809
|
+
wasm.groupmanybodyforce_apply(this.ptr, coordinates.ptr, alpha);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
*/
|
|
814
|
+
export class GroupPositionForce {
|
|
815
|
+
|
|
816
|
+
static __wrap(ptr) {
|
|
817
|
+
const obj = Object.create(GroupPositionForce.prototype);
|
|
818
|
+
obj.ptr = ptr;
|
|
819
|
+
|
|
820
|
+
return obj;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
__destroy_into_raw() {
|
|
824
|
+
const ptr = this.ptr;
|
|
825
|
+
this.ptr = 0;
|
|
826
|
+
|
|
827
|
+
return ptr;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
free() {
|
|
831
|
+
const ptr = this.__destroy_into_raw();
|
|
832
|
+
wasm.__wbg_grouppositionforce_free(ptr);
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* @param {Graph} graph
|
|
836
|
+
* @param {Function} node_accessor
|
|
837
|
+
* @param {Function} group_accessor
|
|
838
|
+
*/
|
|
839
|
+
constructor(graph, node_accessor, group_accessor) {
|
|
840
|
+
try {
|
|
841
|
+
_assertClass(graph, Graph);
|
|
842
|
+
var ret = wasm.grouppositionforce_new(graph.ptr, addBorrowedObject(node_accessor), addBorrowedObject(group_accessor));
|
|
843
|
+
return GroupPositionForce.__wrap(ret);
|
|
844
|
+
} finally {
|
|
845
|
+
heap[stack_pointer++] = undefined;
|
|
846
|
+
heap[stack_pointer++] = undefined;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* @param {Coordinates} coordinates
|
|
851
|
+
* @param {number} alpha
|
|
852
|
+
*/
|
|
853
|
+
apply(coordinates, alpha) {
|
|
854
|
+
_assertClass(coordinates, Coordinates);
|
|
855
|
+
wasm.grouppositionforce_apply(this.ptr, coordinates.ptr, alpha);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
*/
|
|
860
|
+
export class HyperbolicSpace {
|
|
861
|
+
|
|
862
|
+
__destroy_into_raw() {
|
|
863
|
+
const ptr = this.ptr;
|
|
864
|
+
this.ptr = 0;
|
|
865
|
+
|
|
866
|
+
return ptr;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
free() {
|
|
870
|
+
const ptr = this.__destroy_into_raw();
|
|
871
|
+
wasm.__wbg_hyperbolicspace_free(ptr);
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* @param {any} a
|
|
875
|
+
* @param {any} b
|
|
876
|
+
* @returns {any}
|
|
877
|
+
*/
|
|
878
|
+
static toTangentSpace(a, b) {
|
|
879
|
+
var ret = wasm.hyperbolicspace_toTangentSpace(addHeapObject(a), addHeapObject(b));
|
|
880
|
+
return takeObject(ret);
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* @param {any} a
|
|
884
|
+
* @param {any} b
|
|
885
|
+
* @returns {any}
|
|
886
|
+
*/
|
|
887
|
+
static fromTangentSpace(a, b) {
|
|
888
|
+
var ret = wasm.hyperbolicspace_fromTangentSpace(addHeapObject(a), addHeapObject(b));
|
|
889
|
+
return takeObject(ret);
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* @param {number} i
|
|
893
|
+
* @param {Coordinates} riemann_space
|
|
894
|
+
* @param {Coordinates} tangent_space
|
|
895
|
+
*/
|
|
896
|
+
static mapToTangentSpace(i, riemann_space, tangent_space) {
|
|
897
|
+
_assertClass(riemann_space, Coordinates);
|
|
898
|
+
_assertClass(tangent_space, Coordinates);
|
|
899
|
+
wasm.hyperbolicspace_mapToTangentSpace(i, riemann_space.ptr, tangent_space.ptr);
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* @param {number} i
|
|
903
|
+
* @param {Coordinates} riemann_space
|
|
904
|
+
* @param {Coordinates} tangent_space
|
|
905
|
+
* @param {number} velocity_decay
|
|
906
|
+
*/
|
|
907
|
+
static updatePosition(i, riemann_space, tangent_space, velocity_decay) {
|
|
908
|
+
_assertClass(riemann_space, Coordinates);
|
|
909
|
+
_assertClass(tangent_space, Coordinates);
|
|
910
|
+
wasm.hyperbolicspace_updatePosition(i, riemann_space.ptr, tangent_space.ptr, velocity_decay);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
*/
|
|
915
|
+
export class KamadaKawai {
|
|
916
|
+
|
|
917
|
+
static __wrap(ptr) {
|
|
918
|
+
const obj = Object.create(KamadaKawai.prototype);
|
|
919
|
+
obj.ptr = ptr;
|
|
920
|
+
|
|
921
|
+
return obj;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
__destroy_into_raw() {
|
|
925
|
+
const ptr = this.ptr;
|
|
926
|
+
this.ptr = 0;
|
|
927
|
+
|
|
928
|
+
return ptr;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
free() {
|
|
932
|
+
const ptr = this.__destroy_into_raw();
|
|
933
|
+
wasm.__wbg_kamadakawai_free(ptr);
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* @param {Graph} graph
|
|
937
|
+
* @param {Function} f
|
|
938
|
+
*/
|
|
939
|
+
constructor(graph, f) {
|
|
940
|
+
try {
|
|
941
|
+
_assertClass(graph, Graph);
|
|
942
|
+
var ret = wasm.kamadakawai_new(graph.ptr, addBorrowedObject(f));
|
|
943
|
+
return KamadaKawai.__wrap(ret);
|
|
944
|
+
} finally {
|
|
945
|
+
heap[stack_pointer++] = undefined;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* @param {Coordinates} coordinates
|
|
950
|
+
* @returns {number | undefined}
|
|
951
|
+
*/
|
|
952
|
+
selectNode(coordinates) {
|
|
953
|
+
try {
|
|
954
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
955
|
+
_assertClass(coordinates, Coordinates);
|
|
956
|
+
wasm.kamadakawai_selectNode(retptr, this.ptr, coordinates.ptr);
|
|
957
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
958
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
959
|
+
return r0 === 0 ? undefined : r1 >>> 0;
|
|
960
|
+
} finally {
|
|
961
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* @param {number} m
|
|
966
|
+
* @param {Coordinates} coordinates
|
|
967
|
+
*/
|
|
968
|
+
applyToNode(m, coordinates) {
|
|
969
|
+
_assertClass(coordinates, Coordinates);
|
|
970
|
+
wasm.kamadakawai_applyToNode(this.ptr, m, coordinates.ptr);
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* @param {Coordinates} coordinates
|
|
974
|
+
*/
|
|
975
|
+
run(coordinates) {
|
|
976
|
+
_assertClass(coordinates, Coordinates);
|
|
977
|
+
wasm.kamadakawai_run(this.ptr, coordinates.ptr);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
*/
|
|
982
|
+
export class LinkForce {
|
|
983
|
+
|
|
984
|
+
static __wrap(ptr) {
|
|
985
|
+
const obj = Object.create(LinkForce.prototype);
|
|
986
|
+
obj.ptr = ptr;
|
|
987
|
+
|
|
988
|
+
return obj;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
__destroy_into_raw() {
|
|
992
|
+
const ptr = this.ptr;
|
|
993
|
+
this.ptr = 0;
|
|
994
|
+
|
|
995
|
+
return ptr;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
free() {
|
|
999
|
+
const ptr = this.__destroy_into_raw();
|
|
531
1000
|
wasm.__wbg_linkforce_free(ptr);
|
|
532
1001
|
}
|
|
533
1002
|
/**
|
|
534
1003
|
* @param {Graph} graph
|
|
1004
|
+
* @param {Function} f
|
|
535
1005
|
*/
|
|
536
|
-
constructor(graph) {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
1006
|
+
constructor(graph, f) {
|
|
1007
|
+
try {
|
|
1008
|
+
_assertClass(graph, Graph);
|
|
1009
|
+
var ret = wasm.linkforce_new(graph.ptr, addBorrowedObject(f));
|
|
1010
|
+
return LinkForce.__wrap(ret);
|
|
1011
|
+
} finally {
|
|
1012
|
+
heap[stack_pointer++] = undefined;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* @param {Coordinates} coordinates
|
|
1017
|
+
* @param {number} alpha
|
|
1018
|
+
*/
|
|
1019
|
+
apply(coordinates, alpha) {
|
|
1020
|
+
_assertClass(coordinates, Coordinates);
|
|
1021
|
+
wasm.linkforce_apply(this.ptr, coordinates.ptr, alpha);
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* @param {number} u
|
|
1025
|
+
* @param {Coordinates} coordinates
|
|
1026
|
+
* @param {number} alpha
|
|
1027
|
+
*/
|
|
1028
|
+
applyToNode(u, coordinates, alpha) {
|
|
1029
|
+
_assertClass(coordinates, Coordinates);
|
|
1030
|
+
wasm.linkforce_applyToNode(this.ptr, u, coordinates.ptr, alpha);
|
|
540
1031
|
}
|
|
541
1032
|
}
|
|
542
1033
|
/**
|
|
543
1034
|
*/
|
|
544
1035
|
export class ManyBodyForce {
|
|
545
1036
|
|
|
546
|
-
|
|
1037
|
+
static __wrap(ptr) {
|
|
1038
|
+
const obj = Object.create(ManyBodyForce.prototype);
|
|
1039
|
+
obj.ptr = ptr;
|
|
1040
|
+
|
|
1041
|
+
return obj;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
__destroy_into_raw() {
|
|
547
1045
|
const ptr = this.ptr;
|
|
548
1046
|
this.ptr = 0;
|
|
549
1047
|
|
|
1048
|
+
return ptr;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
free() {
|
|
1052
|
+
const ptr = this.__destroy_into_raw();
|
|
550
1053
|
wasm.__wbg_manybodyforce_free(ptr);
|
|
551
1054
|
}
|
|
552
1055
|
/**
|
|
553
1056
|
* @param {Graph} graph
|
|
1057
|
+
* @param {Function} f
|
|
554
1058
|
*/
|
|
555
|
-
constructor(graph) {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
1059
|
+
constructor(graph, f) {
|
|
1060
|
+
try {
|
|
1061
|
+
_assertClass(graph, Graph);
|
|
1062
|
+
var ret = wasm.manybodyforce_new(graph.ptr, addBorrowedObject(f));
|
|
1063
|
+
return ManyBodyForce.__wrap(ret);
|
|
1064
|
+
} finally {
|
|
1065
|
+
heap[stack_pointer++] = undefined;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* @param {Coordinates} coordinates
|
|
1070
|
+
* @param {number} alpha
|
|
1071
|
+
*/
|
|
1072
|
+
apply(coordinates, alpha) {
|
|
1073
|
+
_assertClass(coordinates, Coordinates);
|
|
1074
|
+
wasm.manybodyforce_apply(this.ptr, coordinates.ptr, alpha);
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* @param {number} u
|
|
1078
|
+
* @param {Coordinates} coordinates
|
|
1079
|
+
* @param {number} alpha
|
|
1080
|
+
*/
|
|
1081
|
+
applyToNode(u, coordinates, alpha) {
|
|
1082
|
+
_assertClass(coordinates, Coordinates);
|
|
1083
|
+
wasm.manybodyforce_applyToNode(this.ptr, u, coordinates.ptr, alpha);
|
|
559
1084
|
}
|
|
560
1085
|
}
|
|
561
1086
|
/**
|
|
562
1087
|
*/
|
|
563
|
-
export class
|
|
1088
|
+
export class PositionForce {
|
|
564
1089
|
|
|
565
1090
|
static __wrap(ptr) {
|
|
566
|
-
const obj = Object.create(
|
|
1091
|
+
const obj = Object.create(PositionForce.prototype);
|
|
567
1092
|
obj.ptr = ptr;
|
|
568
1093
|
|
|
569
1094
|
return obj;
|
|
570
1095
|
}
|
|
571
1096
|
|
|
572
|
-
|
|
1097
|
+
__destroy_into_raw() {
|
|
573
1098
|
const ptr = this.ptr;
|
|
574
1099
|
this.ptr = 0;
|
|
575
1100
|
|
|
576
|
-
|
|
1101
|
+
return ptr;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
free() {
|
|
1105
|
+
const ptr = this.__destroy_into_raw();
|
|
1106
|
+
wasm.__wbg_positionforce_free(ptr);
|
|
577
1107
|
}
|
|
578
1108
|
/**
|
|
579
1109
|
* @param {Graph} graph
|
|
@@ -582,32 +1112,127 @@ export class Simulation {
|
|
|
582
1112
|
constructor(graph, f) {
|
|
583
1113
|
try {
|
|
584
1114
|
_assertClass(graph, Graph);
|
|
585
|
-
var ret = wasm.
|
|
586
|
-
return
|
|
1115
|
+
var ret = wasm.positionforce_new(graph.ptr, addBorrowedObject(f));
|
|
1116
|
+
return PositionForce.__wrap(ret);
|
|
587
1117
|
} finally {
|
|
588
1118
|
heap[stack_pointer++] = undefined;
|
|
589
1119
|
}
|
|
590
1120
|
}
|
|
591
1121
|
/**
|
|
592
|
-
* @param {
|
|
593
|
-
* @
|
|
1122
|
+
* @param {Coordinates} coordinates
|
|
1123
|
+
* @param {number} alpha
|
|
594
1124
|
*/
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
1125
|
+
apply(coordinates, alpha) {
|
|
1126
|
+
_assertClass(coordinates, Coordinates);
|
|
1127
|
+
wasm.positionforce_apply(this.ptr, coordinates.ptr, alpha);
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* @param {number} u
|
|
1131
|
+
* @param {Coordinates} coordinates
|
|
1132
|
+
* @param {number} alpha
|
|
1133
|
+
*/
|
|
1134
|
+
applyToNode(u, coordinates, alpha) {
|
|
1135
|
+
_assertClass(coordinates, Coordinates);
|
|
1136
|
+
wasm.positionforce_applyToNode(this.ptr, u, coordinates.ptr, alpha);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
*/
|
|
1141
|
+
export class RadialForce {
|
|
1142
|
+
|
|
1143
|
+
static __wrap(ptr) {
|
|
1144
|
+
const obj = Object.create(RadialForce.prototype);
|
|
1145
|
+
obj.ptr = ptr;
|
|
1146
|
+
|
|
1147
|
+
return obj;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
__destroy_into_raw() {
|
|
1151
|
+
const ptr = this.ptr;
|
|
1152
|
+
this.ptr = 0;
|
|
1153
|
+
|
|
1154
|
+
return ptr;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
free() {
|
|
1158
|
+
const ptr = this.__destroy_into_raw();
|
|
1159
|
+
wasm.__wbg_radialforce_free(ptr);
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* @param {Graph} graph
|
|
1163
|
+
* @param {Function} f
|
|
1164
|
+
*/
|
|
1165
|
+
constructor(graph, f) {
|
|
1166
|
+
_assertClass(graph, Graph);
|
|
1167
|
+
var ret = wasm.radialforce_new(graph.ptr, addHeapObject(f));
|
|
1168
|
+
return RadialForce.__wrap(ret);
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* @param {Coordinates} coordinates
|
|
1172
|
+
* @param {number} alpha
|
|
1173
|
+
*/
|
|
1174
|
+
apply(coordinates, alpha) {
|
|
1175
|
+
_assertClass(coordinates, Coordinates);
|
|
1176
|
+
wasm.radialforce_apply(this.ptr, coordinates.ptr, alpha);
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* @param {number} u
|
|
1180
|
+
* @param {Coordinates} coordinates
|
|
1181
|
+
* @param {number} alpha
|
|
1182
|
+
*/
|
|
1183
|
+
applyToNode(u, coordinates, alpha) {
|
|
1184
|
+
_assertClass(coordinates, Coordinates);
|
|
1185
|
+
wasm.radialforce_applyToNode(this.ptr, u, coordinates.ptr, alpha);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
*/
|
|
1190
|
+
export class Simulation {
|
|
1191
|
+
|
|
1192
|
+
static __wrap(ptr) {
|
|
1193
|
+
const obj = Object.create(Simulation.prototype);
|
|
1194
|
+
obj.ptr = ptr;
|
|
1195
|
+
|
|
1196
|
+
return obj;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
__destroy_into_raw() {
|
|
1200
|
+
const ptr = this.ptr;
|
|
1201
|
+
this.ptr = 0;
|
|
1202
|
+
|
|
1203
|
+
return ptr;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
free() {
|
|
1207
|
+
const ptr = this.__destroy_into_raw();
|
|
1208
|
+
wasm.__wbg_simulation_free(ptr);
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
*/
|
|
1212
|
+
constructor() {
|
|
1213
|
+
var ret = wasm.simulation_new();
|
|
1214
|
+
return Simulation.__wrap(ret);
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* @param {Function} f
|
|
1218
|
+
*/
|
|
1219
|
+
run(f) {
|
|
1220
|
+
try {
|
|
1221
|
+
wasm.simulation_run(this.ptr, addBorrowedObject(f));
|
|
1222
|
+
} finally {
|
|
1223
|
+
heap[stack_pointer++] = undefined;
|
|
1224
|
+
}
|
|
600
1225
|
}
|
|
601
1226
|
/**
|
|
602
1227
|
* @param {number} n
|
|
603
|
-
* @param {
|
|
604
|
-
* @returns {any}
|
|
1228
|
+
* @param {Function} f
|
|
605
1229
|
*/
|
|
606
|
-
runStep(n,
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
1230
|
+
runStep(n, f) {
|
|
1231
|
+
try {
|
|
1232
|
+
wasm.simulation_runStep(this.ptr, n, addBorrowedObject(f));
|
|
1233
|
+
} finally {
|
|
1234
|
+
heap[stack_pointer++] = undefined;
|
|
1235
|
+
}
|
|
611
1236
|
}
|
|
612
1237
|
/**
|
|
613
1238
|
* @returns {boolean}
|
|
@@ -633,7 +1258,7 @@ export class Simulation {
|
|
|
633
1258
|
* @param {number} value
|
|
634
1259
|
*/
|
|
635
1260
|
set alphaStart(value) {
|
|
636
|
-
wasm.
|
|
1261
|
+
wasm.simulation_set_alpha(this.ptr, value);
|
|
637
1262
|
}
|
|
638
1263
|
/**
|
|
639
1264
|
* @returns {number}
|
|
@@ -664,34 +1289,129 @@ export class Simulation {
|
|
|
664
1289
|
/**
|
|
665
1290
|
* @returns {number}
|
|
666
1291
|
*/
|
|
667
|
-
get
|
|
668
|
-
var ret = wasm.
|
|
669
|
-
return ret;
|
|
1292
|
+
get iterations() {
|
|
1293
|
+
var ret = wasm.simulation_iterations(this.ptr);
|
|
1294
|
+
return ret >>> 0;
|
|
670
1295
|
}
|
|
671
1296
|
/**
|
|
672
1297
|
* @param {number} value
|
|
673
1298
|
*/
|
|
674
|
-
set
|
|
675
|
-
wasm.
|
|
1299
|
+
set iterations(value) {
|
|
1300
|
+
wasm.simulation_set_iterations(this.ptr, value);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
*/
|
|
1305
|
+
export class SphericalSpace {
|
|
1306
|
+
|
|
1307
|
+
__destroy_into_raw() {
|
|
1308
|
+
const ptr = this.ptr;
|
|
1309
|
+
this.ptr = 0;
|
|
1310
|
+
|
|
1311
|
+
return ptr;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
free() {
|
|
1315
|
+
const ptr = this.__destroy_into_raw();
|
|
1316
|
+
wasm.__wbg_sphericalspace_free(ptr);
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* @param {any} a
|
|
1320
|
+
* @param {any} b
|
|
1321
|
+
* @returns {any}
|
|
1322
|
+
*/
|
|
1323
|
+
static toTangentSpace(a, b) {
|
|
1324
|
+
var ret = wasm.sphericalspace_toTangentSpace(addHeapObject(a), addHeapObject(b));
|
|
1325
|
+
return takeObject(ret);
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* @param {any} a
|
|
1329
|
+
* @param {any} b
|
|
1330
|
+
* @returns {any}
|
|
1331
|
+
*/
|
|
1332
|
+
static fromTangentSpace(a, b) {
|
|
1333
|
+
var ret = wasm.sphericalspace_fromTangentSpace(addHeapObject(a), addHeapObject(b));
|
|
1334
|
+
return takeObject(ret);
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* @param {number} i
|
|
1338
|
+
* @param {Coordinates} riemann_space
|
|
1339
|
+
* @param {Coordinates} tangent_space
|
|
1340
|
+
*/
|
|
1341
|
+
static mapToTangentSpace(i, riemann_space, tangent_space) {
|
|
1342
|
+
_assertClass(riemann_space, Coordinates);
|
|
1343
|
+
_assertClass(tangent_space, Coordinates);
|
|
1344
|
+
wasm.sphericalspace_mapToTangentSpace(i, riemann_space.ptr, tangent_space.ptr);
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* @param {number} i
|
|
1348
|
+
* @param {Coordinates} riemann_space
|
|
1349
|
+
* @param {Coordinates} tangent_space
|
|
1350
|
+
* @param {number} velocity_decay
|
|
1351
|
+
*/
|
|
1352
|
+
static updatePosition(i, riemann_space, tangent_space, velocity_decay) {
|
|
1353
|
+
_assertClass(riemann_space, Coordinates);
|
|
1354
|
+
_assertClass(tangent_space, Coordinates);
|
|
1355
|
+
wasm.sphericalspace_updatePosition(i, riemann_space.ptr, tangent_space.ptr, velocity_decay);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
*/
|
|
1360
|
+
export class StressMajorization {
|
|
1361
|
+
|
|
1362
|
+
static __wrap(ptr) {
|
|
1363
|
+
const obj = Object.create(StressMajorization.prototype);
|
|
1364
|
+
obj.ptr = ptr;
|
|
1365
|
+
|
|
1366
|
+
return obj;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
__destroy_into_raw() {
|
|
1370
|
+
const ptr = this.ptr;
|
|
1371
|
+
this.ptr = 0;
|
|
1372
|
+
|
|
1373
|
+
return ptr;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
free() {
|
|
1377
|
+
const ptr = this.__destroy_into_raw();
|
|
1378
|
+
wasm.__wbg_stressmajorization_free(ptr);
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* @param {Graph} graph
|
|
1382
|
+
* @param {Coordinates} coordinates
|
|
1383
|
+
* @param {Function} f
|
|
1384
|
+
*/
|
|
1385
|
+
constructor(graph, coordinates, f) {
|
|
1386
|
+
try {
|
|
1387
|
+
_assertClass(graph, Graph);
|
|
1388
|
+
_assertClass(coordinates, Coordinates);
|
|
1389
|
+
var ret = wasm.stressmajorization_new(graph.ptr, coordinates.ptr, addBorrowedObject(f));
|
|
1390
|
+
return StressMajorization.__wrap(ret);
|
|
1391
|
+
} finally {
|
|
1392
|
+
heap[stack_pointer++] = undefined;
|
|
1393
|
+
}
|
|
676
1394
|
}
|
|
677
1395
|
/**
|
|
1396
|
+
* @param {Coordinates} coordinates
|
|
678
1397
|
* @returns {number}
|
|
679
1398
|
*/
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
1399
|
+
apply(coordinates) {
|
|
1400
|
+
_assertClass(coordinates, Coordinates);
|
|
1401
|
+
var ret = wasm.stressmajorization_apply(this.ptr, coordinates.ptr);
|
|
1402
|
+
return ret;
|
|
683
1403
|
}
|
|
684
1404
|
/**
|
|
685
|
-
* @param {
|
|
1405
|
+
* @param {Coordinates} coordinates
|
|
686
1406
|
*/
|
|
687
|
-
|
|
688
|
-
|
|
1407
|
+
run(coordinates) {
|
|
1408
|
+
_assertClass(coordinates, Coordinates);
|
|
1409
|
+
wasm.stressmajorization_run(this.ptr, coordinates.ptr);
|
|
689
1410
|
}
|
|
690
1411
|
}
|
|
691
1412
|
|
|
692
1413
|
async function load(module, imports) {
|
|
693
1414
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
694
|
-
|
|
695
1415
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
696
1416
|
try {
|
|
697
1417
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
@@ -710,7 +1430,6 @@ async function load(module, imports) {
|
|
|
710
1430
|
return await WebAssembly.instantiate(bytes, imports);
|
|
711
1431
|
|
|
712
1432
|
} else {
|
|
713
|
-
|
|
714
1433
|
const instance = await WebAssembly.instantiate(module, imports);
|
|
715
1434
|
|
|
716
1435
|
if (instance instanceof WebAssembly.Instance) {
|
|
@@ -724,14 +1443,10 @@ async function load(module, imports) {
|
|
|
724
1443
|
|
|
725
1444
|
async function init(input) {
|
|
726
1445
|
if (typeof input === 'undefined') {
|
|
727
|
-
input = import.meta.url
|
|
1446
|
+
input = new URL('egraph_wasm_bg.wasm', import.meta.url);
|
|
728
1447
|
}
|
|
729
1448
|
const imports = {};
|
|
730
1449
|
imports.wbg = {};
|
|
731
|
-
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
732
|
-
var ret = getStringFromWasm0(arg0, arg1);
|
|
733
|
-
return addHeapObject(ret);
|
|
734
|
-
};
|
|
735
1450
|
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
736
1451
|
var ret = arg0;
|
|
737
1452
|
return addHeapObject(ret);
|
|
@@ -739,6 +1454,28 @@ async function init(input) {
|
|
|
739
1454
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
740
1455
|
takeObject(arg0);
|
|
741
1456
|
};
|
|
1457
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
1458
|
+
var ret = getStringFromWasm0(arg0, arg1);
|
|
1459
|
+
return addHeapObject(ret);
|
|
1460
|
+
};
|
|
1461
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
1462
|
+
const obj = getObject(arg1);
|
|
1463
|
+
var ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1464
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
1465
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
1466
|
+
};
|
|
1467
|
+
imports.wbg.__wbg_graph_new = function(arg0) {
|
|
1468
|
+
var ret = Graph.__wrap(arg0);
|
|
1469
|
+
return addHeapObject(ret);
|
|
1470
|
+
};
|
|
1471
|
+
imports.wbg.__wbindgen_json_parse = function(arg0, arg1) {
|
|
1472
|
+
var ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
1473
|
+
return addHeapObject(ret);
|
|
1474
|
+
};
|
|
1475
|
+
imports.wbg.__wbindgen_is_null = function(arg0) {
|
|
1476
|
+
var ret = getObject(arg0) === null;
|
|
1477
|
+
return ret;
|
|
1478
|
+
};
|
|
742
1479
|
imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
|
|
743
1480
|
const obj = getObject(arg1);
|
|
744
1481
|
var ret = JSON.stringify(obj === undefined ? null : obj);
|
|
@@ -751,44 +1488,30 @@ async function init(input) {
|
|
|
751
1488
|
var ret = getObject(arg0);
|
|
752
1489
|
return addHeapObject(ret);
|
|
753
1490
|
};
|
|
754
|
-
imports.wbg.
|
|
755
|
-
var ret =
|
|
756
|
-
return
|
|
757
|
-
};
|
|
758
|
-
imports.wbg.__wbg_get_a8b9619536c590d4 = function(arg0, arg1) {
|
|
759
|
-
var ret = getObject(arg0)[arg1 >>> 0];
|
|
760
|
-
return addHeapObject(ret);
|
|
1491
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
1492
|
+
var ret = getObject(arg0) === undefined;
|
|
1493
|
+
return ret;
|
|
761
1494
|
};
|
|
762
|
-
imports.wbg.
|
|
1495
|
+
imports.wbg.__wbg_get_800098c980b31ea2 = function() { return handleError(function (arg0, arg1) {
|
|
763
1496
|
var ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
764
1497
|
return addHeapObject(ret);
|
|
765
|
-
});
|
|
766
|
-
imports.wbg.
|
|
1498
|
+
}, arguments) };
|
|
1499
|
+
imports.wbg.__wbg_new_515b65a8e7699d00 = function() {
|
|
767
1500
|
var ret = new Array();
|
|
768
1501
|
return addHeapObject(ret);
|
|
769
1502
|
};
|
|
770
|
-
imports.wbg.
|
|
1503
|
+
imports.wbg.__wbg_push_b7f68478f81d358b = function(arg0, arg1) {
|
|
771
1504
|
var ret = getObject(arg0).push(getObject(arg1));
|
|
772
1505
|
return ret;
|
|
773
1506
|
};
|
|
774
|
-
imports.wbg.
|
|
1507
|
+
imports.wbg.__wbg_call_3fc07b7d5fc9022d = function() { return handleError(function (arg0, arg1, arg2) {
|
|
775
1508
|
var ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
776
1509
|
return addHeapObject(ret);
|
|
777
|
-
});
|
|
778
|
-
imports.wbg.
|
|
779
|
-
var ret =
|
|
1510
|
+
}, arguments) };
|
|
1511
|
+
imports.wbg.__wbg_call_2c06c503c0d359bd = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1512
|
+
var ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
|
|
780
1513
|
return addHeapObject(ret);
|
|
781
|
-
};
|
|
782
|
-
imports.wbg.__wbg_set_3afd31f38e771338 = handleError(function(arg0, arg1, arg2) {
|
|
783
|
-
var ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
784
|
-
return ret;
|
|
785
|
-
});
|
|
786
|
-
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
787
|
-
const obj = getObject(arg1);
|
|
788
|
-
var ret = typeof(obj) === 'number' ? obj : undefined;
|
|
789
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
790
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
791
|
-
};
|
|
1514
|
+
}, arguments) };
|
|
792
1515
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
793
1516
|
var ret = debugString(getObject(arg1));
|
|
794
1517
|
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -807,6 +1530,8 @@ async function init(input) {
|
|
|
807
1530
|
input = fetch(input);
|
|
808
1531
|
}
|
|
809
1532
|
|
|
1533
|
+
|
|
1534
|
+
|
|
810
1535
|
const { instance, module } = await load(await input, imports);
|
|
811
1536
|
|
|
812
1537
|
wasm = instance.exports;
|