egraph 6.0.0-alpha.1 → 6.0.0-alpha.3

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/umd/egraph.js CHANGED
@@ -6,27 +6,25 @@
6
6
 
7
7
  let wasm;
8
8
 
9
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
9
+ const heap = new Array(128).fill(undefined);
10
10
 
11
- cachedTextDecoder.decode();
12
-
13
- let cachegetUint8Memory0 = null;
14
- function getUint8Memory0() {
15
- if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
16
- cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
17
- }
18
- return cachegetUint8Memory0;
19
- }
11
+ heap.push(undefined, null, true, false);
20
12
 
21
- function getStringFromWasm0(ptr, len) {
22
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
23
- }
13
+ function getObject(idx) { return heap[idx]; }
24
14
 
25
- const heap = new Array(32).fill(undefined);
15
+ let heap_next = heap.length;
26
16
 
27
- heap.push(undefined, null, true, false);
17
+ function dropObject(idx) {
18
+ if (idx < 132) return;
19
+ heap[idx] = heap_next;
20
+ heap_next = idx;
21
+ }
28
22
 
29
- let heap_next = heap.length;
23
+ function takeObject(idx) {
24
+ const ret = getObject(idx);
25
+ dropObject(idx);
26
+ return ret;
27
+ }
30
28
 
31
29
  function addHeapObject(obj) {
32
30
  if (heap_next === heap.length) heap.push(heap.length + 1);
@@ -37,23 +35,48 @@
37
35
  return idx;
38
36
  }
39
37
 
40
- function getObject(idx) { return heap[idx]; }
38
+ const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
41
39
 
42
- function dropObject(idx) {
43
- if (idx < 36) return;
44
- heap[idx] = heap_next;
45
- heap_next = idx;
40
+ cachedTextDecoder.decode();
41
+
42
+ let cachedUint8Memory0 = null;
43
+
44
+ function getUint8Memory0() {
45
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
46
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
47
+ }
48
+ return cachedUint8Memory0;
46
49
  }
47
50
 
48
- function takeObject(idx) {
49
- const ret = getObject(idx);
50
- dropObject(idx);
51
- return ret;
51
+ function getStringFromWasm0(ptr, len) {
52
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
53
+ }
54
+
55
+ function isLikeNone(x) {
56
+ return x === undefined || x === null;
57
+ }
58
+
59
+ let cachedFloat64Memory0 = null;
60
+
61
+ function getFloat64Memory0() {
62
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
63
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
64
+ }
65
+ return cachedFloat64Memory0;
66
+ }
67
+
68
+ let cachedInt32Memory0 = null;
69
+
70
+ function getInt32Memory0() {
71
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
72
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
73
+ }
74
+ return cachedInt32Memory0;
52
75
  }
53
76
 
54
77
  let WASM_VECTOR_LEN = 0;
55
78
 
56
- let cachedTextEncoder = new TextEncoder('utf-8');
79
+ const cachedTextEncoder = new TextEncoder('utf-8');
57
80
 
58
81
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
59
82
  ? function (arg, view) {
@@ -106,24 +129,13 @@
106
129
  return ptr;
107
130
  }
108
131
 
109
- let cachegetInt32Memory0 = null;
110
- function getInt32Memory0() {
111
- if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
112
- cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
113
- }
114
- return cachegetInt32Memory0;
115
- }
116
-
117
- function isLikeNone(x) {
118
- return x === undefined || x === null;
119
- }
132
+ let cachedBigInt64Memory0 = null;
120
133
 
