egraph 4.0.1-alpha.8 → 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/umd/egraph.js DELETED
@@ -1,1626 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = global || self, factory(global.egraph = {}));
5
- }(this, function (exports) { 'use strict';
6
-
7
- let wasm;
8
-
9
- const heap = new Array(32);
10
-
11
- heap.fill(undefined);
12
-
13
- heap.push(undefined, null, true, false);
14
-
15
- let heap_next = heap.length;
16
-
17
- function addHeapObject(obj) {
18
- if (heap_next === heap.length) heap.push(heap.length + 1);
19
- const idx = heap_next;
20
- heap_next = heap[idx];
21
-
22
- heap[idx] = obj;
23
- return idx;
24
- }
25
- function __wbg_elem_binding0(arg0, arg1, arg2, arg3, arg4) {
26
- wasm.__wbg_function_table.get(146)(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
27
- }
28
-
29
- function _assertClass(instance, klass) {
30
- if (!(instance instanceof klass)) {
31
- throw new Error(`expected instance of ${klass.name}`);
32
- }
33
- return instance.ptr;
34
- }
35
-
36
- function getObject(idx) { return heap[idx]; }
37
-
38
- function dropObject(idx) {
39
- if (idx < 36) return;
40
- heap[idx] = heap_next;
41
- heap_next = idx;
42
- }
43
-
44
- function takeObject(idx) {
45
- const ret = getObject(idx);
46
- dropObject(idx);
47
- return ret;
48
- }
49
-
50
- let stack_pointer = 32;
51
-
52
- function addBorrowedObject(obj) {
53
- if (stack_pointer == 1) throw new Error('out of js stack');
54
- heap[--stack_pointer] = obj;
55
- return stack_pointer;
56
- }
57
- /**
58
- * @param {any} graph
59
- * @param {any} grouping
60
- * @param {any} weight
61
- * @returns {any}
62
- */
63
- function aggregateNodes(graph, grouping, weight) {
64
- const ret = wasm.aggregateNodes(addHeapObject(graph), addHeapObject(grouping), addHeapObject(weight));
65
- return takeObject(ret);
66
- }
67
-
68
- /**
69
- * @param {any} graph
70
- * @param {any} grouping
71
- * @param {any} weight
72
- * @returns {any}
73
- */
74
- function aggregateEdges(graph, grouping, weight) {
75
- const ret = wasm.aggregateEdges(addHeapObject(graph), addHeapObject(grouping), addHeapObject(weight));
76
- return takeObject(ret);
77
- }
78
-
79
- /**
80
- * @param {any} graph
81
- * @returns {any}
82
- */
83
- function connected_components(graph) {
84
- const ret = wasm.connected_components(addHeapObject(graph));
85
- return takeObject(ret);
86
- }
87
-
88
- let cachedTextDecoder = new TextDecoder('utf-8');
89
-
90
- let cachegetUint8Memory = null;
91
- function getUint8Memory() {
92
- if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) {
93
- cachegetUint8Memory = new Uint8Array(wasm.memory.buffer);
94
- }
95
- return cachegetUint8Memory;
96
- }
97
-
98
- function getStringFromWasm(ptr, len) {
99
- return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len));
100
- }
101
-
102
- function handleError(e) {
103
- wasm.__wbindgen_exn_store(addHeapObject(e));
104
- }
105
-
106
- let WASM_VECTOR_LEN = 0;
107
-
108
- let cachedTextEncoder = new TextEncoder('utf-8');
109
-
110
- let passStringToWasm;
111
- if (typeof cachedTextEncoder.encodeInto === 'function') {
112
- passStringToWasm = function(arg) {
113
-
114
-
115
- let size = arg.length;
116
- let ptr = wasm.__wbindgen_malloc(size);
117
- let offset = 0;
118
- {
119
- const mem = getUint8Memory();
120
- for (; offset < arg.length; offset++) {
121
- const code = arg.charCodeAt(offset);
122
- if (code > 0x7F) break;
123
- mem[ptr + offset] = code;
124
- }
125
- }
126
-
127
- if (offset !== arg.length) {
128
- arg = arg.slice(offset);
129
- ptr = wasm.__wbindgen_realloc(ptr, size, size = offset + arg.length * 3);
130
- const view = getUint8Memory().subarray(ptr + offset, ptr + size);
131
- const ret = cachedTextEncoder.encodeInto(arg, view);
132
-
133
- offset += ret.written;
134
- }
135
- WASM_VECTOR_LEN = offset;
136
- return ptr;
137
- };
138
- } else {
139
- passStringToWasm = function(arg) {
140
-
141
-
142
- let size = arg.length;
143
- let ptr = wasm.__wbindgen_malloc(size);
144
- let offset = 0;
145
- {
146
- const mem = getUint8Memory();
147
- for (; offset < arg.length; offset++) {
148
- const code = arg.charCodeAt(offset);
149
- if (code > 0x7F) break;
150
- mem[ptr + offset] = code;
151
- }
152
- }
153
-
154
- if (offset !== arg.length) {
155
- const buf = cachedTextEncoder.encode(arg.slice(offset));
156
- ptr = wasm.__wbindgen_realloc(ptr, size, size = offset + buf.length);
157
- getUint8Memory().set(buf, ptr + offset);
158
- offset += buf.length;
159
- }
160
- WASM_VECTOR_LEN = offset;
161
- return ptr;
162
- };
163
- }
164
-
165
- let cachegetInt32Memory = null;
166
- function getInt32Memory() {
167
- if (cachegetInt32Memory === null || cachegetInt32Memory.buffer !== wasm.memory.buffer) {
168
- cachegetInt32Memory = new Int32Array(wasm.memory.buffer);
169
- }
170
- return cachegetInt32Memory;
171
- }
172
-
173
- function debugString(val) {
174
- // primitive types
175
- const type = typeof val;
176
- if (type == 'number' || type == 'boolean' || val == null) {
177
- return `${val}`;
178
- }
179
- if (type == 'string') {
180
- return `"${val}"`;
181
- }
182
- if (type == 'symbol') {
183
- const description = val.description;
184
- if (description == null) {
185
- return 'Symbol';
186
- } else {
187
- return `Symbol(${description})`;
188
- }
189
- }
190
- if (type == 'function') {
191
- const name = val.name;
192
- if (typeof name == 'string' && name.length > 0) {
193
- return `Function(${name})`;
194
- } else {
195
- return 'Function';
196
- }
197
- }
198
- // objects
199
- if (Array.isArray(val)) {
200
- const length = val.length;
201
- let debug = '[';
202
- if (length > 0) {
203
- debug += debugString(val[0]);
204
- }
205
- for(let i = 1; i < length; i++) {
206
- debug += ', ' + debugString(val[i]);
207
- }
208
- debug += ']';
209
- return debug;
210
- }
211
- // Test for built-in
212
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
213
- let className;
214
- if (builtInMatches.length > 1) {
215
- className = builtInMatches[1];
216
- } else {
217
- // Failed to match the standard '[object ClassName]'
218
- return toString.call(val);
219
- }
220
- if (className == 'Object') {
221
- // we're a user defined class or Object
222
- // JSON.stringify avoids problems with cycles, and is generally much
223
- // easier than looping through ownProperties of `val`.
224
- try {
225
- return 'Object(' + JSON.stringify(val) + ')';
226
- } catch (_) {
227
- return 'Object';
228
- }
229
- }
230
- // errors
231
- if (val instanceof Error) {
232
- return `${val.name}: ${val.message}\n${val.stack}`;
233
- }
234
- // TODO we could test for more things here, like `Set`s and `Map`s.
235
- return className;
236
- }
237
- /**
238
- */
239
- class CenterForce {
240
-
241
- static __wrap(ptr) {
242
- const obj = Object.create(CenterForce.prototype);
243
- obj.ptr = ptr;
244
-
245
- return obj;
246
- }
247
-
248
- free() {
249
- const ptr = this.ptr;
250
- this.ptr = 0;
251
-
252
- wasm.__wbg_centerforce_free(ptr);
253
- }
254
- /**
255
- * @returns {CenterForce}
256
- */
257
- constructor() {
258
- const ret = wasm.centerforce_new();
259
- return CenterForce.__wrap(ret);
260
- }
261
- /**
262
- * @returns {Force}
263
- */
264
- force() {
265
- const ret = wasm.centerforce_force(this.ptr);
266
- return Force.__wrap(ret);
267
- }
268
- }
269
- /**
270
- */
271
- class CollideForce {
272
-
273
- static __wrap(ptr) {
274
- const obj = Object.create(CollideForce.prototype);
275
- obj.ptr = ptr;
276
-
277
- return obj;
278
- }
279
-
280
- free() {
281
- const ptr = this.ptr;
282
- this.ptr = 0;
283
-
284
- wasm.__wbg_collideforce_free(ptr);
285
- }
286
- /**
287
- * @returns {CollideForce}
288
- */
289
- constructor() {
290
- const ret = wasm.collideforce_new();
291
- return CollideForce.__wrap(ret);
292
- }
293
- /**
294
- * @returns {Force}
295
- */
296
- force() {
297
- const ret = wasm.collideforce_force(this.ptr);
298
- return Force.__wrap(ret);
299
- }
300
- /**
301
- * @param {any} f
302
- */
303
- set radius(f) {
304
- try {
305
- wasm.collideforce_radius(this.ptr, addBorrowedObject(f));
306
- } finally {
307
- heap[stack_pointer++] = undefined;
308
- }
309
- }
310
- /**
311
- * @returns {number}
312
- */
313
- get strength() {
314
- const ret = wasm.collideforce_strength(this.ptr);
315
- return ret;
316
- }
317
- /**
318
- * @param {number} value
319
- */
320
- set strength(value) {
321
- wasm.collideforce_set_strength(this.ptr, value);
322
- }
323
- }
324
- /**
325
- */
326
- class Force {
327
-
328
- static __wrap(ptr) {
329
- const obj = Object.create(Force.prototype);
330
- obj.ptr = ptr;
331
-
332
- return obj;
333
- }
334
-
335
- free() {
336
- const ptr = this.ptr;
337
- this.ptr = 0;
338
-
339
- wasm.__wbg_force_free(ptr);
340
- }
341
- }
342
- /**
343
- */
344
- class ForceDirectedEdgeBundling {
345
-
346
- static __wrap(ptr) {
347
- const obj = Object.create(ForceDirectedEdgeBundling.prototype);
348
- obj.ptr = ptr;
349
-
350
- return obj;
351
- }
352
-
353
- free() {
354
- const ptr = this.ptr;
355
- this.ptr = 0;
356
-
357
- wasm.__wbg_forcedirectededgebundling_free(ptr);
358
- }
359
- /**
360
- * @returns {ForceDirectedEdgeBundling}
361
- */
362
- constructor() {
363
- const ret = wasm.forcedirectededgebundling_new();
364
- return ForceDirectedEdgeBundling.__wrap(ret);
365
- }
366
- /**
367
- * @param {any} graph
368
- * @param {any} point_array
369
- * @returns {any}
370
- */
371
- call(graph, point_array) {
372
- const ret = wasm.forcedirectededgebundling_call(this.ptr, addHeapObject(graph), addHeapObject(point_array));
373
- return takeObject(ret);
374
- }
375
- /**
376
- * @param {any} value
377
- * @returns {any}
378
- */
379
- cycles(value) {
380
- const ret = wasm.forcedirectededgebundling_cycles(this.ptr, addHeapObject(value));
381
- return takeObject(ret);
382
- }
383
- /**
384
- * @param {any} value
385
- * @returns {any}
386
- */
387
- s0(value) {
388
- const ret = wasm.forcedirectededgebundling_s0(this.ptr, addHeapObject(value));
389
- return takeObject(ret);
390
- }
391
- /**
392
- * @param {any} value
393
- * @returns {any}
394
- */
395
- sStep(value) {
396
- const ret = wasm.forcedirectededgebundling_sStep(this.ptr, addHeapObject(value));
397
- return takeObject(ret);
398
- }
399
- /**
400
- * @param {any} value
401
- * @returns {any}
402
- */
403
- i0(value) {
404
- const ret = wasm.forcedirectededgebundling_i0(this.ptr, addHeapObject(value));
405
- return takeObject(ret);
406
- }
407
- /**
408
- * @param {any} value
409
- * @returns {any}
410
- */
411
- iStep(value) {
412
- const ret = wasm.forcedirectededgebundling_iStep(this.ptr, addHeapObject(value));
413
- return takeObject(ret);
414
- }
415
- /**
416
- * @param {any} value
417
- * @returns {any}
418
- */
419
- minimumEdgeCompatibility(value) {
420
- const ret = wasm.forcedirectededgebundling_minimumEdgeCompatibility(this.ptr, addHeapObject(value));
421
- return takeObject(ret);
422
- }
423
- }
424
- /**
425
- */
426
- class ForceDirectedGrouping {
427
-
428
- static __wrap(ptr) {
429
- const obj = Object.create(ForceDirectedGrouping.prototype);
430
- obj.ptr = ptr;
431
-
432
- return obj;
433
- }
434
-
435
- free() {
436
- const ptr = this.ptr;
437
- this.ptr = 0;
438
-
439
- wasm.__wbg_forcedirectedgrouping_free(ptr);
440
- }
441
- /**
442
- * @returns {ForceDirectedGrouping}
443
- */
444
- constructor() {
445
- const ret = wasm.forcedirectedgrouping_new();
446
- return ForceDirectedGrouping.__wrap(ret);
447
- }
448
- /**
449
- * @param {any} graph
450
- * @param {SimulationBuilder} builder
451
- * @param {any} new_graph
452
- * @returns {any}
453
- */
454
- call(graph, builder, new_graph) {
455
- _assertClass(builder, SimulationBuilder);
456
- const ptr0 = builder.ptr;
457
- builder.ptr = 0;
458
- const ret = wasm.forcedirectedgrouping_call(this.ptr, addHeapObject(graph), ptr0, addHeapObject(new_graph));
459
- return takeObject(ret);
460
- }
461
- /**
462
- * @param {any} f
463
- */
464
- set group(f) {
465
- try {
466
- wasm.forcedirectedgrouping_set_group(this.ptr, addBorrowedObject(f));
467
- } finally {
468
- heap[stack_pointer++] = undefined;
469
- }
470
- }
471
- /**
472
- * @param {any} f
473
- */
474
- set nodeWeight(f) {
475
- try {
476
- wasm.forcedirectedgrouping_set_node_weight(this.ptr, addBorrowedObject(f));
477
- } finally {
478
- heap[stack_pointer++] = undefined;
479
- }
480
- }
481
- /**
482
- * @param {any} f
483
- */
484
- set linkWeight(f) {
485
- try {
486
- wasm.forcedirectedgrouping_set_link_weight(this.ptr, addBorrowedObject(f));
487
- } finally {
488
- heap[stack_pointer++] = undefined;
489
- }
490
- }
491
- }
492
- /**
493
- */
494
- class GroupCenterForce {
495
-
496
- static __wrap(ptr) {
497
- const obj = Object.create(GroupCenterForce.prototype);
498
- obj.ptr = ptr;
499
-
500
- return obj;
501
- }
502
-
503
- free() {
504
- const ptr = this.ptr;
505
- this.ptr = 0;
506
-
507
- wasm.__wbg_groupcenterforce_free(ptr);
508
- }
509
- /**
510
- * @returns {GroupCenterForce}
511
- */
512
- constructor() {
513
- const ret = wasm.groupcenterforce_new();
514
- return GroupCenterForce.__wrap(ret);
515
- }
516
- /**
517
- * @returns {Force}
518
- */
519
- force() {
520
- const ret = wasm.groupcenterforce_force(this.ptr);
521
- return Force.__wrap(ret);
522
- }
523
- /**
524
- * @param {any} f
525
- */
526
- set group(f) {
527
- try {
528
- wasm.groupcenterforce_set_group(this.ptr, addBorrowedObject(f));
529
- } finally {
530
- heap[stack_pointer++] = undefined;
531
- }
532
- }
533
- /**
534
- * @param {any} f
535
- */
536
- set groupX(f) {
537
- try {
538
- wasm.groupcenterforce_set_group_x(this.ptr, addBorrowedObject(f));
539
- } finally {
540
- heap[stack_pointer++] = undefined;
541
- }
542
- }
543
- /**
544
- * @param {any} f
545
- */
546
- set groupY(f) {
547
- try {
548
- wasm.groupcenterforce_set_group_y(this.ptr, addBorrowedObject(f));
549
- } finally {
550
- heap[stack_pointer++] = undefined;
551
- }
552
- }
553
- }
554
- /**
555
- */
556
- class GroupLinkForce {
557
-
558
- static __wrap(ptr) {
559
- const obj = Object.create(GroupLinkForce.prototype);
560
- obj.ptr = ptr;
561
-
562
- return obj;
563
- }
564
-
565
- free() {
566
- const ptr = this.ptr;
567
- this.ptr = 0;
568
-
569
- wasm.__wbg_grouplinkforce_free(ptr);
570
- }
571
- /**
572
- * @returns {GroupLinkForce}
573
- */
574
- constructor() {
575
- const ret = wasm.grouplinkforce_new();
576
- return GroupLinkForce.__wrap(ret);
577
- }
578
- /**
579
- * @returns {Force}
580
- */
581
- force() {
582
- const ret = wasm.grouplinkforce_force(this.ptr);
583
- return Force.__wrap(ret);
584
- }
585
- /**
586
- * @param {any} f
587
- */
588
- set group(f) {
589
- try {
590
- wasm.grouplinkforce_set_group(this.ptr, addBorrowedObject(f));
591
- } finally {
592
- heap[stack_pointer++] = undefined;
593
- }
594
- }
595
- /**
596
- * @returns {number}
597
- */
598
- get intraGroup() {
599
- const ret = wasm.grouplinkforce_intra_group(this.ptr);
600
- return ret;
601
- }
602
- /**
603
- * @param {number} value
604
- */
605
- set intraGroup(value) {
606
- wasm.grouplinkforce_set_intra_group(this.ptr, value);
607
- }
608
- /**
609
- * @returns {number}
610
- */
611
- get interGroup() {
612
- const ret = wasm.grouplinkforce_inter_group(this.ptr);
613
- return ret;
614
- }
615
- /**
616
- * @param {number} value
617
- */
618
- set interGroup(value) {
619
- wasm.grouplinkforce_set_inter_group(this.ptr, value);
620
- }
621
- /**
622
- * @param {any} f
623
- */
624
- set distance(f) {
625
- try {
626
- wasm.grouplinkforce_set_distance(this.ptr, addBorrowedObject(f));
627
- } finally {
628
- heap[stack_pointer++] = undefined;
629
- }
630
- }
631
- }
632
- /**
633
- */
634
- class GroupManyBodyForce {
635
-
636
- static __wrap(ptr) {
637
- const obj = Object.create(GroupManyBodyForce.prototype);
638
- obj.ptr = ptr;
639
-
640
- return obj;
641
- }
642
-
643
- free() {
644
- const ptr = this.ptr;
645
- this.ptr = 0;
646
-
647
- wasm.__wbg_groupmanybodyforce_free(ptr);
648
- }
649
- /**
650
- * @returns {GroupManyBodyForce}
651
- */
652
- constructor() {
653
- const ret = wasm.groupmanybodyforce_new();
654
- return GroupManyBodyForce.__wrap(ret);
655
- }
656
- /**
657
- * @returns {Force}
658
- */
659
- force() {
660
- const ret = wasm.groupmanybodyforce_force(this.ptr);
661
- return Force.__wrap(ret);
662
- }
663
- /**
664
- * @param {any} f
665
- */
666
- set group(f) {
667
- try {
668
- wasm.groupmanybodyforce_set_group(this.ptr, addBorrowedObject(f));
669
- } finally {
670
- heap[stack_pointer++] = undefined;
671
- }
672
- }
673
- /**
674
- * @param {any} f
675
- */
676
- set strength(f) {
677
- try {
678
- wasm.groupmanybodyforce_set_strength(this.ptr, addBorrowedObject(f));
679
- } finally {
680
- heap[stack_pointer++] = undefined;
681
- }
682
- }
683
- }
684
- /**
685
- */
686
- class GroupPositionForce {
687
-
688
- static __wrap(ptr) {
689
- const obj = Object.create(GroupPositionForce.prototype);
690
- obj.ptr = ptr;
691
-
692
- return obj;
693
- }
694
-
695
- free() {
696
- const ptr = this.ptr;
697
- this.ptr = 0;
698
-
699
- wasm.__wbg_grouppositionforce_free(ptr);
700
- }
701
- /**
702
- * @returns {GroupPositionForce}
703
- */
704
- constructor() {
705
- const ret = wasm.grouppositionforce_new();
706
- return GroupPositionForce.__wrap(ret);
707
- }
708
- /**
709
- * @returns {Force}
710
- */
711
- force() {
712
- const ret = wasm.grouppositionforce_force(this.ptr);
713
- return Force.__wrap(ret);
714
- }
715
- /**
716
- * @param {any} f
717
- */
718
- set group(f) {
719
- try {
720
- wasm.grouppositionforce_set_group(this.ptr, addBorrowedObject(f));
721
- } finally {
722
- heap[stack_pointer++] = undefined;
723
- }
724
- }
725
- /**
726
- * @param {any} f
727
- */
728
- set strength(f) {
729
- try {
730
- wasm.grouppositionforce_set_strength(this.ptr, addBorrowedObject(f));
731
- } finally {
732
- heap[stack_pointer++] = undefined;
733
- }
734
- }
735
- /**
736
- * @param {any} f
737
- */
738
- set groupX(f) {
739
- try {
740
- wasm.grouppositionforce_set_group_x(this.ptr, addBorrowedObject(f));
741
- } finally {
742
- heap[stack_pointer++] = undefined;
743
- }
744
- }
745
- /**
746
- * @param {any} f
747
- */
748
- set groupY(f) {
749
- try {
750
- wasm.grouppositionforce_set_group_y(this.ptr, addBorrowedObject(f));
751
- } finally {
752
- heap[stack_pointer++] = undefined;
753
- }
754
- }
755
- }
756
- /**
757
- */
758
- class LinkForce {
759
-
760
- static __wrap(ptr) {
761
- const obj = Object.create(LinkForce.prototype);
762
- obj.ptr = ptr;
763
-
764
- return obj;
765
- }
766
-
767
- free() {
768
- const ptr = this.ptr;
769
- this.ptr = 0;
770
-
771
- wasm.__wbg_linkforce_free(ptr);
772
- }
773
- /**
774
- * @returns {LinkForce}
775
- */
776
- constructor() {
777
- const ret = wasm.linkforce_new();
778
- return LinkForce.__wrap(ret);
779
- }
780
- /**
781
- * @returns {Force}
782
- */
783
- force() {
784
- const ret = wasm.linkforce_force(this.ptr);
785
- return Force.__wrap(ret);
786
- }
787
- /**
788
- * @param {any} f
789
- */
790
- set strength(f) {
791
- try {
792
- wasm.linkforce_set_strength(this.ptr, addBorrowedObject(f));
793
- } finally {
794
- heap[stack_pointer++] = undefined;
795
- }
796
- }
797
- /**
798
- * @param {any} f
799
- */
800
- set distance(f) {
801
- try {
802
- wasm.linkforce_distance(this.ptr, addBorrowedObject(f));
803
- } finally {
804
- heap[stack_pointer++] = undefined;
805
- }
806
- }
807
- }
808
- /**
809
- */
810
- class ManyBodyForce {
811
-
812
- static __wrap(ptr) {
813
- const obj = Object.create(ManyBodyForce.prototype);
814
- obj.ptr = ptr;
815
-
816
- return obj;
817
- }
818
-
819
- free() {
820
- const ptr = this.ptr;
821
- this.ptr = 0;
822
-
823
- wasm.__wbg_manybodyforce_free(ptr);
824
- }
825
- /**
826
- * @returns {ManyBodyForce}
827
- */
828
- constructor() {
829
- const ret = wasm.manybodyforce_new();
830
- return ManyBodyForce.__wrap(ret);
831
- }
832
- /**
833
- * @returns {Force}
834
- */
835
- force() {
836
- const ret = wasm.manybodyforce_force(this.ptr);
837
- return Force.__wrap(ret);
838
- }
839
- /**
840
- * @param {any} f
841
- */
842
- set strength(f) {
843
- try {
844
- wasm.manybodyforce_set_strength(this.ptr, addBorrowedObject(f));
845
- } finally {
846
- heap[stack_pointer++] = undefined;
847
- }
848
- }
849
- }
850
- /**
851
- */
852
- class PositionForce {
853
-
854
- static __wrap(ptr) {
855
- const obj = Object.create(PositionForce.prototype);
856
- obj.ptr = ptr;
857
-
858
- return obj;
859
- }
860
-
861
- free() {
862
- const ptr = this.ptr;
863
- this.ptr = 0;
864
-
865
- wasm.__wbg_positionforce_free(ptr);
866
- }
867
- /**
868
- * @returns {PositionForce}
869
- */
870
- constructor() {
871
- const ret = wasm.positionforce_new();
872
- return PositionForce.__wrap(ret);
873
- }
874
- /**
875
- * @returns {Force}
876
- */
877
- force() {
878
- const ret = wasm.positionforce_force(this.ptr);
879
- return Force.__wrap(ret);
880
- }
881
- /**
882
- * @param {any} f
883
- */
884
- set strength(f) {
885
- try {
886
- wasm.positionforce_set_strength(this.ptr, addBorrowedObject(f));
887
- } finally {
888
- heap[stack_pointer++] = undefined;
889
- }
890
- }
891
- /**
892
- * @param {any} f
893
- */
894
- set x(f) {
895
- try {
896
- wasm.positionforce_set_x(this.ptr, addBorrowedObject(f));
897
- } finally {
898
- heap[stack_pointer++] = undefined;
899
- }
900
- }
901
- /**
902
- * @param {any} f
903
- */
904
- set y(f) {
905
- try {
906
- wasm.positionforce_y(this.ptr, addBorrowedObject(f));
907
- } finally {
908
- heap[stack_pointer++] = undefined;
909
- }
910
- }
911
- }
912
- /**
913
- */
914
- class QuasiBiclique {
915
-
916
- static __wrap(ptr) {
917
- const obj = Object.create(QuasiBiclique.prototype);
918
- obj.ptr = ptr;
919
-
920
- return obj;
921
- }
922
-
923
- free() {
924
- const ptr = this.ptr;
925
- this.ptr = 0;
926
-
927
- wasm.__wbg_quasibiclique_free(ptr);
928
- }
929
- /**
930
- * @returns {QuasiBiclique}
931
- */
932
- constructor() {
933
- const ret = wasm.quasibiclique_new();
934
- return QuasiBiclique.__wrap(ret);
935
- }
936
- /**
937
- * @param {any} graph
938
- * @param {any} source
939
- * @param {any} target
940
- * @returns {any}
941
- */
942
- call(graph, source, target) {
943
- const ret = wasm.quasibiclique_call(this.ptr, addHeapObject(graph), addHeapObject(source), addHeapObject(target));
944
- return takeObject(ret);
945
- }
946
- }
947
- /**
948
- */
949
- class Simulation {
950
-
951
- static __wrap(ptr) {
952
- const obj = Object.create(Simulation.prototype);
953
- obj.ptr = ptr;
954
-
955
- return obj;
956
- }
957
-
958
- free() {
959
- const ptr = this.ptr;
960
- this.ptr = 0;
961
-
962
- wasm.__wbg_simulation_free(ptr);
963
- }
964
- /**
965
- */
966
- run() {
967
- wasm.simulation_run(this.ptr);
968
- }
969
- /**
970
- */
971
- step() {
972
- wasm.simulation_step(this.ptr);
973
- }
974
- /**
975
- * @param {number} n
976
- */
977
- stepN(n) {
978
- wasm.simulation_stepN(this.ptr, n);
979
- }
980
- /**
981
- * @returns {boolean}
982
- */
983
- isFinished() {
984
- const ret = wasm.simulation_isFinished(this.ptr);
985
- return ret !== 0;
986
- }
987
- /**
988
- * @param {number} alpha_start
989
- */
990
- reset(alpha_start) {
991
- wasm.simulation_reset(this.ptr, alpha_start);
992
- }
993
- /**
994
- * @param {number} u
995
- * @returns {number}
996
- */
997
- x(u) {
998
- const ret = wasm.simulation_x(this.ptr, u);
999
- return ret;
1000
- }
1001
- /**
1002
- * @param {number} u
1003
- * @returns {number}
1004
- */
1005
- y(u) {
1006
- const ret = wasm.simulation_y(this.ptr, u);
1007
- return ret;
1008
- }
1009
- }
1010
- /**
1011
- */
1012
- class SimulationBuilder {
1013
-
1014
- static __wrap(ptr) {
1015
- const obj = Object.create(SimulationBuilder.prototype);
1016
- obj.ptr = ptr;
1017
-
1018
- return obj;
1019
- }
1020
-
1021
- free() {
1022
- const ptr = this.ptr;
1023
- this.ptr = 0;
1024
-
1025
- wasm.__wbg_simulationbuilder_free(ptr);
1026
- }
1027
- /**
1028
- * @returns {SimulationBuilder}
1029
- */
1030
- constructor() {
1031
- const ret = wasm.simulationbuilder_new();
1032
- return SimulationBuilder.__wrap(ret);
1033
- }
1034
- /**
1035
- * @returns {SimulationBuilder}
1036
- */
1037
- static defaultSetting() {
1038
- const ret = wasm.simulationbuilder_defaultSetting();
1039
- return SimulationBuilder.__wrap(ret);
1040
- }
1041
- /**
1042
- * @param {any} force
1043
- */
1044
- add(force) {
1045
- try {
1046
- wasm.simulationbuilder_add(this.ptr, addBorrowedObject(force));
1047
- } finally {
1048
- heap[stack_pointer++] = undefined;
1049
- }
1050
- }
1051
- /**
1052
- * @param {any} graph
1053
- * @returns {Simulation}
1054
- */
1055
- build(graph) {
1056
- const ret = wasm.simulationbuilder_build(this.ptr, addHeapObject(graph));
1057
- return Simulation.__wrap(ret);
1058
- }
1059
- /**
1060
- * @returns {number}
1061
- */
1062
- get alphaStart() {
1063
- const ret = wasm.simulationbuilder_alpha_start(this.ptr);
1064
- return ret;
1065
- }
1066
- /**
1067
- * @param {number} value
1068
- */
1069
- set alphaStart(value) {
1070
- wasm.simulationbuilder_set_alpha_start(this.ptr, value);
1071
- }
1072
- /**
1073
- * @returns {number}
1074
- */
1075
- get alphaMin() {
1076
- const ret = wasm.simulationbuilder_alpha_min(this.ptr);
1077
- return ret;
1078
- }
1079
- /**
1080
- * @param {number} value
1081
- */
1082
- set alphaMin(value) {
1083
- wasm.simulationbuilder_set_alpha_min(this.ptr, value);
1084
- }
1085
- /**
1086
- * @returns {number}
1087
- */
1088
- get alphaTarget() {
1089
- const ret = wasm.simulationbuilder_alpha_target(this.ptr);
1090
- return ret;
1091
- }
1092
- /**
1093
- * @param {number} value
1094
- */
1095
- set alphaTarget(value) {
1096
- wasm.simulationbuilder_set_alpha_target(this.ptr, value);
1097
- }
1098
- /**
1099
- * @returns {number}
1100
- */
1101
- get velocityDecay() {
1102
- const ret = wasm.simulationbuilder_velocity_decay(this.ptr);
1103
- return ret;
1104
- }
1105
- /**
1106
- * @param {number} value
1107
- */
1108
- set velocityDecay(value) {
1109
- wasm.simulationbuilder_set_velocity_decay(this.ptr, value);
1110
- }
1111
- /**
1112
- * @returns {number}
1113
- */
1114
- get iterations() {
1115
- const ret = wasm.simulationbuilder_iterations(this.ptr);
1116
- return ret >>> 0;
1117
- }
1118
- /**
1119
- * @param {number} value
1120
- */
1121
- set iterations(value) {
1122
- wasm.simulationbuilder_set_iterations(this.ptr, value);
1123
- }
1124
- }
1125
- /**
1126
- */
1127
- class TreemapGrouping {
1128
-
1129
- static __wrap(ptr) {
1130
- const obj = Object.create(TreemapGrouping.prototype);
1131
- obj.ptr = ptr;
1132
-
1133
- return obj;
1134
- }
1135
-
1136
- free() {
1137
- const ptr = this.ptr;
1138
- this.ptr = 0;
1139
-
1140
- wasm.__wbg_treemapgrouping_free(ptr);
1141
- }
1142
- /**
1143
- * @returns {TreemapGrouping}
1144
- */
1145
- constructor() {
1146
- const ret = wasm.treemapgrouping_new();
1147
- return TreemapGrouping.__wrap(ret);
1148
- }
1149
- /**
1150
- * @param {any} graph
1151
- * @param {number} width
1152
- * @param {number} height
1153
- * @returns {any}
1154
- */
1155
- call(graph, width, height) {
1156
- const ret = wasm.treemapgrouping_call(this.ptr, addHeapObject(graph), width, height);
1157
- return takeObject(ret);
1158
- }
1159
- /**
1160
- * @param {any} f
1161
- */
1162
- set group(f) {
1163
- try {
1164
- wasm.treemapgrouping_set_group(this.ptr, addBorrowedObject(f));
1165
- } finally {
1166
- heap[stack_pointer++] = undefined;
1167
- }
1168
- }
1169
- /**
1170
- * @param {any} f
1171
- */
1172
- set weight(f) {
1173
- try {
1174
- wasm.treemapgrouping_set_weight(this.ptr, addBorrowedObject(f));
1175
- } finally {
1176
- heap[stack_pointer++] = undefined;
1177
- }
1178
- }
1179
- }
1180
-
1181
- function init(module) {
1182
- if (typeof module === 'undefined') {
1183
- module = (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');
1184
- }
1185
- let result;
1186
- const imports = {};
1187
- imports.wbg = {};
1188
- imports.wbg.__wbindgen_json_parse = function(arg0, arg1) {
1189
- const ret = JSON.parse(getStringFromWasm(arg0, arg1));
1190
- return addHeapObject(ret);
1191
- };
1192
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1193
- takeObject(arg0);
1194
- };
1195
- imports.wbg.__wbindgen_number_new = function(arg0) {
1196
- const ret = arg0;
1197
- return addHeapObject(ret);
1198
- };
1199
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1200
- const ret = getObject(arg0);
1201
- return addHeapObject(ret);
1202
- };
1203
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
1204
- const ret = getStringFromWasm(arg0, arg1);
1205
- return addHeapObject(ret);
1206
- };
1207
- imports.wbg.__wbindgen_is_null = function(arg0) {
1208
- const ret = getObject(arg0) === null;
1209
- return ret;
1210
- };
1211
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
1212
- const ret = getObject(arg0) === undefined;
1213
- return ret;
1214
- };
1215
- imports.wbg.__wbg_force_cde3c6acde9140ae = function(arg0) {
1216
- const ret = getObject(arg0).force();
1217
- _assertClass(ret, Force);
1218
- const ptr0 = ret.ptr;
1219
- ret.ptr = 0;
1220
- return ptr0;
1221
- };
1222
- imports.wbg.__wbg_nodes_7b2ab9947ba2a818 = function(arg0) {
1223
- const ret = getObject(arg0).nodes();
1224
- return addHeapObject(ret);
1225
- };
1226
- imports.wbg.__wbg_edges_4d96058d29ab6aa2 = function(arg0) {
1227
- const ret = getObject(arg0).edges();
1228
- return addHeapObject(ret);
1229
- };
1230
- imports.wbg.__wbg_outNodes_f72535569a19bd19 = function(arg0, arg1) {
1231
- const ret = getObject(arg0).outNodes(arg1 >>> 0);
1232
- return addHeapObject(ret);
1233
- };
1234
- imports.wbg.__wbg_inNodes_3cf96c54976106b8 = function(arg0, arg1) {
1235
- const ret = getObject(arg0).inNodes(arg1 >>> 0);
1236
- return addHeapObject(ret);
1237
- };
1238
- imports.wbg.__wbg_nodeCount_a2c9c12b9e926808 = function(arg0) {
1239
- const ret = getObject(arg0).nodeCount();
1240
- return ret;
1241
- };
1242
- imports.wbg.__wbg_outDegree_28889d96f812bf74 = function(arg0, arg1) {
1243
- const ret = getObject(arg0).outDegree(arg1 >>> 0);
1244
- return ret;
1245
- };
1246
- imports.wbg.__wbg_inDegree_aff795860e95326d = function(arg0, arg1) {
1247
- const ret = getObject(arg0).inDegree(arg1 >>> 0);
1248
- return ret;
1249
- };
1250
- imports.wbg.__wbg_edge_fc53ba998afc2ff9 = function(arg0, arg1, arg2) {
1251
- const ret = getObject(arg0).edge(arg1 >>> 0, arg2 >>> 0);
1252
- return addHeapObject(ret);
1253
- };
1254
- imports.wbg.__wbg_addNode_6f02f2794d3ab67b = function(arg0, arg1, arg2) {
1255
- getObject(arg0).addNode(arg1 >>> 0, takeObject(arg2));
1256
- };
1257
- imports.wbg.__wbg_addEdge_0c7967766e6f429b = function(arg0, arg1, arg2, arg3) {
1258
- getObject(arg0).addEdge(arg1 >>> 0, arg2 >>> 0, takeObject(arg3));
1259
- };
1260
- imports.wbg.__wbindgen_is_function = function(arg0) {
1261
- const ret = typeof(getObject(arg0)) === 'function';
1262
- return ret;
1263
- };
1264
- imports.wbg.__wbindgen_is_object = function(arg0) {
1265
- const val = getObject(arg0);
1266
- const ret = typeof(val) === 'object' && val !== null;
1267
- return ret;
1268
- };
1269
- imports.wbg.__wbg_next_d6edd775992f0f4c = function(arg0) {
1270
- const ret = getObject(arg0).next;
1271
- return addHeapObject(ret);
1272
- };
1273
- imports.wbg.__wbg_next_0f5d9584ef1627da = function(arg0) {
1274
- try {
1275
- const ret = getObject(arg0).next();
1276
- return addHeapObject(ret);
1277
- } catch (e) {
1278
- handleError(e);
1279
- }
1280
- };
1281
- imports.wbg.__wbg_done_a9aaa2595d27799d = function(arg0) {
1282
- const ret = getObject(arg0).done;
1283
- return ret;
1284
- };
1285
- imports.wbg.__wbg_value_5aec814aeef9e8ec = function(arg0) {
1286
- const ret = getObject(arg0).value;
1287
- return addHeapObject(ret);
1288
- };
1289
- imports.wbg.__wbg_iterator_cd16caebd6db9d85 = function() {
1290
- const ret = Symbol.iterator;
1291
- return addHeapObject(ret);
1292
- };
1293
- imports.wbg.__wbg_get_f6922348004f9279 = function(arg0, arg1) {
1294
- try {
1295
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
1296
- return addHeapObject(ret);
1297
- } catch (e) {
1298
- handleError(e);
1299
- }
1300
- };
1301
- imports.wbg.__wbg_call_836fa928f74337e5 = function(arg0, arg1) {
1302
- try {
1303
- const ret = getObject(arg0).call(getObject(arg1));
1304
- return addHeapObject(ret);
1305
- } catch (e) {
1306
- handleError(e);
1307
- }
1308
- };
1309
- imports.wbg.__wbg_new_b3a6d73da508ceb3 = function() {
1310
- const ret = new Array();
1311
- return addHeapObject(ret);
1312
- };
1313
- imports.wbg.__wbg_forEach_0288520733c2c530 = function(arg0, arg1, arg2) {
1314
- const state0 = {a: arg1, b: arg2};
1315
- const cb0 = (arg0, arg1, arg2) => {
1316
- const a = state0.a;
1317
- state0.a = 0;
1318
- try {
1319
- return __wbg_elem_binding0(a, state0.b, arg0, arg1, arg2);
1320
- } finally {
1321
- state0.a = a;
1322
- }
1323
- };
1324
- try {
1325
- getObject(arg0).forEach(cb0);
1326
- } finally {
1327
- state0.a = state0.b = 0;
1328
- }
1329
- };
1330
- imports.wbg.__wbg_push_7936289c733f57be = function(arg0, arg1) {
1331
- const ret = getObject(arg0).push(getObject(arg1));
1332
- return ret;
1333
- };
1334
- imports.wbg.__wbg_call_3d24f4e03e010931 = function(arg0, arg1, arg2) {
1335
- try {
1336
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1337
- return addHeapObject(ret);
1338
- } catch (e) {
1339
- handleError(e);
1340
- }
1341
- };
1342
- imports.wbg.__wbg_call_d8b88ab221c982cc = function(arg0, arg1, arg2, arg3) {
1343
- try {
1344
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
1345
- return addHeapObject(ret);
1346
- } catch (e) {
1347
- handleError(e);
1348
- }
1349
- };
1350
- imports.wbg.__wbg_call_a0edf5238869d25a = function(arg0, arg1, arg2, arg3, arg4) {
1351
- try {
1352
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3), getObject(arg4));
1353
- return addHeapObject(ret);
1354
- } catch (e) {
1355
- handleError(e);
1356
- }
1357
- };
1358
- imports.wbg.__wbg_new_b276d8d930d44595 = function() {
1359
- const ret = new Object();
1360
- return addHeapObject(ret);
1361
- };
1362
- imports.wbg.__wbg_get_cefed6d76a9a6478 = function(arg0, arg1) {
1363
- try {
1364
- const ret = Reflect.get(getObject(arg0), arg1 >>> 0);
1365
- return addHeapObject(ret);
1366
- } catch (e) {
1367
- handleError(e);
1368
- }
1369
- };
1370
- imports.wbg.__wbg_set_001d7d49c8e6f145 = function(arg0, arg1, arg2) {
1371
- try {
1372
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1373
- return ret;
1374
- } catch (e) {
1375
- handleError(e);
1376
- }
1377
- };
1378
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
1379
- const obj = getObject(arg0);
1380
- if (typeof(obj) === 'number') return obj;
1381
- getUint8Memory()[arg1] = 1;
1382
- const ret = 0;
1383
- return ret;
1384
- };
1385
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
1386
- const ret = debugString(getObject(arg1));
1387
- const ret0 = passStringToWasm(ret);
1388
- const ret1 = WASM_VECTOR_LEN;
1389
- getInt32Memory()[arg0 / 4 + 0] = ret0;
1390
- getInt32Memory()[arg0 / 4 + 1] = ret1;
1391
- };
1392
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
1393
- throw new Error(getStringFromWasm(arg0, arg1));
1394
- };
1395
- imports.wbg.__wbindgen_rethrow = function(arg0) {
1396
- throw takeObject(arg0);
1397
- };
1398
-
1399
- if (module instanceof URL || typeof module === 'string' || module instanceof Request) {
1400
-
1401
- const response = fetch(module);
1402
- if (typeof WebAssembly.instantiateStreaming === 'function') {
1403
- result = WebAssembly.instantiateStreaming(response, imports)
1404
- .catch(e => {
1405
- console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1406
- return response
1407
- .then(r => r.arrayBuffer())
1408
- .then(bytes => WebAssembly.instantiate(bytes, imports));
1409
- });
1410
- } else {
1411
- result = response
1412
- .then(r => r.arrayBuffer())
1413
- .then(bytes => WebAssembly.instantiate(bytes, imports));
1414
- }
1415
- } else {
1416
-
1417
- result = WebAssembly.instantiate(module, imports)
1418
- .then(result => {
1419
- if (result instanceof WebAssembly.Instance) {
1420
- return { instance: result, module };
1421
- } else {
1422
- return result;
1423
- }
1424
- });
1425
- }
1426
- return result.then(({instance, module}) => {
1427
- wasm = instance.exports;
1428
- init.__wbindgen_wasm_module = module;
1429
-
1430
- return wasm;
1431
- });
1432
- }
1433
-
1434
- const privates = new WeakMap();
1435
-
1436
- const p = (self) => privates.get(self);
1437
-
1438
- const checkNode = (graph, u) => {
1439
- if (!p(graph).nodes.has(u)) {
1440
- throw new Error(`Invalid node: ${u}`)
1441
- }
1442
- };
1443
-
1444
- class Graph {
1445
- constructor() {
1446
- privates.set(this, {
1447
- nodes: new Map(),
1448
- numNodes: 0,
1449
- numEdges: 0
1450
- });
1451
- }
1452
-
1453
- node(u) {
1454
- const nodes = p(this).nodes;
1455
- if (nodes.get(u)) {
1456
- return nodes.get(u).data
1457
- }
1458
- return null
1459
- }
1460
-
1461
- edge(u, v) {
1462
- const nodes = p(this).nodes;
1463
- if (nodes.get(u) && nodes.get(u).outNodes.get(v)) {
1464
- return nodes.get(u).outNodes.get(v)
1465
- }
1466
- return null
1467
- }
1468
-
1469
- *nodes() {
1470
- for (const key of p(this).nodes.keys()) {
1471
- yield key;
1472
- }
1473
- }
1474
-
1475
- *edges() {
1476
- for (const u of this.nodes()) {
1477
- for (const v of this.outNodes(u)) {
1478
- yield [u, v];
1479
- }
1480
- }
1481
- }
1482
-
1483
- *outNodes(u) {
1484
- checkNode(this, u);
1485
- for (const key of p(this)
1486
- .nodes.get(u)
1487
- .outNodes.keys()) {
1488
- yield key;
1489
- }
1490
- }
1491
-
1492
- *inNodes(u) {
1493
- checkNode(this, u);
1494
- for (const key of p(this)
1495
- .nodes.get(u)
1496
- .inNodes.keys()) {
1497
- yield key;
1498
- }
1499
- }
1500
-
1501
- *outEdges(u) {
1502
- for (const v of this.outNodes(u)) {
1503
- yield [u, v];
1504
- }
1505
- }
1506
-
1507
- *inEdges(u) {
1508
- for (const v of this.inNodes(u)) {
1509
- yield [v, u];
1510
- }
1511
- }
1512
-
1513
- nodeCount() {
1514
- return p(this).numNodes
1515
- }
1516
-
1517
- edgeCount() {
1518
- return p(this).numEdges
1519
- }
1520
-
1521
- outDegree(u) {
1522
- checkNode(this, u);
1523
- return p(this).nodes.get(u).outNodes.size
1524
- }
1525
-
1526
- inDegree(u) {
1527
- checkNode(this, u);
1528
- return p(this).nodes.get(u).inNodes.size
1529
- }
1530
-
1531
- addNode(u, obj = {}) {
1532
- if (this.node(u)) {
1533
- throw new Error(`Duplicated node: ${u}`)
1534
- }
1535
- p(this).nodes.set(u, {
1536
- outNodes: new Map(),
1537
- inNodes: new Map(),
1538
- data: obj
1539
- });
1540
- p(this).numNodes++;
1541
- return this
1542
- }
1543
-
1544
- addEdge(u, v, obj = {}) {
1545
- checkNode(this, u);
1546
- checkNode(this, v);
1547
- if (this.edge(u, v)) {
1548
- throw new Error(`Duplicated edge: (${u}, ${v})`)
1549
- }
1550
- p(this).numEdges++;
1551
- p(this)
1552
- .nodes.get(u)
1553
- .outNodes.set(v, obj);
1554
- p(this)
1555
- .nodes.get(v)
1556
- .inNodes.set(u, obj);
1557
- return this
1558
- }
1559
-
1560
- removeNode(u) {
1561
- for (const v of this.outNodes(u)) {
1562
- this.removeEdge(u, v);
1563
- }
1564
- for (const v of this.inNodes(u)) {
1565
- this.removeEdge(v, u);
1566
- }
1567
- p(this).nodes.delete(u);
1568
- p(this).numNodes--;
1569
- return this
1570
- }
1571
-
1572
- removeEdge(u, v) {
1573
- if (this.edge(u, v) === null) {
1574
- throw Error(`Invalid edge: (${u}, ${v})`)
1575
- }
1576
- p(this)
1577
- .nodes.get(u)
1578
- .outNodes.delete(v);
1579
- p(this)
1580
- .nodes.get(v)
1581
- .inNodes.delete(u);
1582
- p(this).numEdges--;
1583
- return this
1584
- }
1585
-
1586
- toJSON() {
1587
- return {
1588
- nodes: Array.from(this.nodes()).map((u) =>
1589
- Object.assign(this.node(u), { id: u })
1590
- ),
1591
- links: Array.from(this.edges()).map(([u, v]) =>
1592
- Object.assign(this.edge(u, v), { source: u, target: v })
1593
- )
1594
- }
1595
- }
1596
-
1597
- toString() {
1598
- return JSON.stringify(this.toJSON())
1599
- }
1600
- }
1601
-
1602
- exports.CenterForce = CenterForce;
1603
- exports.CollideForce = CollideForce;
1604
- exports.Force = Force;
1605
- exports.ForceDirectedEdgeBundling = ForceDirectedEdgeBundling;
1606
- exports.ForceDirectedGrouping = ForceDirectedGrouping;
1607
- exports.Graph = Graph;
1608
- exports.GroupCenterForce = GroupCenterForce;
1609
- exports.GroupLinkForce = GroupLinkForce;
1610
- exports.GroupManyBodyForce = GroupManyBodyForce;
1611
- exports.GroupPositionForce = GroupPositionForce;
1612
- exports.LinkForce = LinkForce;
1613
- exports.ManyBodyForce = ManyBodyForce;
1614
- exports.PositionForce = PositionForce;
1615
- exports.QuasiBiclique = QuasiBiclique;
1616
- exports.Simulation = Simulation;
1617
- exports.SimulationBuilder = SimulationBuilder;
1618
- exports.TreemapGrouping = TreemapGrouping;
1619
- exports.aggregateEdges = aggregateEdges;
1620
- exports.aggregateNodes = aggregateNodes;
1621
- exports.connected_components = connected_components;
1622
- exports.init = init;
1623
-
1624
- Object.defineProperty(exports, '__esModule', { value: true });
1625
-
1626
- }));