121
- let cachegetFloat64Memory0 = null;
122
- function getFloat64Memory0() {
123
- if (cachegetFloat64Memory0 === null || cachegetFloat64Memory0.buffer !== wasm.memory.buffer) {
124
- cachegetFloat64Memory0 = new Float64Array(wasm.memory.buffer);
134
+ function getBigInt64Memory0() {
135
+ if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
136
+ cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
125
137
  }
126
- return cachegetFloat64Memory0;
138
+ return cachedBigInt64Memory0;
127
139
  }
128
140
 
129
141
  function debugString(val) {
@@ -199,35 +211,25 @@
199
211
  }
200
212
  /**
201
213
  * @param {Graph} graph
214
+ * @param {any} coordinates
202
215
  * @returns {any}
203
216
  */
204
- function initialPlacement(graph) {
217
+ function fdeb(graph, coordinates) {
205
218
  _assertClass(graph, Graph);
206
- var ret = wasm.initialPlacement(graph.ptr);
219
+ const ret = wasm.fdeb(graph.ptr, addHeapObject(coordinates));
207
220
  return takeObject(ret);
208
221
  }
209
222
 
210
- /**
211
- * @param {Graph} graph
212
- * @returns {Array<any>}
213
- */
214
- function forceConnected(graph) {
215
- _assertClass(graph, Graph);
216
- var ret = wasm.forceConnected(graph.ptr);
217
- return takeObject(ret);
218
- }
223
+ let cachedFloat32Memory0 = null;
219
224
 
220
- /**
221
- * @param {Graph} graph
222
- * @returns {Array<any>}
223
- */
224
- function forceNonconnected(graph) {
225
- _assertClass(graph, Graph);
226
- var ret = wasm.forceNonconnected(graph.ptr);
227
- return takeObject(ret);
225
+ function getFloat32Memory0() {
226
+ if (cachedFloat32Memory0 === null || cachedFloat32Memory0.byteLength === 0) {
227
+ cachedFloat32Memory0 = new Float32Array(wasm.memory.buffer);
228
+ }
229
+ return cachedFloat32Memory0;
228
230
  }
229
231
 
230
- let stack_pointer = 32;
232
+ let stack_pointer = 128;
231
233
 
232
234
  function addBorrowedObject(obj) {
233
235
  if (stack_pointer == 1) throw new Error('out of js stack');
@@ -236,49 +238,65 @@
236
238
  }
237
239
  /**
238
240
  * @param {Graph} graph
239
- * @param {Function} group_accessor
240
- * @returns {Array<any>}
241
+ * @param {Function} groups
242
+ * @param {Function} shrink_node
243
+ * @param {Function} shrink_edge
244
+ * @returns {any}
241
245
  */
242
- function forceGrouped(graph, group_accessor) {
246
+ function coarsen(graph, groups, shrink_node, shrink_edge) {
243
247
  try {
248
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
244
249
  _assertClass(graph, Graph);
245
- var ret = wasm.forceGrouped(graph.ptr, addBorrowedObject(group_accessor));
246
- return takeObject(ret);
250
+ wasm.coarsen(retptr, graph.ptr, addBorrowedObject(groups), addBorrowedObject(shrink_node), addBorrowedObject(shrink_edge));
251
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
252
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
253
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
254
+ if (r2) {
255
+ throw takeObject(r1);
256
+ }
257
+ return takeObject(r0);
247
258
  } finally {
259
+ wasm.__wbindgen_add_to_stack_pointer(16);
260
+ heap[stack_pointer++] = undefined;
261
+ heap[stack_pointer++] = undefined;
248
262
  heap[stack_pointer++] = undefined;
249
263
  }
250
264
  }
251
265
 
252
- let cachegetUint32Memory0 = null;
253
- function getUint32Memory0() {
254
- if (cachegetUint32Memory0 === null || cachegetUint32Memory0.buffer !== wasm.memory.buffer) {
255
- cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer);
256
- }
257
- return cachegetUint32Memory0;
266
+ /**
267
+ * @param {Graph} graph
268
+ * @param {Drawing} drawing
269
+ * @returns {number}
270
+ */
271
+ function stress(graph, drawing) {
272
+ _assertClass(graph, Graph);
273
+ _assertClass(drawing, Drawing);
274
+ const ret = wasm.stress(graph.ptr, drawing.ptr);
275
+ return ret;
258
276
  }
259
277
 
260
- function passArrayJsValueToWasm0(array, malloc) {
261
- const ptr = malloc(array.length * 4);
262
- const mem = getUint32Memory0();
263
- for (let i = 0; i < array.length; i++) {
264
- mem[ptr / 4 + i] = addHeapObject(array[i]);
265
- }
266
- WASM_VECTOR_LEN = array.length;
267
- return ptr;
278
+ /**
279
+ * @param {Graph} graph
280
+ * @param {Drawing} drawing
281
+ * @returns {number}
282
+ */
283
+ function crossingNumber(graph, drawing) {
284
+ _assertClass(graph, Graph);
285
+ _assertClass(drawing, Drawing);
286
+ const ret = wasm.crossingNumber(graph.ptr, drawing.ptr);
287
+ return ret;
268
288
  }
289
+
269
290
  /**
270
291
  * @param {Graph} graph
271
- * @param {any} coordinates
272
- * @param {Function} _length
273
- * @param {number} eps
274
- * @param {number} width
275
- * @param {number} height
276
- * @returns {any}
292
+ * @param {Drawing} drawing
293
+ * @returns {number}
277
294
  */
278
- function kamadaKawai(graph, coordinates, _length, eps, width, height) {
295
+ function neighborhoodPreservation(graph, drawing) {
279
296
  _assertClass(graph, Graph);
280
- var ret = wasm.kamadaKawai(graph.ptr, addHeapObject(coordinates), addHeapObject(_length), eps, width, height);
281
- return takeObject(ret);
297
+ _assertClass(drawing, Drawing);
298
+ const ret = wasm.neighborhoodPreservation(graph.ptr, drawing.ptr);
299
+ return ret;
282
300
  }
283
301
 
284
302
  /**
@@ -288,109 +306,302 @@
288
306
  * @param {Function} _shrink_node
289
307
  * @param {Function} _shrink_edge
290
308
  * @param {Function} _link_distance_accessor
291
- * @returns {any}
309
+ * @returns {Coordinates}
292
310
  */
293
311
  function fm3(graph, min_size, step_iteration, _shrink_node, _shrink_edge, _link_distance_accessor) {
294
312
  _assertClass(graph, Graph);
295
- var ret = wasm.fm3(graph.ptr, min_size, step_iteration, addHeapObject(_shrink_node), addHeapObject(_shrink_edge), addHeapObject(_link_distance_accessor));
296
- return takeObject(ret);
313
+ const ret = wasm.fm3(graph.ptr, min_size, step_iteration, addHeapObject(_shrink_node), addHeapObject(_shrink_edge), addHeapObject(_link_distance_accessor));
314
+ return Coordinates.__wrap(ret);
297
315
  }
298
316
 
299
- /**
300
- * @param {Graph} graph
301
- * @param {any} coordinates
302
- * @returns {any}
303
- */
304
- function fdeb(graph, coordinates) {
317
+ function handleError(f, args) {
305
318
  try {
306
- _assertClass(graph, Graph);
307
- var ret = wasm.fdeb(graph.ptr, addBorrowedObject(coordinates));
308
- return takeObject(ret);
309
- } finally {
310
- heap[stack_pointer++] = undefined;
319
+ return f.apply(this, args);
320
+ } catch (e) {
321
+ wasm.__wbindgen_exn_store(addHeapObject(e));
311
322
  }
312
323
  }
313
324
 
314
- function handleError(f) {
315
- return function () {
316
- try {
317
- return f.apply(this, arguments);
318
-
319
- } catch (e) {
320
- wasm.__wbindgen_exn_store(addHeapObject(e));
321
- }
322
- };
325
+ function getArrayU8FromWasm0(ptr, len) {
326
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
323
327
  }
324
328
  /**
325
329
  */
326
- class CenterForce {
330
+ class ClassicalMds {
327
331
 
328
- free() {
332
+ static __wrap(ptr) {
333
+ const obj = Object.create(ClassicalMds.prototype);
334
+ obj.ptr = ptr;
335
+
336
+ return obj;
337
+ }
338
+
339
+ __destroy_into_raw() {
329
340
  const ptr = this.ptr;
330
341
  this.ptr = 0;
331
342
 
332
- wasm.__wbg_centerforce_free(ptr);
343
+ return ptr;
344
+ }
345
+
346
+ free() {
347
+ const ptr = this.__destroy_into_raw();
348
+ wasm.__wbg_classicalmds_free(ptr);
333
349
  }
334
350
  /**
335
351
  */
336
352
  constructor() {
337
- var ret = wasm.centerforce_new();
338
- return Force.__wrap(ret);
353
+ const ret = wasm.classicalmds_new();
354
+ return ClassicalMds.__wrap(ret);
355
+ }
356
+ /**
357
+ * @param {Graph} graph
358
+ * @param {Function} length
359
+ * @returns {Drawing}
360
+ */
361
+ run(graph, length) {
362
+ try {
363
+ _assertClass(graph, Graph);
364
+ const ret = wasm.classicalmds_run(this.ptr, graph.ptr, addBorrowedObject(length));
365
+ return Drawing.__wrap(ret);
366
+ } finally {
367
+ heap[stack_pointer++] = undefined;
368
+ }
339
369
  }
340
370
  }
341
371
  /**
342
372
  */
343
- class Force {
373
+ class CollideForce {
344
374
 
345
375
  static __wrap(ptr) {
346
- const obj = Object.create(Force.prototype);
376
+ const obj = Object.create(CollideForce.prototype);
347
377
  obj.ptr = ptr;
348
378
 
349
379
  return obj;
350
380
  }
351
381
 
352
- free() {
382
+ __destroy_into_raw() {
353
383
  const ptr = this.ptr;
354
384
  this.ptr = 0;
355
385
 
356
- wasm.__wbg_force_free(ptr);
386
+ return ptr;
387
+ }
388
+
389
+ free() {
390
+ const ptr = this.__destroy_into_raw();
391
+ wasm.__wbg_collideforce_free(ptr);
392
+ }
393
+ /**
394
+ * @param {Graph} graph
395
+ * @param {Function} f
396
+ * @param {any} options
397
+ */
398
+ constructor(graph, f, options) {
399
+ try {
400
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
401
+ _assertClass(graph, Graph);
402
+ wasm.collideforce_new(retptr, graph.ptr, addBorrowedObject(f), addBorrowedObject(options));
403
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
404
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
405
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
406
+ if (r2) {
407
+ throw takeObject(r1);
408
+ }
409
+ return CollideForce.__wrap(r0);
410
+ } finally {
411
+ wasm.__wbindgen_add_to_stack_pointer(16);
412
+ heap[stack_pointer++] = undefined;
413
+ heap[stack_pointer++] = undefined;
414
+ }
415
+ }
416
+ /**
417
+ * @param {Coordinates} context
418
+ * @param {number} alpha
419
+ */
420
+ apply(context, alpha) {
421
+ _assertClass(context, Coordinates);
422
+ wasm.collideforce_apply(this.ptr, context.ptr, alpha);
357
423
  }
358
424
  }
359
425
  /**
360
426
  */
361
- class Graph {
427
+ class Coordinates {
362
428
 
363
429
  static __wrap(ptr) {
364
- const obj = Object.create(Graph.prototype);
430
+ const obj = Object.create(Coordinates.prototype);
365
431
  obj.ptr = ptr;
366
432
 
367
433
  return obj;
368
434
  }
369
435
 
436
+ __destroy_into_raw() {
437
+ const ptr = this.ptr;
438
+ this.ptr = 0;
439
+
440
+ return ptr;
441
+ }
442
+
370
443
  free() {
444
+ const ptr = this.__destroy_into_raw();
445
+ wasm.__wbg_coordinates_free(ptr);
446
+ }
447
+ /**
448
+ * @param {number} u
449
+ * @returns {number | undefined}
450
+ */
451
+ x(u) {
452
+ try {
453
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
454
+ wasm.coordinates_x(retptr, this.ptr, u);
455
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
456
+ var r1 = getFloat32Memory0()[retptr / 4 + 1];
457
+ return r0 === 0 ? undefined : r1;
458
+ } finally {
459
+ wasm.__wbindgen_add_to_stack_pointer(16);
460
+ }
461
+ }
462
+ /**
463
+ * @param {number} u
464
+ * @returns {number | undefined}
465
+ */
466
+ y(u) {
467
+ try {
468
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
469
+ wasm.coordinates_y(retptr, this.ptr, u);
470
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
471
+ var r1 = getFloat32Memory0()[retptr / 4 + 1];
472
+ return r0 === 0 ? undefined : r1;
473
+ } finally {
474
+ wasm.__wbindgen_add_to_stack_pointer(16);
475
+ }
476
+ }
477
+ /**
478
+ * @param {number} u
479
+ * @param {number} x
480
+ */
481
+ setX(u, x) {
482
+ wasm.coordinates_setX(this.ptr, u, x);
483
+ }
484
+ /**
485
+ * @param {number} u
486
+ * @param {number} y
487
+ */
488
+ setY(u, y) {
489
+ wasm.coordinates_setY(this.ptr, u, y);
490
+ }
491
+ /**
492
+ * @param {number} u
493
+ * @returns {number | undefined}
494
+ */
495
+ vx(u) {
496
+ try {
497
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
498
+ wasm.coordinates_vx(retptr, this.ptr, u);
499
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
500
+ var r1 = getFloat32Memory0()[retptr / 4 + 1];
501
+ return r0 === 0 ? undefined : r1;
502
+ } finally {
503
+ wasm.__wbindgen_add_to_stack_pointer(16);
504
+ }
505
+ }
506
+ /**
507
+ * @param {number} u
508
+ * @returns {number | undefined}
509
+ */
510
+ vy(u) {
511
+ try {
512
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
513
+ wasm.coordinates_vy(retptr, this.ptr, u);
514
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
515
+ var r1 = getFloat32Memory0()[retptr / 4 + 1];
516
+ return r0 === 0 ? undefined : r1;
517
+ } finally {
518
+ wasm.__wbindgen_add_to_stack_pointer(16);
519
+ }
520
+ }
521
+ /**
522
+ * @returns {number}
523
+ */
524
+ len() {
525
+ const ret = wasm.coordinates_len(this.ptr);
526
+ return ret >>> 0;
527
+ }
528
+ /**
529
+ * @returns {any}
530
+ */
531
+ toJSON() {
532
+ const ret = wasm.coordinates_toJSON(this.ptr);
533
+ return takeObject(ret);
534
+ }
535
+ /**
536
+ */
537
+ centralize() {
538
+ wasm.coordinates_centralize(this.ptr);
539
+ }
540
+ /**
541
+ * @param {number} velocity_decay
542
+ */
543
+ updatePosition(velocity_decay) {
544
+ wasm.coordinates_updatePosition(this.ptr, velocity_decay);
545
+ }
546
+ /**
547
+ * @param {number} x0
548
+ * @param {number} y0
549
+ * @param {number} x1
550
+ * @param {number} y1
551
+ */
552
+ clampRegion(x0, y0, x1, y1) {
553
+ wasm.coordinates_clampRegion(this.ptr, x0, y0, x1, y1);
554
+ }
555
+ /**
556
+ * @param {Graph} graph
557
+ * @returns {Coordinates}
558
+ */
559
+ static initialPlacement(graph) {
560
+ _assertClass(graph, Graph);
561
+ const ret = wasm.coordinates_initialPlacement(graph.ptr);
562
+ return Coordinates.__wrap(ret);
563
+ }
564
+ }
565
+ /**
566
+ */
567
+ class DiGraph {
568
+
569
+ static __wrap(ptr) {
570
+ const obj = Object.create(DiGraph.prototype);
571
+ obj.ptr = ptr;
572
+
573
+ return obj;
574
+ }
575
+
576
+ __destroy_into_raw() {
371
577
  const ptr = this.ptr;
372
578
  this.ptr = 0;
373
579
 
374
- wasm.__wbg_graph_free(ptr);
580
+ return ptr;
581
+ }
582
+
583
+ free() {
584
+ const ptr = this.__destroy_into_raw();
585
+ wasm.__wbg_digraph_free(ptr);
375
586
  }
376
587
  /**
377
588
  */
378
589
  constructor() {
379
- var ret = wasm.graph_new();
380
- return Graph.__wrap(ret);
590
+ const ret = wasm.digraph_new();
591
+ return DiGraph.__wrap(ret);
381
592
  }
382
593
  /**
383
594
  * @returns {number}
384
595
  */
385
596
  nodeCount() {
386
- var ret = wasm.graph_nodeCount(this.ptr);
597
+ const ret = wasm.digraph_nodeCount(this.ptr);
387
598
  return ret >>> 0;
388
599
  }
389
600
  /**
390
601
  * @returns {number}
391
602
  */
392
603
  edgeCount() {
393
- var ret = wasm.graph_edgeCount(this.ptr);
604
+ const ret = wasm.digraph_edgeCount(this.ptr);
394
605
  return ret >>> 0;
395
606
  }
396
607
  /**
@@ -398,7 +609,7 @@
398
609
  * @returns {number}
399
610
  */
400
611
  addNode(value) {
401
- var ret = wasm.graph_addNode(this.ptr, addHeapObject(value));
612
+ const ret = wasm.digraph_addNode(this.ptr, addHeapObject(value));
402
613
  return ret >>> 0;
403
614
  }
404
615
  /**
@@ -406,8 +617,19 @@
406
617
  * @returns {any}
407
618
  */
408
619
  nodeWeight(a) {
409
- var ret = wasm.graph_nodeWeight(this.ptr, a);
410
- return takeObject(ret);
620
+ try {
621
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
622
+ wasm.digraph_nodeWeight(retptr, this.ptr, a);
623
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
624
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
625
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
626
+ if (r2) {
627
+ throw takeObject(r1);
628
+ }
629
+ return takeObject(r0);
630
+ } finally {
631
+ wasm.__wbindgen_add_to_stack_pointer(16);
632
+ }
411
633
  }
412
634
  /**
413
635
  * @param {number} a
@@ -416,7 +638,7 @@
416
638
  * @returns {number}
417
639
  */
418
640
  addEdge(a, b, value) {
419
- var ret = wasm.graph_addEdge(this.ptr, a, b, addHeapObject(value));
641
+ const ret = wasm.digraph_addEdge(this.ptr, a, b, addHeapObject(value));
420
642
  return ret >>> 0;
421
643
  }
422
644
  /**
@@ -424,39 +646,83 @@
424
646
  * @returns {any}
425
647
  */
426
648
  edgeWeight(e) {
427
- var ret = wasm.graph_edgeWeight(this.ptr, e);
428
- return takeObject(ret);
649
+ try {
650
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
651
+ wasm.digraph_edgeWeight(retptr, this.ptr, e);
652
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
653
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
654
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
655
+ if (r2) {
656
+ throw takeObject(r1);
657
+ }
658
+ return takeObject(r0);
659
+ } finally {
660
+ wasm.__wbindgen_add_to_stack_pointer(16);
661
+ }
429
662
  }
430
663
  /**
431
664
  * @param {number} e
432
665
  * @returns {Array<any>}
433
666
  */
434
667
  edgeEndpoints(e) {
435
- var ret = wasm.graph_edgeEndpoints(this.ptr, e);
436
- return takeObject(ret);
668
+ try {
669
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
670
+ wasm.digraph_edgeEndpoints(retptr, this.ptr, e);
671
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
672
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
673
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
674
+ if (r2) {
675
+ throw takeObject(r1);
676
+ }
677
+ return takeObject(r0);
678
+ } finally {
679
+ wasm.__wbindgen_add_to_stack_pointer(16);
680
+ }
437
681
  }
438
682
  /**
439
683
  * @param {number} a
440
684
  * @returns {any}
441
685
  */
442
686
  removeNode(a) {
443
- var ret = wasm.graph_removeNode(this.ptr, a);
444
- return takeObject(ret);
687
+ try {
688
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
689
+ wasm.digraph_removeNode(retptr, this.ptr, a);
690
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
691
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
692
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
693
+ if (r2) {
694
+ throw takeObject(r1);
695
+ }
696
+ return takeObject(r0);
697
+ } finally {
698
+ wasm.__wbindgen_add_to_stack_pointer(16);
699
+ }
445
700
  }
446
701
  /**
447
702
  * @param {number} e
448
703
  * @returns {any}
449
704
  */
450
705
  removeEdge(e) {
451
- var ret = wasm.graph_removeEdge(this.ptr, e);
452
- return takeObject(ret);
706
+ try {
707
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
708
+ wasm.digraph_removeEdge(retptr, this.ptr, e);
709
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
710
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
711
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
712
+ if (r2) {
713
+ throw takeObject(r1);
714
+ }
715
+ return takeObject(r0);
716
+ } finally {
717
+ wasm.__wbindgen_add_to_stack_pointer(16);
718
+ }
453
719
  }
454
720
  /**
455
721
  * @param {number} a
456
722
  * @returns {Array<any>}
457
723
  */
458
724
  neighbors(a) {
459
- var ret = wasm.graph_neighbors(this.ptr, a);
725
+ const ret = wasm.digraph_neighbors(this.ptr, a);
460
726
  return takeObject(ret);
461
727
  }
462
728
  /**
@@ -465,7 +731,7 @@
465
731
  * @returns {Array<any>}
466
732
  */
467
733
  neighborsDirected(a, dir) {
468
- var ret = wasm.graph_neighborsDirected(this.ptr, a, dir);
734
+ const ret = wasm.digraph_neighborsDirected(this.ptr, a, dir);
469
735
  return takeObject(ret);
470
736
  }
471
737
  /**
@@ -473,7 +739,7 @@
473
739
  * @returns {Array<any>}
474
740
  */
475
741
  neighborsUndirected(a) {
476
- var ret = wasm.graph_neighborsUndirected(this.ptr, a);
742
+ const ret = wasm.digraph_neighborsUndirected(this.ptr, a);
477
743
  return takeObject(ret);
478
744
  }
479
745
  /**
@@ -481,7 +747,7 @@
481
747
  * @returns {Array<any>}
482
748
  */
483
749
  edges(a) {
484
- var ret = wasm.graph_edges(this.ptr, a);
750
+ const ret = wasm.digraph_edges(this.ptr, a);
485
751
  return takeObject(ret);
486
752
  }
487
753
  /**
@@ -490,7 +756,7 @@
490
756
  * @returns {boolean}
491
757
  */
492
758
  containsEdge(a, b) {
493
- var ret = wasm.graph_containsEdge(this.ptr, a, b);
759
+ const ret = wasm.digraph_containsEdge(this.ptr, a, b);
494
760
  return ret !== 0;
495
761
  }
496
762
  /**
@@ -499,126 +765,1350 @@
499
765
  * @returns {number}
500
766
  */
501
767
  findEdge(a, b) {
502
- var ret = wasm.graph_findEdge(this.ptr, a, b);
503
- return ret >>> 0;
768
+ try {
769
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
770
+ wasm.digraph_findEdge(retptr, this.ptr, a, b);
771
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
772
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
773
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
774
+ if (r2) {
775
+ throw takeObject(r1);
776
+ }
777
+ return r0 >>> 0;
778
+ } finally {
779
+ wasm.__wbindgen_add_to_stack_pointer(16);
780
+ }
504
781
  }
505
782
  /**
506
783
  * @param {number} dir
507
784
  * @returns {Array<any>}
508
785
  */
509
786
  externals(dir) {
510
- var ret = wasm.graph_externals(this.ptr, dir);
787
+ const ret = wasm.digraph_externals(this.ptr, dir);
511
788
  return takeObject(ret);
512
789
  }
513
790
  /**
514
791
  * @returns {Array<any>}
515
792
  */
516
793
  nodeIndices() {
517
- var ret = wasm.graph_nodeIndices(this.ptr);
794
+ const ret = wasm.digraph_nodeIndices(this.ptr);
518
795
  return takeObject(ret);
519
796
  }
520
797
  /**
521
798
  * @returns {Array<any>}
522
799
  */
523
800
  edgeIndices() {
524
- var ret = wasm.graph_edgeIndices(this.ptr);
801
+ const ret = wasm.digraph_edgeIndices(this.ptr);
525
802
  return takeObject(ret);
526
803
  }
804
+ /**
805
+ * @param {Function} node_map
806
+ * @param {Function} edge_map
807
+ * @returns {DiGraph}
808
+ */
809
+ map(node_map, edge_map) {
810
+ try {
811
+ const ret = wasm.digraph_map(this.ptr, addBorrowedObject(node_map), addBorrowedObject(edge_map));
812
+ return DiGraph.__wrap(ret);
813
+ } finally {
814
+ heap[stack_pointer++] = undefined;
815
+ heap[stack_pointer++] = undefined;
816
+ }
817
+ }
818
+ /**
819
+ * @param {Function} node_map
820
+ * @param {Function} edge_map
821
+ * @returns {DiGraph}
822
+ */
823
+ filterMap(node_map, edge_map) {
824
+ try {
825
+ const ret = wasm.digraph_filterMap(this.ptr, addBorrowedObject(node_map), addBorrowedObject(edge_map));
826
+ return DiGraph.__wrap(ret);
827
+ } finally {
828
+ heap[stack_pointer++] = undefined;
829
+ heap[stack_pointer++] = undefined;
830
+ }
831
+ }
527
832
  }
528
833
  /**
529
834
  */
530
- class LinkForce {
835
+ class Drawing {
531
836
 
532
- free() {
837
+ static __wrap(ptr) {
838
+ const obj = Object.create(Drawing.prototype);
839
+ obj.ptr = ptr;
840
+
841
+ return obj;
842
+ }
843
+
844
+ __destroy_into_raw() {
533
845
  const ptr = this.ptr;
534
846
  this.ptr = 0;
535
847
 
536
- wasm.__wbg_linkforce_free(ptr);
848
+ return ptr;
849
+ }
850
+
851
+ free() {
852
+ const ptr = this.__destroy_into_raw();
853
+ wasm.__wbg_drawing_free(ptr);
854
+ }
855
+ /**
856
+ * @param {number} u
857
+ * @returns {number | undefined}
858
+ */
859
+ x(u) {
860
+ try {
861
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
862
+ wasm.drawing_x(retptr, this.ptr, u);
863
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
864
+ var r1 = getFloat32Memory0()[retptr / 4 + 1];
865
+ return r0 === 0 ? undefined : r1;
866
+ } finally {
867
+ wasm.__wbindgen_add_to_stack_pointer(16);
868
+ }
869
+ }
870
+ /**
871
+ * @param {number} u
872
+ * @returns {number | undefined}
873
+ */
874
+ y(u) {
875
+ try {
876
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
877
+ wasm.drawing_y(retptr, this.ptr, u);
878
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
879
+ var r1 = getFloat32Memory0()[retptr / 4 + 1];
880
+ return r0 === 0 ? undefined : r1;
881
+ } finally {
882
+ wasm.__wbindgen_add_to_stack_pointer(16);
883
+ }
884
+ }
885
+ /**
886
+ * @param {number} u
887
+ * @param {number} x
888
+ */
889
+ setX(u, x) {
890
+ wasm.drawing_setX(this.ptr, u, x);
891
+ }
892
+ /**
893
+ * @param {number} u
894
+ * @param {number} y
895
+ */
896
+ setY(u, y) {
897
+ wasm.drawing_setY(this.ptr, u, y);
898
+ }
899
+ /**
900
+ * @returns {number}
901
+ */
902
+ len() {
903
+ const ret = wasm.drawing_len(this.ptr);
904
+ return ret >>> 0;
905
+ }
906
+ /**
907
+ */
908
+ centralize() {
909
+ wasm.drawing_centralize(this.ptr);
910
+ }
911
+ /**
912
+ * @param {number} x0
913
+ * @param {number} y0
914
+ * @param {number} x1
915
+ * @param {number} y1
916
+ */
917
+ clampRegion(x0, y0, x1, y1) {
918
+ wasm.drawing_clampRegion(this.ptr, x0, y0, x1, y1);
537
919
  }
538
920
  /**
539
921
  * @param {Graph} graph
922
+ * @returns {Drawing}
540
923
  */
541
- constructor(graph) {
924
+ static initialPlacement(graph) {
542
925
  _assertClass(graph, Graph);
543
- var ret = wasm.linkforce_new(graph.ptr);
544
- return Force.__wrap(ret);
926
+ const ret = wasm.drawing_initialPlacement(graph.ptr);
927
+ return Drawing.__wrap(ret);
545
928
  }
546
929
  }
547
930
  /**
548
931
  */
549
- class ManyBodyForce {
932
+ class ForceAtlas2 {
550
933
 
551
- free() {
934
+ static __wrap(ptr) {
935
+ const obj = Object.create(ForceAtlas2.prototype);
936
+ obj.ptr = ptr;
937
+
938
+ return obj;
939
+ }
940
+
941
+ __destroy_into_raw() {
552
942
  const ptr = this.ptr;
553
943
  this.ptr = 0;
554
944
 
555
- wasm.__wbg_manybodyforce_free(ptr);
945
+ return ptr;
946
+ }
947
+
948
+ free() {
949
+ const ptr = this.__destroy_into_raw();
950
+ wasm.__wbg_forceatlas2_free(ptr);
556
951
  }
557
952
  /**
558
953
  * @param {Graph} graph
559
954
  */
560
955
  constructor(graph) {
561
956
  _assertClass(graph, Graph);
562
- var ret = wasm.manybodyforce_new(graph.ptr);
563
- return Force.__wrap(ret);
957
+ const ret = wasm.forceatlas2_new(graph.ptr);
958
+ return ForceAtlas2.__wrap(ret);
959
+ }
960
+ /**
961
+ * @param {Drawing} drawing
962
+ * @param {number} alpha
963
+ */
964
+ apply(drawing, alpha) {
965
+ _assertClass(drawing, Drawing);
966
+ wasm.forceatlas2_apply(this.ptr, drawing.ptr, alpha);
967
+ }
968
+ /**
969
+ * @param {number} u
970
+ * @param {Drawing} drawing
971
+ * @param {number} alpha
972
+ */
973
+ applyToNode(u, drawing, alpha) {
974
+ _assertClass(drawing, Drawing);
975
+ wasm.forceatlas2_applyToNode(this.ptr, u, drawing.ptr, alpha);
564
976
  }
565
977
  }
566
978
  /**
567
979
  */
568
- class Simulation {
980
+ class FruchtermanReingoldForce {
569
981
 
570
982
  static __wrap(ptr) {
571
- const obj = Object.create(Simulation.prototype);
983
+ const obj = Object.create(FruchtermanReingoldForce.prototype);
572
984
  obj.ptr = ptr;
573
985
 
574
986
  return obj;
575
987
  }
576
988
 
989
+ __destroy_into_raw() {
990
+ const ptr = this.ptr;
991
+ this.ptr = 0;
992
+
993
+ return ptr;
994
+ }
995
+
577
996
  free() {
997
+ const ptr = this.__destroy_into_raw();
998
+ wasm.__wbg_fruchtermanreingoldforce_free(ptr);
999
+ }
1000
+ /**
1001
+ * @param {Graph} graph
1002
+ * @param {number} k
1003
+ * @param {number} min_distance
1004
+ */
1005
+ constructor(graph, k, min_distance) {
1006
+ _assertClass(graph, Graph);
1007
+ const ret = wasm.fruchtermanreingoldforce_new(graph.ptr, k, min_distance);
1008
+ return FruchtermanReingoldForce.__wrap(ret);
1009
+ }
1010
+ /**
1011
+ * @param {Coordinates} coordinates
1012
+ * @param {number} alpha
1013
+ */
1014
+ apply(coordinates, alpha) {
1015
+ _assertClass(coordinates, Coordinates);
1016
+ wasm.fruchtermanreingoldforce_apply(this.ptr, coordinates.ptr, alpha);
1017
+ }
1018
+ /**
1019
+ * @param {number} u
1020
+ * @param {Coordinates} coordinates
1021
+ * @param {number} alpha
1022
+ */
1023
+ applyToNode(u, coordinates, alpha) {
1024
+ _assertClass(coordinates, Coordinates);
1025
+ wasm.fruchtermanreingoldforce_applyToNode(this.ptr, u, coordinates.ptr, alpha);
1026
+ }
1027
+ }
1028
+ /**
1029
+ */
1030
+ class FullSgd {
1031
+
1032
+ static __wrap(ptr) {
1033
+ const obj = Object.create(FullSgd.prototype);
1034
+ obj.ptr = ptr;
1035
+
1036
+ return obj;
1037
+ }
1038
+
1039
+ __destroy_into_raw() {
578
1040
  const ptr = this.ptr;
579
1041
  this.ptr = 0;
580
1042
 
581
- wasm.__wbg_simulation_free(ptr);
1043
+ return ptr;
1044
+ }
1045
+
1046
+ free() {
1047
+ const ptr = this.__destroy_into_raw();
1048
+ wasm.__wbg_fullsgd_free(ptr);
582
1049
  }
583
1050
  /**
584
1051
  * @param {Graph} graph
585
- * @param {Function} f
1052
+ * @param {Function} length
586
1053
  */
587
- constructor(graph, f) {
1054
+ constructor(graph, length) {
1055
+ try {
1056
+ _assertClass(graph, Graph);
1057
+ const ret = wasm.fullsgd_new(graph.ptr, addBorrowedObject(length));
1058
+ return FullSgd.__wrap(ret);
1059
+ } finally {
1060
+ heap[stack_pointer++] = undefined;
1061
+ }
1062
+ }
1063
+ /**
1064
+ * @param {Rng} rng
1065
+ */
1066
+ shuffle(rng) {
1067
+ _assertClass(rng, Rng);
1068
+ wasm.fullsgd_shuffle(this.ptr, rng.ptr);
1069
+ }
1070
+ /**
1071
+ * @param {Drawing} drawing
1072
+ * @param {number} eta
1073
+ */
1074
+ apply(drawing, eta) {
1075
+ _assertClass(drawing, Drawing);
1076
+ wasm.fullsgd_apply(this.ptr, drawing.ptr, eta);
1077
+ }
1078
+ /**
1079
+ * @param {number} t_max
1080
+ * @param {number} epsilon
1081
+ * @returns {SgdScheduler}
1082
+ */
1083
+ scheduler(t_max, epsilon) {
1084
+ const ret = wasm.fullsgd_scheduler(this.ptr, t_max, epsilon);
1085
+ return SgdScheduler.__wrap(ret);
1086
+ }
1087
+ }
1088
+ /**
1089
+ */
1090
+ class Graph {
1091
+
1092
+ static __wrap(ptr) {
1093
+ const obj = Object.create(Graph.prototype);
1094
+ obj.ptr = ptr;
1095
+
1096
+ return obj;
1097
+ }
1098
+
1099
+ __destroy_into_raw() {
1100
+ const ptr = this.ptr;
1101
+ this.ptr = 0;
1102
+
1103
+ return ptr;
1104
+ }
1105
+
1106
+ free() {
1107
+ const ptr = this.__destroy_into_raw();
1108
+ wasm.__wbg_graph_free(ptr);
1109
+ }
1110
+ /**
1111
+ */
1112
+ constructor() {
1113
+ const ret = wasm.digraph_new();
1114
+ return Graph.__wrap(ret);
1115
+ }
1116
+ /**
1117
+ * @returns {number}
1118
+ */
1119
+ nodeCount() {
1120
+ const ret = wasm.digraph_nodeCount(this.ptr);
1121
+ return ret >>> 0;
1122
+ }
1123
+ /**
1124
+ * @returns {number}
1125
+ */
1126
+ edgeCount() {
1127
+ const ret = wasm.digraph_edgeCount(this.ptr);
1128
+ return ret >>> 0;
1129
+ }
1130
+ /**
1131
+ * @param {any} value
1132
+ * @returns {number}
1133
+ */
1134
+ addNode(value) {
1135
+ const ret = wasm.digraph_addNode(this.ptr, addHeapObject(value));
1136
+ return ret >>> 0;
1137
+ }
1138
+ /**
1139
+ * @param {number} a
1140
+ * @returns {any}
1141
+ */
1142
+ nodeWeight(a) {
1143
+ try {
1144
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1145
+ wasm.digraph_nodeWeight(retptr, this.ptr, a);
1146
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1147
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1148
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1149
+ if (r2) {
1150
+ throw takeObject(r1);
1151
+ }
1152
+ return takeObject(r0);
1153
+ } finally {
1154
+ wasm.__wbindgen_add_to_stack_pointer(16);
1155
+ }
1156
+ }
1157
+ /**
1158
+ * @param {number} a
1159
+ * @param {number} b
1160
+ * @param {any} value
1161
+ * @returns {number}
1162
+ */
1163
+ addEdge(a, b, value) {
1164
+ const ret = wasm.graph_addEdge(this.ptr, a, b, addHeapObject(value));
1165
+ return ret >>> 0;
1166
+ }
1167
+ /**
1168
+ * @param {number} e
1169
+ * @returns {any}
1170
+ */
1171
+ edgeWeight(e) {
1172
+ try {
1173
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1174
+ wasm.digraph_edgeWeight(retptr, this.ptr, e);
1175
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1176
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1177
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1178
+ if (r2) {
1179
+ throw takeObject(r1);
1180
+ }
1181
+ return takeObject(r0);
1182
+ } finally {
1183
+ wasm.__wbindgen_add_to_stack_pointer(16);
1184
+ }
1185
+ }
1186
+ /**
1187
+ * @param {number} e
1188
+ * @returns {Array<any>}
1189
+ */
1190
+ edgeEndpoints(e) {
1191
+ try {
1192
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1193
+ wasm.digraph_edgeEndpoints(retptr, this.ptr, e);
1194
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1195
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1196
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1197
+ if (r2) {
1198
+ throw takeObject(r1);
1199
+ }
1200
+ return takeObject(r0);
1201
+ } finally {
1202
+ wasm.__wbindgen_add_to_stack_pointer(16);
1203
+ }
1204
+ }
1205
+ /**
1206
+ * @param {number} a
1207
+ * @returns {any}
1208
+ */
1209
+ removeNode(a) {
1210
+ try {
1211
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1212
+ wasm.graph_removeNode(retptr, this.ptr, a);
1213
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1214
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1215
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1216
+ if (r2) {
1217
+ throw takeObject(r1);
1218
+ }
1219
+ return takeObject(r0);
1220
+ } finally {
1221
+ wasm.__wbindgen_add_to_stack_pointer(16);
1222
+ }
1223
+ }
1224
+ /**
1225
+ * @param {number} e
1226
+ * @returns {any}
1227
+ */
1228
+ removeEdge(e) {
1229
+ try {
1230
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1231
+ wasm.graph_removeEdge(retptr, this.ptr, e);
1232
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1233
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1234
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1235
+ if (r2) {
1236
+ throw takeObject(r1);
1237
+ }
1238
+ return takeObject(r0);
1239
+ } finally {
1240
+ wasm.__wbindgen_add_to_stack_pointer(16);
1241
+ }
1242
+ }
1243
+ /**
1244
+ * @param {number} a
1245
+ * @returns {Array<any>}
1246
+ */
1247
+ neighbors(a) {
1248
+ const ret = wasm.graph_neighbors(this.ptr, a);
1249
+ return takeObject(ret);
1250
+ }
1251
+ /**
1252
+ * @param {number} a
1253
+ * @param {number} dir
1254
+ * @returns {Array<any>}
1255
+ */
1256
+ neighborsDirected(a, dir) {
1257
+ const ret = wasm.graph_neighborsDirected(this.ptr, a, dir);
1258
+ return takeObject(ret);
1259
+ }
1260
+ /**
1261
+ * @param {number} a
1262
+ * @returns {Array<any>}
1263
+ */
1264
+ neighborsUndirected(a) {
1265
+ const ret = wasm.digraph_neighborsUndirected(this.ptr, a);
1266
+ return takeObject(ret);
1267
+ }
1268
+ /**
1269
+ * @param {number} a
1270
+ * @returns {Array<any>}
1271
+ */
1272
+ edges(a) {
1273
+ const ret = wasm.graph_edges(this.ptr, a);
1274
+ return takeObject(ret);
1275
+ }
1276
+ /**
1277
+ * @param {number} a
1278
+ * @param {number} b
1279
+ * @returns {boolean}
1280
+ */
1281
+ containsEdge(a, b) {
1282
+ const ret = wasm.graph_containsEdge(this.ptr, a, b);
1283
+ return ret !== 0;
1284
+ }
1285
+ /**
1286
+ * @param {number} a
1287
+ * @param {number} b
1288
+ * @returns {number}
1289
+ */
1290
+ findEdge(a, b) {
1291
+ try {
1292
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1293
+ wasm.graph_findEdge(retptr, this.ptr, a, b);
1294
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1295
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1296
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1297
+ if (r2) {
1298
+ throw takeObject(r1);
1299
+ }
1300
+ return r0 >>> 0;
1301
+ } finally {
1302
+ wasm.__wbindgen_add_to_stack_pointer(16);
1303
+ }
1304
+ }
1305
+ /**
1306
+ * @param {number} dir
1307
+ * @returns {Array<any>}
1308
+ */
1309
+ externals(dir) {
1310
+ const ret = wasm.graph_externals(this.ptr, dir);
1311
+ return takeObject(ret);
1312
+ }
1313
+ /**
1314
+ * @returns {Array<any>}
1315
+ */
1316
+ nodeIndices() {
1317
+ const ret = wasm.digraph_nodeIndices(this.ptr);
1318
+ return takeObject(ret);
1319
+ }
1320
+ /**
1321
+ * @returns {Array<any>}
1322
+ */
1323
+ edgeIndices() {
1324
+ const ret = wasm.digraph_edgeIndices(this.ptr);
1325
+ return takeObject(ret);
1326
+ }
1327
+ /**
1328
+ * @param {Function} node_map
1329
+ * @param {Function} edge_map
1330
+ * @returns {Graph}
1331
+ */
1332
+ map(node_map, edge_map) {
1333
+ try {
1334
+ const ret = wasm.graph_map(this.ptr, addBorrowedObject(node_map), addBorrowedObject(edge_map));
1335
+ return Graph.__wrap(ret);
1336
+ } finally {
1337
+ heap[stack_pointer++] = undefined;
1338
+ heap[stack_pointer++] = undefined;
1339
+ }
1340
+ }
1341
+ /**
1342
+ * @param {Function} node_map
1343
+ * @param {Function} edge_map
1344
+ * @returns {Graph}
1345
+ */
1346
+ filterMap(node_map, edge_map) {
1347
+ try {
1348
+ const ret = wasm.graph_filterMap(this.ptr, addBorrowedObject(node_map), addBorrowedObject(edge_map));
1349
+ return Graph.__wrap(ret);
1350
+ } finally {
1351
+ heap[stack_pointer++] = undefined;
1352
+ heap[stack_pointer++] = undefined;
1353
+ }
1354
+ }
1355
+ }
1356
+ /**
1357
+ */
1358
+ class GroupLinkForce {
1359
+
1360
+ static __wrap(ptr) {
1361
+ const obj = Object.create(GroupLinkForce.prototype);
1362
+ obj.ptr = ptr;
1363
+
1364
+ return obj;
1365
+ }
1366
+
1367
+ __destroy_into_raw() {
1368
+ const ptr = this.ptr;
1369
+ this.ptr = 0;
1370
+
1371
+ return ptr;
1372
+ }
1373
+
1374
+ free() {
1375
+ const ptr = this.__destroy_into_raw();
1376
+ wasm.__wbg_grouplinkforce_free(ptr);
1377
+ }
1378
+ /**
1379
+ * @param {Graph} graph
1380
+ * @param {Function} group_accessor
1381
+ * @param {Function} inter_link_accessor
1382
+ * @param {Function} intra_link_accessor
1383
+ */
1384
+ constructor(graph, group_accessor, inter_link_accessor, intra_link_accessor) {
1385
+ try {
1386
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1387
+ _assertClass(graph, Graph);
1388
+ wasm.grouplinkforce_new(retptr, graph.ptr, addBorrowedObject(group_accessor), addBorrowedObject(inter_link_accessor), addBorrowedObject(intra_link_accessor));
1389
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1390
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1391
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1392
+ if (r2) {
1393
+ throw takeObject(r1);
1394
+ }
1395
+ return GroupLinkForce.__wrap(r0);
1396
+ } finally {
1397
+ wasm.__wbindgen_add_to_stack_pointer(16);
1398
+ heap[stack_pointer++] = undefined;
1399
+ heap[stack_pointer++] = undefined;
1400
+ heap[stack_pointer++] = undefined;
1401
+ }
1402
+ }
1403
+ /**
1404
+ * @param {Coordinates} coordinates
1405
+ * @param {number} alpha
1406
+ */
1407
+ apply(coordinates, alpha) {
1408
+ _assertClass(coordinates, Coordinates);
1409
+ wasm.grouplinkforce_apply(this.ptr, coordinates.ptr, alpha);
1410
+ }
1411
+ }
1412
+ /**
1413
+ */
1414
+ class GroupManyBodyForce {
1415
+
1416
+ static __wrap(ptr) {
1417
+ const obj = Object.create(GroupManyBodyForce.prototype);
1418
+ obj.ptr = ptr;
1419
+
1420
+ return obj;
1421
+ }
1422
+
1423
+ __destroy_into_raw() {
1424
+ const ptr = this.ptr;
1425
+ this.ptr = 0;
1426
+
1427
+ return ptr;
1428
+ }
1429
+
1430
+ free() {
1431
+ const ptr = this.__destroy_into_raw();
1432
+ wasm.__wbg_groupmanybodyforce_free(ptr);
1433
+ }
1434
+ /**
1435
+ * @param {Graph} graph
1436
+ * @param {Function} node_accessor
1437
+ */
1438
+ constructor(graph, node_accessor) {
1439
+ try {
1440
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1441
+ _assertClass(graph, Graph);
1442
+ wasm.groupmanybodyforce_new(retptr, graph.ptr, addBorrowedObject(node_accessor));
1443
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1444
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1445
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1446
+ if (r2) {
1447
+ throw takeObject(r1);
1448
+ }
1449
+ return GroupManyBodyForce.__wrap(r0);
1450
+ } finally {
1451
+ wasm.__wbindgen_add_to_stack_pointer(16);
1452
+ heap[stack_pointer++] = undefined;
1453
+ }
1454
+ }
1455
+ /**
1456
+ * @param {Coordinates} coordinates
1457
+ * @param {number} alpha
1458
+ */
1459
+ apply(coordinates, alpha) {
1460
+ _assertClass(coordinates, Coordinates);
1461
+ wasm.groupmanybodyforce_apply(this.ptr, coordinates.ptr, alpha);
1462
+ }
1463
+ }
1464
+ /**
1465
+ */
1466
+ class GroupPositionForce {
1467
+
1468
+ static __wrap(ptr) {
1469
+ const obj = Object.create(GroupPositionForce.prototype);
1470
+ obj.ptr = ptr;
1471
+
1472
+ return obj;
1473
+ }
1474
+
1475
+ __destroy_into_raw() {
1476
+ const ptr = this.ptr;
1477
+ this.ptr = 0;
1478
+
1479
+ return ptr;
1480
+ }
1481
+
1482
+ free() {
1483
+ const ptr = this.__destroy_into_raw();
1484
+ wasm.__wbg_grouppositionforce_free(ptr);
1485
+ }
1486
+ /**
1487
+ * @param {Graph} graph
1488
+ * @param {Function} node_accessor
1489
+ * @param {Function} group_accessor
1490
+ */
1491
+ constructor(graph, node_accessor, group_accessor) {
1492
+ try {
1493
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1494
+ _assertClass(graph, Graph);
1495
+ wasm.grouppositionforce_new(retptr, graph.ptr, addBorrowedObject(node_accessor), addBorrowedObject(group_accessor));
1496
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1497
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1498
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1499
+ if (r2) {
1500
+ throw takeObject(r1);
1501
+ }
1502
+ return GroupPositionForce.__wrap(r0);
1503
+ } finally {
1504
+ wasm.__wbindgen_add_to_stack_pointer(16);
1505
+ heap[stack_pointer++] = undefined;
1506
+ heap[stack_pointer++] = undefined;
1507
+ }
1508
+ }
1509
+ /**
1510
+ * @param {Coordinates} coordinates
1511
+ * @param {number} alpha
1512
+ */
1513
+ apply(coordinates, alpha) {
1514
+ _assertClass(coordinates, Coordinates);
1515
+ wasm.grouppositionforce_apply(this.ptr, coordinates.ptr, alpha);
1516
+ }
1517
+ }
1518
+ /**
1519
+ */
1520
+ class HyperbolicSpace {
1521
+
1522
+ __destroy_into_raw() {
1523
+ const ptr = this.ptr;
1524
+ this.ptr = 0;
1525
+
1526
+ return ptr;
1527
+ }
1528
+
1529
+ free() {
1530
+ const ptr = this.__destroy_into_raw();
1531
+ wasm.__wbg_hyperbolicspace_free(ptr);
1532
+ }
1533
+ /**
1534
+ * @param {any} a
1535
+ * @param {any} b
1536
+ * @returns {any}
1537
+ */
1538
+ static toTangentSpace(a, b) {
1539
+ try {
1540
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1541
+ wasm.hyperbolicspace_toTangentSpace(retptr, addHeapObject(a), addHeapObject(b));
1542
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1543
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1544
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1545
+ if (r2) {
1546
+ throw takeObject(r1);
1547
+ }
1548
+ return takeObject(r0);
1549
+ } finally {
1550
+ wasm.__wbindgen_add_to_stack_pointer(16);
1551
+ }
1552
+ }
1553
+ /**
1554
+ * @param {any} a
1555
+ * @param {any} b
1556
+ * @returns {any}
1557
+ */
1558
+ static fromTangentSpace(a, b) {
1559
+ try {
1560
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1561
+ wasm.hyperbolicspace_fromTangentSpace(retptr, addHeapObject(a), addHeapObject(b));
1562
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1563
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1564
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1565
+ if (r2) {
1566
+ throw takeObject(r1);
1567
+ }
1568
+ return takeObject(r0);
1569
+ } finally {
1570
+ wasm.__wbindgen_add_to_stack_pointer(16);
1571
+ }
1572
+ }
1573
+ /**
1574
+ * @param {number} i
1575
+ * @param {Coordinates} riemann_space
1576
+ * @param {Coordinates} tangent_space
1577
+ */
1578
+ static mapToTangentSpace(i, riemann_space, tangent_space) {
1579
+ _assertClass(riemann_space, Coordinates);
1580
+ _assertClass(tangent_space, Coordinates);
1581
+ wasm.hyperbolicspace_mapToTangentSpace(i, riemann_space.ptr, tangent_space.ptr);
1582
+ }
1583
+ /**
1584
+ * @param {number} i
1585
+ * @param {Coordinates} riemann_space
1586
+ * @param {Coordinates} tangent_space
1587
+ * @param {number} velocity_decay
1588
+ */
1589
+ static updatePosition(i, riemann_space, tangent_space, velocity_decay) {
1590
+ _assertClass(riemann_space, Coordinates);
1591
+ _assertClass(tangent_space, Coordinates);
1592
+ wasm.hyperbolicspace_updatePosition(i, riemann_space.ptr, tangent_space.ptr, velocity_decay);
1593
+ }
1594
+ }
1595
+ /**
1596
+ */
1597
+ class KamadaKawai {
1598
+
1599
+ static __wrap(ptr) {
1600
+ const obj = Object.create(KamadaKawai.prototype);
1601
+ obj.ptr = ptr;
1602
+
1603
+ return obj;
1604
+ }
1605
+
1606
+ __destroy_into_raw() {
1607
+ const ptr = this.ptr;
1608
+ this.ptr = 0;
1609
+
1610
+ return ptr;
1611
+ }
1612
+
1613
+ free() {
1614
+ const ptr = this.__destroy_into_raw();
1615
+ wasm.__wbg_kamadakawai_free(ptr);
1616
+ }
1617
+ /**
1618
+ * @param {Graph} graph
1619
+ * @param {Function} f
1620
+ */
1621
+ constructor(graph, f) {
1622
+ try {
1623
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1624
+ _assertClass(graph, Graph);
1625
+ wasm.kamadakawai_new(retptr, graph.ptr, addBorrowedObject(f));
1626
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1627
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1628
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1629
+ if (r2) {
1630
+ throw takeObject(r1);
1631
+ }
1632
+ return KamadaKawai.__wrap(r0);
1633
+ } finally {
1634
+ wasm.__wbindgen_add_to_stack_pointer(16);
1635
+ heap[stack_pointer++] = undefined;
1636
+ }
1637
+ }
1638
+ /**
1639
+ * @param {Drawing} drawing
1640
+ * @returns {number | undefined}
1641
+ */
1642
+ selectNode(drawing) {
1643
+ try {
1644
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1645
+ _assertClass(drawing, Drawing);
1646
+ wasm.kamadakawai_selectNode(retptr, this.ptr, drawing.ptr);
1647
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1648
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1649
+ return r0 === 0 ? undefined : r1 >>> 0;
1650
+ } finally {
1651
+ wasm.__wbindgen_add_to_stack_pointer(16);
1652
+ }
1653
+ }
1654
+ /**
1655
+ * @param {number} m
1656
+ * @param {Drawing} drawing
1657
+ */
1658
+ applyToNode(m, drawing) {
1659
+ _assertClass(drawing, Drawing);
1660
+ wasm.kamadakawai_applyToNode(this.ptr, m, drawing.ptr);
1661
+ }
1662
+ /**
1663
+ * @param {Drawing} drawing
1664
+ */
1665
+ run(drawing) {
1666
+ _assertClass(drawing, Drawing);
1667
+ wasm.kamadakawai_run(this.ptr, drawing.ptr);
1668
+ }
1669
+ /**
1670
+ * @returns {number}
1671
+ */
1672
+ get eps() {
1673
+ const ret = wasm.kamadakawai_eps(this.ptr);
1674
+ return ret;
1675
+ }
1676
+ /**
1677
+ * @param {number} value
1678
+ */
1679
+ set eps(value) {
1680
+ wasm.kamadakawai_set_eps(this.ptr, value);
1681
+ }
1682
+ }
1683
+ /**
1684
+ */
1685
+ class LinkForce {
1686
+
1687
+ static __wrap(ptr) {
1688
+ const obj = Object.create(LinkForce.prototype);
1689
+ obj.ptr = ptr;
1690
+
1691
+ return obj;
1692
+ }
1693
+
1694
+ __destroy_into_raw() {
1695
+ const ptr = this.ptr;
1696
+ this.ptr = 0;
1697
+
1698
+ return ptr;
1699
+ }
1700
+
1701
+ free() {
1702
+ const ptr = this.__destroy_into_raw();
1703
+ wasm.__wbg_linkforce_free(ptr);
1704
+ }
1705
+ /**
1706
+ * @param {Graph} graph
1707
+ * @param {Function} f
1708
+ */
1709
+ constructor(graph, f) {
1710
+ try {
1711
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1712
+ _assertClass(graph, Graph);
1713
+ wasm.linkforce_new(retptr, graph.ptr, addBorrowedObject(f));
1714
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1715
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1716
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1717
+ if (r2) {
1718
+ throw takeObject(r1);
1719
+ }
1720
+ return LinkForce.__wrap(r0);
1721
+ } finally {
1722
+ wasm.__wbindgen_add_to_stack_pointer(16);
1723
+ heap[stack_pointer++] = undefined;
1724
+ }
1725
+ }
1726
+ /**
1727
+ * @param {Coordinates} coordinates
1728
+ * @param {number} alpha
1729
+ */
1730
+ apply(coordinates, alpha) {
1731
+ _assertClass(coordinates, Coordinates);
1732
+ wasm.linkforce_apply(this.ptr, coordinates.ptr, alpha);
1733
+ }
1734
+ /**
1735
+ * @param {number} u
1736
+ * @param {Coordinates} coordinates
1737
+ * @param {number} alpha
1738
+ */
1739
+ applyToNode(u, coordinates, alpha) {
1740
+ _assertClass(coordinates, Coordinates);
1741
+ wasm.linkforce_applyToNode(this.ptr, u, coordinates.ptr, alpha);
1742
+ }
1743
+ }
1744
+ /**
1745
+ */
1746
+ class ManyBodyForce {
1747
+
1748
+ static __wrap(ptr) {
1749
+ const obj = Object.create(ManyBodyForce.prototype);
1750
+ obj.ptr = ptr;
1751
+
1752
+ return obj;
1753
+ }
1754
+
1755
+ __destroy_into_raw() {
1756
+ const ptr = this.ptr;
1757
+ this.ptr = 0;
1758
+
1759
+ return ptr;
1760
+ }
1761
+
1762
+ free() {
1763
+ const ptr = this.__destroy_into_raw();
1764
+ wasm.__wbg_manybodyforce_free(ptr);
1765
+ }
1766
+ /**
1767
+ * @param {Graph} graph
1768
+ * @param {Function} f
1769
+ */
1770
+ constructor(graph, f) {
1771
+ try {
1772
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1773
+ _assertClass(graph, Graph);
1774
+ wasm.manybodyforce_new(retptr, graph.ptr, addBorrowedObject(f));
1775
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1776
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1777
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1778
+ if (r2) {
1779
+ throw takeObject(r1);
1780
+ }
1781
+ return ManyBodyForce.__wrap(r0);
1782
+ } finally {
1783
+ wasm.__wbindgen_add_to_stack_pointer(16);
1784
+ heap[stack_pointer++] = undefined;
1785
+ }
1786
+ }
1787
+ /**
1788
+ * @param {Coordinates} coordinates
1789
+ * @param {number} alpha
1790
+ */
1791
+ apply(coordinates, alpha) {
1792
+ _assertClass(coordinates, Coordinates);
1793
+ wasm.manybodyforce_apply(this.ptr, coordinates.ptr, alpha);
1794
+ }
1795
+ /**
1796
+ * @param {number} u
1797
+ * @param {Coordinates} coordinates
1798
+ * @param {number} alpha
1799
+ */
1800
+ applyToNode(u, coordinates, alpha) {
1801
+ _assertClass(coordinates, Coordinates);
1802
+ wasm.manybodyforce_applyToNode(this.ptr, u, coordinates.ptr, alpha);
1803
+ }
1804
+ }
1805
+ /**
1806
+ */
1807
+ class PivotMds {
1808
+
1809
+ static __wrap(ptr) {
1810
+ const obj = Object.create(PivotMds.prototype);
1811
+ obj.ptr = ptr;
1812
+
1813
+ return obj;
1814
+ }
1815
+
1816
+ __destroy_into_raw() {
1817
+ const ptr = this.ptr;
1818
+ this.ptr = 0;
1819
+
1820
+ return ptr;
1821
+ }
1822
+
1823
+ free() {
1824
+ const ptr = this.__destroy_into_raw();
1825
+ wasm.__wbg_pivotmds_free(ptr);
1826
+ }
1827
+ /**
1828
+ */
1829
+ constructor() {
1830
+ const ret = wasm.pivotmds_new();
1831
+ return PivotMds.__wrap(ret);
1832
+ }
1833
+ /**
1834
+ * @param {Graph} graph
1835
+ * @param {Function} length
1836
+ * @param {Array<any>} sources
1837
+ * @returns {Drawing}
1838
+ */
1839
+ run(graph, length, sources) {
1840
+ try {
1841
+ _assertClass(graph, Graph);
1842
+ const ret = wasm.pivotmds_run(this.ptr, graph.ptr, addBorrowedObject(length), addBorrowedObject(sources));
1843
+ return Drawing.__wrap(ret);
1844
+ } finally {
1845
+ heap[stack_pointer++] = undefined;
1846
+ heap[stack_pointer++] = undefined;
1847
+ }
1848
+ }
1849
+ }
1850
+ /**
1851
+ */
1852
+ class PositionForce {
1853
+
1854
+ static __wrap(ptr) {
1855
+ const obj = Object.create(PositionForce.prototype);
1856
+ obj.ptr = ptr;
1857
+
1858
+ return obj;
1859
+ }
1860
+
1861
+ __destroy_into_raw() {
1862
+ const ptr = this.ptr;
1863
+ this.ptr = 0;
1864
+
1865
+ return ptr;
1866
+ }
1867
+
1868
+ free() {
1869
+ const ptr = this.__destroy_into_raw();
1870
+ wasm.__wbg_positionforce_free(ptr);
1871
+ }
1872
+ /**
1873
+ * @param {Graph} graph
1874
+ * @param {Function} f
1875
+ */
1876
+ constructor(graph, f) {
1877
+ try {
1878
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1879
+ _assertClass(graph, Graph);
1880
+ wasm.positionforce_new(retptr, graph.ptr, addBorrowedObject(f));
1881
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1882
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1883
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1884
+ if (r2) {
1885
+ throw takeObject(r1);
1886
+ }
1887
+ return PositionForce.__wrap(r0);
1888
+ } finally {
1889
+ wasm.__wbindgen_add_to_stack_pointer(16);
1890
+ heap[stack_pointer++] = undefined;
1891
+ }
1892
+ }
1893
+ /**
1894
+ * @param {Coordinates} coordinates
1895
+ * @param {number} alpha
1896
+ */
1897
+ apply(coordinates, alpha) {
1898
+ _assertClass(coordinates, Coordinates);
1899
+ wasm.positionforce_apply(this.ptr, coordinates.ptr, alpha);
1900
+ }
1901
+ /**
1902
+ * @param {number} u
1903
+ * @param {Coordinates} coordinates
1904
+ * @param {number} alpha
1905
+ */
1906
+ applyToNode(u, coordinates, alpha) {
1907
+ _assertClass(coordinates, Coordinates);
1908
+ wasm.positionforce_applyToNode(this.ptr, u, coordinates.ptr, alpha);
1909
+ }
1910
+ }
1911
+ /**
1912
+ */
1913
+ class RadialForce {
1914
+
1915
+ static __wrap(ptr) {
1916
+ const obj = Object.create(RadialForce.prototype);
1917
+ obj.ptr = ptr;
1918
+
1919
+ return obj;
1920
+ }
1921
+
1922
+ __destroy_into_raw() {
1923
+ const ptr = this.ptr;
1924
+ this.ptr = 0;
1925
+
1926
+ return ptr;
1927
+ }
1928
+
1929
+ free() {
1930
+ const ptr = this.__destroy_into_raw();
1931
+ wasm.__wbg_radialforce_free(ptr);
1932
+ }
1933
+ /**
1934
+ * @param {Graph} graph
1935
+ * @param {Function} f
1936
+ */
1937
+ constructor(graph, f) {
1938
+ try {
1939
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1940
+ _assertClass(graph, Graph);
1941
+ wasm.radialforce_new(retptr, graph.ptr, addHeapObject(f));
1942
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1943
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1944
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1945
+ if (r2) {
1946
+ throw takeObject(r1);
1947
+ }
1948
+ return RadialForce.__wrap(r0);
1949
+ } finally {
1950
+ wasm.__wbindgen_add_to_stack_pointer(16);
1951
+ }
1952
+ }
1953
+ /**
1954
+ * @param {Coordinates} coordinates
1955
+ * @param {number} alpha
1956
+ */
1957
+ apply(coordinates, alpha) {
1958
+ _assertClass(coordinates, Coordinates);
1959
+ wasm.radialforce_apply(this.ptr, coordinates.ptr, alpha);
1960
+ }
1961
+ /**
1962
+ * @param {number} u
1963
+ * @param {Coordinates} coordinates
1964
+ * @param {number} alpha
1965
+ */
1966
+ applyToNode(u, coordinates, alpha) {
1967
+ _assertClass(coordinates, Coordinates);
1968
+ wasm.radialforce_applyToNode(this.ptr, u, coordinates.ptr, alpha);
1969
+ }
1970
+ }
1971
+ /**
1972
+ */
1973
+ class Rng {
1974
+
1975
+ static __wrap(ptr) {
1976
+ const obj = Object.create(Rng.prototype);
1977
+ obj.ptr = ptr;
1978
+
1979
+ return obj;
1980
+ }
1981
+
1982
+ __destroy_into_raw() {
1983
+ const ptr = this.ptr;
1984
+ this.ptr = 0;
1985
+
1986
+ return ptr;
1987
+ }
1988
+
1989
+ free() {
1990
+ const ptr = this.__destroy_into_raw();
1991
+ wasm.__wbg_rng_free(ptr);
1992
+ }
1993
+ /**
1994
+ */
1995
+ constructor() {
1996
+ const ret = wasm.rng_new();
1997
+ return Rng.__wrap(ret);
1998
+ }
1999
+ /**
2000
+ * @param {bigint} seed
2001
+ * @returns {Rng}
2002
+ */
2003
+ static seedFrom(seed) {
2004
+ const ret = wasm.rng_seedFrom(seed);
2005
+ return Rng.__wrap(ret);
2006
+ }
2007
+ }
2008
+ /**
2009
+ */
2010
+ class SgdScheduler {
2011
+
2012
+ static __wrap(ptr) {
2013
+ const obj = Object.create(SgdScheduler.prototype);
2014
+ obj.ptr = ptr;
2015
+
2016
+ return obj;
2017
+ }
2018
+
2019
+ __destroy_into_raw() {
2020
+ const ptr = this.ptr;
2021
+ this.ptr = 0;
2022
+
2023
+ return ptr;
2024
+ }
2025
+
2026
+ free() {
2027
+ const ptr = this.__destroy_into_raw();
2028
+ wasm.__wbg_sgdscheduler_free(ptr);
2029
+ }
2030
+ /**
2031
+ * @param {Function} f
2032
+ */
2033
+ run(f) {
2034
+ try {
2035
+ wasm.sgdscheduler_run(this.ptr, addBorrowedObject(f));
2036
+ } finally {
2037
+ heap[stack_pointer++] = undefined;
2038
+ }
2039
+ }
2040
+ /**
2041
+ * @param {Function} f
2042
+ */
2043
+ step(f) {
2044
+ try {
2045
+ wasm.sgdscheduler_step(this.ptr, addBorrowedObject(f));
2046
+ } finally {
2047
+ heap[stack_pointer++] = undefined;
2048
+ }
2049
+ }
2050
+ /**
2051
+ * @returns {boolean}
2052
+ */
2053
+ isFinished() {
2054
+ const ret = wasm.sgdscheduler_isFinished(this.ptr);
2055
+ return ret !== 0;
2056
+ }
2057
+ }
2058
+ /**
2059
+ */
2060
+ class Simulation {
2061
+
2062
+ static __wrap(ptr) {
2063
+ const obj = Object.create(Simulation.prototype);
2064
+ obj.ptr = ptr;
2065
+
2066
+ return obj;
2067
+ }
2068
+
2069
+ __destroy_into_raw() {
2070
+ const ptr = this.ptr;
2071
+ this.ptr = 0;
2072
+
2073
+ return ptr;
2074
+ }
2075
+
2076
+ free() {
2077
+ const ptr = this.__destroy_into_raw();
2078
+ wasm.__wbg_simulation_free(ptr);
2079
+ }
2080
+ /**
2081
+ */
2082
+ constructor() {
2083
+ const ret = wasm.simulation_new();
2084
+ return Simulation.__wrap(ret);
2085
+ }
2086
+ /**
2087
+ * @param {Function} f
2088
+ */
2089
+ run(f) {
588
2090
  try {
589
- _assertClass(graph, Graph);
590
- var ret = wasm.simulation_new(graph.ptr, addBorrowedObject(f));
591
- return Simulation.__wrap(ret);
2091
+ wasm.simulation_run(this.ptr, addBorrowedObject(f));
592
2092
  } finally {
593
2093
  heap[stack_pointer++] = undefined;
594
2094
  }
595
2095
  }
596
2096
  /**
597
- * @param {any[]} js_forces
598
- * @returns {any}
599
- */
600
- run(js_forces) {
601
- var ptr0 = passArrayJsValueToWasm0(js_forces, wasm.__wbindgen_malloc);
602
- var len0 = WASM_VECTOR_LEN;
603
- var ret = wasm.simulation_run(this.ptr, ptr0, len0);
604
- return takeObject(ret);
605
- }
606
- /**
607
2097
  * @param {number} n
608
- * @param {any[]} js_forces
609
- * @returns {any}
2098
+ * @param {Function} f
610
2099
  */
611
- runStep(n, js_forces) {
612
- var ptr0 = passArrayJsValueToWasm0(js_forces, wasm.__wbindgen_malloc);
613
- var len0 = WASM_VECTOR_LEN;
614
- var ret = wasm.simulation_runStep(this.ptr, n, ptr0, len0);
615
- return takeObject(ret);
2100
+ runStep(n, f) {
2101
+ try {
2102
+ wasm.simulation_runStep(this.ptr, n, addBorrowedObject(f));
2103
+ } finally {
2104
+ heap[stack_pointer++] = undefined;
2105
+ }
616
2106
  }
617
2107
  /**
618
2108
  * @returns {boolean}
619
2109
  */
620
2110
  isFinished() {
621
- var ret = wasm.simulation_isFinished(this.ptr);
2111
+ const ret = wasm.simulation_isFinished(this.ptr);
622
2112
  return ret !== 0;
623
2113
  }
624
2114
  /**
@@ -631,20 +2121,20 @@
631
2121
  * @returns {number}
632
2122
  */
633
2123
  get alphaStart() {
634
- var ret = wasm.simulation_alpha(this.ptr);
2124
+ const ret = wasm.simulation_alpha(this.ptr);
635
2125
  return ret;
636
2126
  }
637
2127
  /**
638
2128
  * @param {number} value
639
2129
  */
640
2130
  set alphaStart(value) {
641
- wasm.simulation_reset(this.ptr, value);
2131
+ wasm.simulation_set_alpha(this.ptr, value);
642
2132
  }
643
2133
  /**
644
2134
  * @returns {number}
645
2135
  */
646
2136
  get alphaMin() {
647
- var ret = wasm.simulation_alpha_min(this.ptr);
2137
+ const ret = wasm.simulation_alpha_min(this.ptr);
648
2138
  return ret;
649
2139
  }
650
2140
  /**
@@ -657,7 +2147,7 @@
657
2147
  * @returns {number}
658
2148
  */
659
2149
  get alphaTarget() {
660
- var ret = wasm.simulation_alpha_target(this.ptr);
2150
+ const ret = wasm.simulation_alpha_target(this.ptr);
661
2151
  return ret;
662
2152
  }
663
2153
  /**
@@ -669,34 +2159,222 @@
669
2159
  /**
670
2160
  * @returns {number}
671
2161
  */
672
- get velocityDecay() {
673
- var ret = wasm.simulation_velocity_decay(this.ptr);
674
- return ret;
2162
+ get iterations() {
2163
+ const ret = wasm.simulation_iterations(this.ptr);
2164
+ return ret >>> 0;
675
2165
  }
676
2166
  /**
677
2167
  * @param {number} value
678
2168
  */
679
- set velocityDecay(value) {
680
- wasm.simulation_set_velocity_decay(this.ptr, value);
2169
+ set iterations(value) {
2170
+ wasm.simulation_set_iterations(this.ptr, value);
2171
+ }
2172
+ }
2173
+ /**
2174
+ */
2175
+ class SparseSgd {
2176
+
2177
+ static __wrap(ptr) {
2178
+ const obj = Object.create(SparseSgd.prototype);
2179
+ obj.ptr = ptr;
2180
+
2181
+ return obj;
2182
+ }
2183
+
2184
+ __destroy_into_raw() {
2185
+ const ptr = this.ptr;
2186
+ this.ptr = 0;
2187
+
2188
+ return ptr;
2189
+ }
2190
+
2191
+ free() {
2192
+ const ptr = this.__destroy_into_raw();
2193
+ wasm.__wbg_sparsesgd_free(ptr);
2194
+ }
2195
+ /**
2196
+ * @param {Graph} graph
2197
+ * @param {Function} length
2198
+ * @param {number} h
2199
+ * @param {Rng} rng
2200
+ */
2201
+ constructor(graph, length, h, rng) {
2202
+ try {
2203
+ _assertClass(graph, Graph);
2204
+ _assertClass(rng, Rng);
2205
+ const ret = wasm.sparsesgd_new(graph.ptr, addBorrowedObject(length), h, rng.ptr);
2206
+ return SparseSgd.__wrap(ret);
2207
+ } finally {
2208
+ heap[stack_pointer++] = undefined;
2209
+ }
2210
+ }
2211
+ /**
2212
+ * @param {Rng} rng
2213
+ */
2214
+ shuffle(rng) {
2215
+ _assertClass(rng, Rng);
2216
+ wasm.sparsesgd_shuffle(this.ptr, rng.ptr);
2217
+ }
2218
+ /**
2219
+ * @param {Drawing} drawing
2220
+ * @param {number} eta
2221
+ */
2222
+ apply(drawing, eta) {
2223
+ _assertClass(drawing, Drawing);
2224
+ wasm.sparsesgd_apply(this.ptr, drawing.ptr, eta);
2225
+ }
2226
+ /**
2227
+ * @param {number} t_max
2228
+ * @param {number} epsilon
2229
+ * @returns {SgdScheduler}
2230
+ */
2231
+ scheduler(t_max, epsilon) {
2232
+ const ret = wasm.sparsesgd_scheduler(this.ptr, t_max, epsilon);
2233
+ return SgdScheduler.__wrap(ret);
2234
+ }
2235
+ }
2236
+ /**
2237
+ */
2238
+ class SphericalSpace {
2239
+
2240
+ __destroy_into_raw() {
2241
+ const ptr = this.ptr;
2242
+ this.ptr = 0;
2243
+
2244
+ return ptr;
2245
+ }
2246
+
2247
+ free() {
2248
+ const ptr = this.__destroy_into_raw();
2249
+ wasm.__wbg_sphericalspace_free(ptr);
2250
+ }
2251
+ /**
2252
+ * @param {any} a
2253
+ * @param {any} b
2254
+ * @returns {any}
2255
+ */
2256
+ static toTangentSpace(a, b) {
2257
+ try {
2258
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2259
+ wasm.sphericalspace_toTangentSpace(retptr, addHeapObject(a), addHeapObject(b));
2260
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2261
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2262
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2263
+ if (r2) {
2264
+ throw takeObject(r1);
2265
+ }
2266
+ return takeObject(r0);
2267
+ } finally {
2268
+ wasm.__wbindgen_add_to_stack_pointer(16);
2269
+ }
2270
+ }
2271
+ /**
2272
+ * @param {any} a
2273
+ * @param {any} b
2274
+ * @returns {any}
2275
+ */
2276
+ static fromTangentSpace(a, b) {
2277
+ try {
2278
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2279
+ wasm.sphericalspace_fromTangentSpace(retptr, addHeapObject(a), addHeapObject(b));
2280
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2281
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2282
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2283
+ if (r2) {
2284
+ throw takeObject(r1);
2285
+ }
2286
+ return takeObject(r0);
2287
+ } finally {
2288
+ wasm.__wbindgen_add_to_stack_pointer(16);
2289
+ }
2290
+ }
2291
+ /**
2292
+ * @param {number} i
2293
+ * @param {Coordinates} riemann_space
2294
+ * @param {Coordinates} tangent_space
2295
+ */
2296
+ static mapToTangentSpace(i, riemann_space, tangent_space) {
2297
+ _assertClass(riemann_space, Coordinates);
2298
+ _assertClass(tangent_space, Coordinates);
2299
+ wasm.sphericalspace_mapToTangentSpace(i, riemann_space.ptr, tangent_space.ptr);
2300
+ }
2301
+ /**
2302
+ * @param {number} i
2303
+ * @param {Coordinates} riemann_space
2304
+ * @param {Coordinates} tangent_space
2305
+ * @param {number} velocity_decay
2306
+ */
2307
+ static updatePosition(i, riemann_space, tangent_space, velocity_decay) {
2308
+ _assertClass(riemann_space, Coordinates);
2309
+ _assertClass(tangent_space, Coordinates);
2310
+ wasm.sphericalspace_updatePosition(i, riemann_space.ptr, tangent_space.ptr, velocity_decay);
2311
+ }
2312
+ }
2313
+ /**
2314
+ */
2315
+ class StressMajorization {
2316
+
2317
+ static __wrap(ptr) {
2318
+ const obj = Object.create(StressMajorization.prototype);
2319
+ obj.ptr = ptr;
2320
+
2321
+ return obj;
2322
+ }
2323
+
2324
+ __destroy_into_raw() {
2325
+ const ptr = this.ptr;
2326
+ this.ptr = 0;
2327
+
2328
+ return ptr;
2329
+ }
2330
+
2331
+ free() {
2332
+ const ptr = this.__destroy_into_raw();
2333
+ wasm.__wbg_stressmajorization_free(ptr);
2334
+ }
2335
+ /**
2336
+ * @param {Graph} graph
2337
+ * @param {Drawing} drawing
2338
+ * @param {Function} f
2339
+ */
2340
+ constructor(graph, drawing, f) {
2341
+ try {
2342
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2343
+ _assertClass(graph, Graph);
2344
+ _assertClass(drawing, Drawing);
2345
+ wasm.stressmajorization_new(retptr, graph.ptr, drawing.ptr, addBorrowedObject(f));
2346
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2347
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2348
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2349
+ if (r2) {
2350
+ throw takeObject(r1);
2351
+ }
2352
+ return StressMajorization.__wrap(r0);
2353
+ } finally {
2354
+ wasm.__wbindgen_add_to_stack_pointer(16);
2355
+ heap[stack_pointer++] = undefined;
2356
+ }
681
2357
  }
682
2358
  /**
2359
+ * @param {Drawing} drawing
683
2360
  * @returns {number}
684
2361
  */
685
- get iterations() {
686
- var ret = wasm.simulation_iterations(this.ptr);
687
- return ret >>> 0;
2362
+ apply(drawing) {
2363
+ _assertClass(drawing, Drawing);
2364
+ const ret = wasm.stressmajorization_apply(this.ptr, drawing.ptr);
2365
+ return ret;
688
2366
  }
689
2367
  /**
690
- * @param {number} value
2368
+ * @param {Drawing} drawing
691
2369
  */
692
- set iterations(value) {
693
- wasm.simulation_set_iterations(this.ptr, value);
2370
+ run(drawing) {
2371
+ _assertClass(drawing, Drawing);
2372
+ wasm.stressmajorization_run(this.ptr, drawing.ptr);
694
2373
  }
695
2374
  }
696
2375
 
697
2376
  async function load(module, imports) {
698
2377
  if (typeof Response === 'function' && module instanceof Response) {
699
-
700
2378
  if (typeof WebAssembly.instantiateStreaming === 'function') {
701
2379
  try {
702
2380
  return await WebAssembly.instantiateStreaming(module, imports);
@@ -715,7 +2393,6 @@
715
2393
  return await WebAssembly.instantiate(bytes, imports);
716
2394
 
717
2395
  } else {
718
-
719
2396
  const instance = await WebAssembly.instantiate(module, imports);
720
2397
 
721
2398
  if (instance instanceof WebAssembly.Instance) {
@@ -727,113 +2404,367 @@
727
2404
  }
728
2405
  }
729
2406
 
730
- async function init(input) {
731
- if (typeof input === 'undefined') {
732
- input = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('egraph.js', document.baseURI).href)).replace(/\.js$/, '_bg.wasm');
733
- }
2407
+ function getImports() {
734
2408
  const imports = {};
735
2409
  imports.wbg = {};
2410
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
2411
+ takeObject(arg0);
2412
+ };
2413
+ imports.wbg.__wbindgen_number_new = function(arg0) {
2414
+ const ret = arg0;
2415
+ return addHeapObject(ret);
2416
+ };
736
2417
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
737
- var ret = getStringFromWasm0(arg0, arg1);
2418
+ const ret = getStringFromWasm0(arg0, arg1);
738
2419
  return addHeapObject(ret);
739
2420
  };
740
- imports.wbg.__wbindgen_number_new = function(arg0) {
741
- var ret = arg0;
2421
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
2422
+ const obj = getObject(arg1);
2423
+ const ret = typeof(obj) === 'number' ? obj : undefined;
2424
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
2425
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
2426
+ };
2427
+ imports.wbg.__wbindgen_is_null = function(arg0) {
2428
+ const ret = getObject(arg0) === null;
2429
+ return ret;
2430
+ };
2431
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
2432
+ const ret = typeof(getObject(arg0)) === 'bigint';
2433
+ return ret;
2434
+ };
2435
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
2436
+ const ret = BigInt.asUintN(64, arg0);
742
2437
  return addHeapObject(ret);
743
2438
  };
744
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
745
- takeObject(arg0);
2439
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
2440
+ const ret = getObject(arg0) === getObject(arg1);
2441
+ return ret;
2442
+ };
2443
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
2444
+ const ret = getObject(arg0) === undefined;
2445
+ return ret;
2446
+ };
2447
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
2448
+ const ret = getObject(arg0);
2449
+ return addHeapObject(ret);
2450
+ };
2451
+ imports.wbg.__wbindgen_is_string = function(arg0) {
2452
+ const ret = typeof(getObject(arg0)) === 'string';
2453
+ return ret;
2454
+ };
2455
+ imports.wbg.__wbg_graph_new = function(arg0) {
2456
+ const ret = Graph.__wrap(arg0);
2457
+ return addHeapObject(ret);
2458
+ };
2459
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2460
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2461
+ return addHeapObject(ret);
746
2462
  };
747
- imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
2463
+ imports.wbg.__wbindgen_is_object = function(arg0) {
2464
+ const val = getObject(arg0);
2465
+ const ret = typeof(val) === 'object' && val !== null;
2466
+ return ret;
2467
+ };
2468
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2469
+ const ret = getObject(arg0) == getObject(arg1);
2470
+ return ret;
2471
+ };
2472
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
2473
+ const v = getObject(arg0);
2474
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
2475
+ return ret;
2476
+ };
2477
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
748
2478
  const obj = getObject(arg1);
749
- var ret = JSON.stringify(obj === undefined ? null : obj);
750
- var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2479
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2480
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
751
2481
  var len0 = WASM_VECTOR_LEN;
752
2482
  getInt32Memory0()[arg0 / 4 + 1] = len0;
753
2483
  getInt32Memory0()[arg0 / 4 + 0] = ptr0;
754
2484
  };
755
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
756
- var ret = getObject(arg0);
2485
+ imports.wbg.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
2486
+ const ret = String(getObject(arg1));
2487
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2488
+ const len0 = WASM_VECTOR_LEN;
2489
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
2490
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
2491
+ };
2492
+ imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
2493
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
2494
+ };
2495
+ imports.wbg.__wbg_randomFillSync_6894564c2c334c42 = function() { return handleError(function (arg0, arg1, arg2) {
2496
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
2497
+ }, arguments) };
2498
+ imports.wbg.__wbg_getRandomValues_805f1c3d65988a5a = function() { return handleError(function (arg0, arg1) {
2499
+ getObject(arg0).getRandomValues(getObject(arg1));
2500
+ }, arguments) };
2501
+ imports.wbg.__wbg_crypto_e1d53a1d73fb10b8 = function(arg0) {
2502
+ const ret = getObject(arg0).crypto;
2503
+ return addHeapObject(ret);
2504
+ };
2505
+ imports.wbg.__wbg_process_038c26bf42b093f8 = function(arg0) {
2506
+ const ret = getObject(arg0).process;
2507
+ return addHeapObject(ret);
2508
+ };
2509
+ imports.wbg.__wbg_versions_ab37218d2f0b24a8 = function(arg0) {
2510
+ const ret = getObject(arg0).versions;
757
2511
  return addHeapObject(ret);
758
2512
  };
759
- imports.wbg.__wbindgen_json_parse = function(arg0, arg1) {
760
- var ret = JSON.parse(getStringFromWasm0(arg0, arg1));
2513
+ imports.wbg.__wbg_node_080f4b19d15bc1fe = function(arg0) {
2514
+ const ret = getObject(arg0).node;
761
2515
  return addHeapObject(ret);
762
2516
  };
763
- imports.wbg.__wbg_get_a8b9619536c590d4 = function(arg0, arg1) {
764
- var ret = getObject(arg0)[arg1 >>> 0];
2517
+ imports.wbg.__wbg_msCrypto_6e7d3e1f92610cbb = function(arg0) {
2518
+ const ret = getObject(arg0).msCrypto;
765
2519
  return addHeapObject(ret);
766
2520
  };
767
- imports.wbg.__wbg_get_4bab9404e99a1f85 = handleError(function(arg0, arg1) {
768
- var ret = Reflect.get(getObject(arg0), getObject(arg1));
2521
+ imports.wbg.__wbg_require_78a3dcfbdba9cbce = function() { return handleError(function () {
2522
+ const ret = module.require;
769
2523
  return addHeapObject(ret);
770
- });
771
- imports.wbg.__wbg_new_1abc33d4f9ba3e80 = function() {
772
- var ret = new Array();
2524
+ }, arguments) };
2525
+ imports.wbg.__wbindgen_is_function = function(arg0) {
2526
+ const ret = typeof(getObject(arg0)) === 'function';
2527
+ return ret;
2528
+ };
2529
+ imports.wbg.__wbg_get_27fe3dac1c4d0224 = function(arg0, arg1) {
2530
+ const ret = getObject(arg0)[arg1 >>> 0];
773
2531
  return addHeapObject(ret);
774
2532
  };
775
- imports.wbg.__wbg_push_44968dcdf4cfbb43 = function(arg0, arg1) {
776
- var ret = getObject(arg0).push(getObject(arg1));
2533
+ imports.wbg.__wbg_length_e498fbc24f9c1d4f = function(arg0) {
2534
+ const ret = getObject(arg0).length;
777
2535
  return ret;
778
2536
  };
779
- imports.wbg.__wbg_call_7a2b5e98ac536644 = handleError(function(arg0, arg1, arg2) {
780
- var ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2537
+ imports.wbg.__wbg_new_b525de17f44a8943 = function() {
2538
+ const ret = new Array();
2539
+ return addHeapObject(ret);
2540
+ };
2541
+ imports.wbg.__wbg_newnoargs_2b8b6bd7753c76ba = function(arg0, arg1) {
2542
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
2543
+ return addHeapObject(ret);
2544
+ };
2545
+ imports.wbg.__wbg_new_f841cc6f2098f4b5 = function() {
2546
+ const ret = new Map();
781
2547
  return addHeapObject(ret);
782
- });
783
- imports.wbg.__wbg_new_dc5b27cfd2149b8f = function() {
784
- var ret = new Object();
2548
+ };
2549
+ imports.wbg.__wbg_next_b7d530c04fd8b217 = function(arg0) {
2550
+ const ret = getObject(arg0).next;
785
2551
  return addHeapObject(ret);
786
2552
  };
787
- imports.wbg.__wbg_set_3afd31f38e771338 = handleError(function(arg0, arg1, arg2) {
788
- var ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
2553
+ imports.wbg.__wbg_next_88560ec06a094dea = function() { return handleError(function (arg0) {
2554
+ const ret = getObject(arg0).next();
2555
+ return addHeapObject(ret);
2556
+ }, arguments) };
2557
+ imports.wbg.__wbg_done_1ebec03bbd919843 = function(arg0) {
2558
+ const ret = getObject(arg0).done;
789
2559
  return ret;
790
- });
791
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
792
- const obj = getObject(arg1);
793
- var ret = typeof(obj) === 'number' ? obj : undefined;
794
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
2560
+ };
2561
+ imports.wbg.__wbg_value_6ac8da5cc5b3efda = function(arg0) {
2562
+ const ret = getObject(arg0).value;
2563
+ return addHeapObject(ret);
2564
+ };
2565
+ imports.wbg.__wbg_iterator_55f114446221aa5a = function() {
2566
+ const ret = Symbol.iterator;
2567
+ return addHeapObject(ret);
2568
+ };
2569
+ imports.wbg.__wbg_get_baf4855f9a986186 = function() { return handleError(function (arg0, arg1) {
2570
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
2571
+ return addHeapObject(ret);
2572
+ }, arguments) };
2573
+ imports.wbg.__wbg_call_95d1ea488d03e4e8 = function() { return handleError(function (arg0, arg1) {
2574
+ const ret = getObject(arg0).call(getObject(arg1));
2575
+ return addHeapObject(ret);
2576
+ }, arguments) };
2577
+ imports.wbg.__wbg_new_f9876326328f45ed = function() {
2578
+ const ret = new Object();
2579
+ return addHeapObject(ret);
2580
+ };
2581
+ imports.wbg.__wbg_self_e7c1f827057f6584 = function() { return handleError(function () {
2582
+ const ret = self.self;
2583
+ return addHeapObject(ret);
2584
+ }, arguments) };
2585
+ imports.wbg.__wbg_window_a09ec664e14b1b81 = function() { return handleError(function () {
2586
+ const ret = window.window;
2587
+ return addHeapObject(ret);
2588
+ }, arguments) };
2589
+ imports.wbg.__wbg_globalThis_87cbb8506fecf3a9 = function() { return handleError(function () {
2590
+ const ret = globalThis.globalThis;
2591
+ return addHeapObject(ret);
2592
+ }, arguments) };
2593
+ imports.wbg.__wbg_global_c85a9259e621f3db = function() { return handleError(function () {
2594
+ const ret = global.global;
2595
+ return addHeapObject(ret);
2596
+ }, arguments) };
2597
+ imports.wbg.__wbg_set_17224bc548dd1d7b = function(arg0, arg1, arg2) {
2598
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
2599
+ };
2600
+ imports.wbg.__wbg_isArray_39d28997bf6b96b4 = function(arg0) {
2601
+ const ret = Array.isArray(getObject(arg0));
2602
+ return ret;
2603
+ };
2604
+ imports.wbg.__wbg_push_49c286f04dd3bf59 = function(arg0, arg1) {
2605
+ const ret = getObject(arg0).push(getObject(arg1));
2606
+ return ret;
2607
+ };
2608
+ imports.wbg.__wbg_instanceof_ArrayBuffer_a69f02ee4c4f5065 = function(arg0) {
2609
+ let result;
2610
+ try {
2611
+ result = getObject(arg0) instanceof ArrayBuffer;
2612
+ } catch {
2613
+ result = false;
2614
+ }
2615
+ const ret = result;
2616
+ return ret;
2617
+ };
2618
+ imports.wbg.__wbg_call_9495de66fdbe016b = function() { return handleError(function (arg0, arg1, arg2) {
2619
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2620
+ return addHeapObject(ret);
2621
+ }, arguments) };
2622
+ imports.wbg.__wbg_call_96878afb7a8201ca = function() { return handleError(function (arg0, arg1, arg2, arg3) {
2623
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
2624
+ return addHeapObject(ret);
2625
+ }, arguments) };
2626
+ imports.wbg.__wbg_set_388c4c6422704173 = function(arg0, arg1, arg2) {
2627
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2628
+ return addHeapObject(ret);
2629
+ };
2630
+ imports.wbg.__wbg_isSafeInteger_8c4789029e885159 = function(arg0) {
2631
+ const ret = Number.isSafeInteger(getObject(arg0));
2632
+ return ret;
2633
+ };
2634
+ imports.wbg.__wbg_entries_4e1315b774245952 = function(arg0) {
2635
+ const ret = Object.entries(getObject(arg0));
2636
+ return addHeapObject(ret);
2637
+ };
2638
+ imports.wbg.__wbg_buffer_cf65c07de34b9a08 = function(arg0) {
2639
+ const ret = getObject(arg0).buffer;
2640
+ return addHeapObject(ret);
2641
+ };
2642
+ imports.wbg.__wbg_new_537b7341ce90bb31 = function(arg0) {
2643
+ const ret = new Uint8Array(getObject(arg0));
2644
+ return addHeapObject(ret);
2645
+ };
2646
+ imports.wbg.__wbg_set_17499e8aa4003ebd = function(arg0, arg1, arg2) {
2647
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
2648
+ };
2649
+ imports.wbg.__wbg_length_27a2afe8ab42b09f = function(arg0) {
2650
+ const ret = getObject(arg0).length;
2651
+ return ret;
2652
+ };
2653
+ imports.wbg.__wbg_instanceof_Uint8Array_01cebe79ca606cca = function(arg0) {
2654
+ let result;
2655
+ try {
2656
+ result = getObject(arg0) instanceof Uint8Array;
2657
+ } catch {
2658
+ result = false;
2659
+ }
2660
+ const ret = result;
2661
+ return ret;
2662
+ };
2663
+ imports.wbg.__wbg_newwithlength_b56c882b57805732 = function(arg0) {
2664
+ const ret = new Uint8Array(arg0 >>> 0);
2665
+ return addHeapObject(ret);
2666
+ };
2667
+ imports.wbg.__wbg_subarray_7526649b91a252a6 = function(arg0, arg1, arg2) {
2668
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
2669
+ return addHeapObject(ret);
2670
+ };
2671
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
2672
+ const v = getObject(arg1);
2673
+ const ret = typeof(v) === 'bigint' ? v : undefined;
2674
+ getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret;
795
2675
  getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
796
2676
  };
797
2677
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
798
- var ret = debugString(getObject(arg1));
799
- var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
800
- var len0 = WASM_VECTOR_LEN;
2678
+ const ret = debugString(getObject(arg1));
2679
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2680
+ const len0 = WASM_VECTOR_LEN;
801
2681
  getInt32Memory0()[arg0 / 4 + 1] = len0;
802
2682
  getInt32Memory0()[arg0 / 4 + 0] = ptr0;
803
2683
  };
804
2684
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
805
2685
  throw new Error(getStringFromWasm0(arg0, arg1));
806
2686
  };
807
- imports.wbg.__wbindgen_rethrow = function(arg0) {
808
- throw takeObject(arg0);
2687
+ imports.wbg.__wbindgen_memory = function() {
2688
+ const ret = wasm.memory;
2689
+ return addHeapObject(ret);
809
2690
  };
810
2691
 
2692
+ return imports;
2693
+ }
2694
+
2695
+ function finalizeInit(instance, module) {
2696
+ wasm = instance.exports;
2697
+ init.__wbindgen_wasm_module = module;
2698
+ cachedBigInt64Memory0 = null;
2699
+ cachedFloat32Memory0 = null;
2700
+ cachedFloat64Memory0 = null;
2701
+ cachedInt32Memory0 = null;
2702
+ cachedUint8Memory0 = null;
2703
+
2704
+
2705
+ return wasm;
2706
+ }
2707
+
2708
+ function initSync(module) {
2709
+ const imports = getImports();
2710
+
2711
+ if (!(module instanceof WebAssembly.Module)) {
2712
+ module = new WebAssembly.Module(module);
2713
+ }
2714
+
2715
+ const instance = new WebAssembly.Instance(module, imports);
2716
+
2717
+ return finalizeInit(instance, module);
2718
+ }
2719
+
2720
+ async function init(input) {
2721
+ if (typeof input === 'undefined') {
2722
+ input = new URL('egraph_wasm_bg.wasm', (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('egraph.js', document.baseURI).href)));
2723
+ }
2724
+ const imports = getImports();
2725
+
811
2726
  if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
812
2727
  input = fetch(input);
813
2728
  }
814
2729
 
815
2730
  const { instance, module } = await load(await input, imports);
816
2731
 
817
- wasm = instance.exports;
818
- init.__wbindgen_wasm_module = module;
819
-
820
- return wasm;
2732
+ return finalizeInit(instance, module);
821
2733
  }
822
2734
 
823
- exports.CenterForce = CenterForce;
824
- exports.Force = Force;
2735
+ exports.ClassicalMds = ClassicalMds;
2736
+ exports.CollideForce = CollideForce;
2737
+ exports.Coordinates = Coordinates;
2738
+ exports.DiGraph = DiGraph;
2739
+ exports.Drawing = Drawing;
2740
+ exports.ForceAtlas2 = ForceAtlas2;
2741
+ exports.FruchtermanReingoldForce = FruchtermanReingoldForce;
2742
+ exports.FullSgd = FullSgd;
825
2743
  exports.Graph = Graph;
2744
+ exports.GroupLinkForce = GroupLinkForce;
2745
+ exports.GroupManyBodyForce = GroupManyBodyForce;
2746
+ exports.GroupPositionForce = GroupPositionForce;
2747
+ exports.HyperbolicSpace = HyperbolicSpace;
2748
+ exports.KamadaKawai = KamadaKawai;
826
2749
  exports.LinkForce = LinkForce;
827
2750
  exports.ManyBodyForce = ManyBodyForce;
2751
+ exports.PivotMds = PivotMds;
2752
+ exports.PositionForce = PositionForce;
2753
+ exports.RadialForce = RadialForce;
2754
+ exports.Rng = Rng;
2755
+ exports.SgdScheduler = SgdScheduler;
828
2756
  exports.Simulation = Simulation;
2757
+ exports.SparseSgd = SparseSgd;
2758
+ exports.SphericalSpace = SphericalSpace;
2759
+ exports.StressMajorization = StressMajorization;
2760
+ exports.coarsen = coarsen;
2761
+ exports.crossingNumber = crossingNumber;
829
2762
  exports.fdeb = fdeb;
830
2763
  exports.fm3 = fm3;
831
- exports.forceConnected = forceConnected;
832
- exports.forceGrouped = forceGrouped;
833
- exports.forceNonconnected = forceNonconnected;
834
2764
  exports.init = init;
835
- exports.initialPlacement = initialPlacement;
836
- exports.kamadaKawai = kamadaKawai;
2765
+ exports.initSync = initSync;
2766
+ exports.neighborhoodPreservation = neighborhoodPreservation;
2767
+ exports.stress = stress;
837
2768
 
838
2769
  Object.defineProperty(exports, '__esModule', { value: true });
839
2770