egraph 5.0.0 → 6.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,63 +2,137 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  * @param {Graph} graph
5
+ * @param {Function} groups
6
+ * @param {Function} shrink_node
7
+ * @param {Function} shrink_edge
5
8
  * @returns {any}
6
9
  */
7
- export function initialPlacement(graph: Graph): any;
10
+ export function coarsen(graph: Graph, groups: Function, shrink_node: Function, shrink_edge: Function): any;
8
11
  /**
9
12
  * @param {Graph} graph
10
- * @returns {Array<any>}
11
- */
12
- export function forceConnected(graph: Graph): Array<any>;
13
- /**
14
- * @param {Graph} graph
15
- * @returns {Array<any>}
13
+ * @param {any} coordinates
14
+ * @returns {any}
16
15
  */
17
- export function forceNonconnected(graph: Graph): Array<any>;
16
+ export function fdeb(graph: Graph, coordinates: any): any;
18
17
  /**
19
18
  * @param {Graph} graph
20
- * @param {Function} group_accessor
21
- * @returns {Array<any>}
19
+ * @param {number} min_size
20
+ * @param {number} step_iteration
21
+ * @param {Function} _shrink_node
22
+ * @param {Function} _shrink_edge
23
+ * @param {Function} _link_distance_accessor
24
+ * @returns {Coordinates}
22
25
  */
23
- export function forceGrouped(graph: Graph, group_accessor: Function): Array<any>;
26
+ export function fm3(graph: Graph, min_size: number, step_iteration: number, _shrink_node: Function, _shrink_edge: Function, _link_distance_accessor: Function): Coordinates;
24
27
  /**
25
28
  * @param {Graph} graph
26
- * @param {any} coordinates
29
+ * @param {Coordinates} coordinates
27
30
  * @param {Function} _length
28
31
  * @param {number} eps
29
32
  * @param {number} width
30
33
  * @param {number} height
31
34
  * @returns {any}
32
35
  */
33
- export function kamadaKawai(graph: Graph, coordinates: any, _length: Function, eps: number, width: number, height: number): any;
36
+ export function kamadaKawai(graph: Graph, coordinates: Coordinates, _length: Function, eps: number, width: number, height: number): any;
34
37
  /**
35
- * @param {Graph} graph
36
- * @param {number} min_size
37
- * @param {number} step_iteration
38
- * @param {Function} _shrink_node
39
- * @param {Function} _shrink_edge
40
- * @param {Function} _link_distance_accessor
41
- * @returns {any}
42
38
  */
43
- export function fm3(graph: Graph, min_size: number, step_iteration: number, _shrink_node: Function, _shrink_edge: Function, _link_distance_accessor: Function): any;
39
+ export class CollideForce {
40
+ free(): void;
44
41
  /**
45
42
  * @param {Graph} graph
46
- * @param {any} coordinates
47
- * @returns {any}
43
+ * @param {Function} f
44
+ * @param {any} options
48
45
  */
49
- export function fdeb(graph: Graph, coordinates: any): any;
46
+ constructor(graph: Graph, f: Function, options: any);
47
+ /**
48
+ * @param {Coordinates} context
49
+ * @param {number} alpha
50
+ */
51
+ apply(context: Coordinates, alpha: number): void;
52
+ }
50
53
  /**
51
54
  */
52
- export class CenterForce {
55
+ export class Coordinates {
53
56
  free(): void;
54
57
  /**
58
+ * @param {number} u
59
+ * @returns {number | undefined}
55
60
  */
56
- constructor();
61
+ x(u: number): number | undefined;
62
+ /**
63
+ * @param {number} u
64
+ * @returns {number | undefined}
65
+ */
66
+ y(u: number): number | undefined;
67
+ /**
68
+ * @param {number} u
69
+ * @param {number} x
70
+ */
71
+ setX(u: number, x: number): void;
72
+ /**
73
+ * @param {number} u
74
+ * @param {number} y
75
+ */
76
+ setY(u: number, y: number): void;
77
+ /**
78
+ * @param {number} u
79
+ * @returns {number | undefined}
80
+ */
81
+ vx(u: number): number | undefined;
82
+ /**
83
+ * @param {number} u
84
+ * @returns {number | undefined}
85
+ */
86
+ vy(u: number): number | undefined;
87
+ /**
88
+ * @returns {number}
89
+ */
90
+ len(): number;
91
+ /**
92
+ * @returns {any}
93
+ */
94
+ toJSON(): any;
95
+ /**
96
+ */
97
+ centralize(): void;
98
+ /**
99
+ * @param {number} velocity_decay
100
+ */
101
+ updatePosition(velocity_decay: number): void;
102
+ /**
103
+ * @param {number} x0
104
+ * @param {number} y0
105
+ * @param {number} x1
106
+ * @param {number} y1
107
+ */
108
+ clampRegion(x0: number, y0: number, x1: number, y1: number): void;
109
+ /**
110
+ * @param {Graph} graph
111
+ * @returns {Coordinates}
112
+ */
113
+ static initialPlacement(graph: Graph): Coordinates;
57
114
  }
58
115
  /**
59
116
  */
60
- export class Force {
117
+ export class FruchtermanReingoldForce {
61
118
  free(): void;
119
+ /**
120
+ * @param {Graph} graph
121
+ * @param {number} k
122
+ * @param {number} min_distance
123
+ */
124
+ constructor(graph: Graph, k: number, min_distance: number);
125
+ /**
126
+ * @param {Coordinates} coordinates
127
+ * @param {number} alpha
128
+ */
129
+ apply(coordinates: Coordinates, alpha: number): void;
130
+ /**
131
+ * @param {number} u
132
+ * @param {Coordinates} coordinates
133
+ * @param {number} alpha
134
+ */
135
+ applyToNode(u: number, coordinates: Coordinates, alpha: number): void;
62
136
  }
63
137
  /**
64
138
  */
@@ -158,6 +232,120 @@ export class Graph {
158
232
  * @returns {Array<any>}
159
233
  */
160
234
  edgeIndices(): Array<any>;
235
+ /**
236
+ * @param {Function} node_map
237
+ * @param {Function} edge_map
238
+ * @returns {Graph}
239
+ */
240
+ map(node_map: Function, edge_map: Function): Graph;
241
+ /**
242
+ * @param {Function} node_map
243
+ * @param {Function} edge_map
244
+ * @returns {Graph}
245
+ */
246
+ filterMap(node_map: Function, edge_map: Function): Graph;
247
+ }
248
+ /**
249
+ */
250
+ export class GroupLinkForce {
251
+ free(): void;
252
+ /**
253
+ * @param {Graph} graph
254
+ * @param {Function} group_accessor
255
+ * @param {Function} inter_link_accessor
256
+ * @param {Function} intra_link_accessor
257
+ */
258
+ constructor(graph: Graph, group_accessor: Function, inter_link_accessor: Function, intra_link_accessor: Function);
259
+ /**
260
+ * @param {Coordinates} coordinates
261
+ * @param {number} alpha
262
+ */
263
+ apply(coordinates: Coordinates, alpha: number): void;
264
+ }
265
+ /**
266
+ */
267
+ export class GroupManyBodyForce {
268
+ free(): void;
269
+ /**
270
+ * @param {Graph} graph
271
+ * @param {Function} node_accessor
272
+ */
273
+ constructor(graph: Graph, node_accessor: Function);
274
+ /**
275
+ * @param {Coordinates} coordinates
276
+ * @param {number} alpha
277
+ */
278
+ apply(coordinates: Coordinates, alpha: number): void;
279
+ }
280
+ /**
281
+ */
282
+ export class GroupPositionForce {
283
+ free(): void;
284
+ /**
285
+ * @param {Graph} graph
286
+ * @param {Function} node_accessor
287
+ * @param {Function} group_accessor
288
+ */
289
+ constructor(graph: Graph, node_accessor: Function, group_accessor: Function);
290
+ /**
291
+ * @param {Coordinates} coordinates
292
+ * @param {number} alpha
293
+ */
294
+ apply(coordinates: Coordinates, alpha: number): void;
295
+ }
296
+ /**
297
+ */
298
+ export class HyperbolicSpace {
299
+ free(): void;
300
+ /**
301
+ * @param {any} a
302
+ * @param {any} b
303
+ * @returns {any}
304
+ */
305
+ static toTangentSpace(a: any, b: any): any;
306
+ /**
307
+ * @param {any} a
308
+ * @param {any} b
309
+ * @returns {any}
310
+ */
311
+ static fromTangentSpace(a: any, b: any): any;
312
+ /**
313
+ * @param {number} i
314
+ * @param {Coordinates} riemann_space
315
+ * @param {Coordinates} tangent_space
316
+ */
317
+ static mapToTangentSpace(i: number, riemann_space: Coordinates, tangent_space: Coordinates): void;
318
+ /**
319
+ * @param {number} i
320
+ * @param {Coordinates} riemann_space
321
+ * @param {Coordinates} tangent_space
322
+ * @param {number} velocity_decay
323
+ */
324
+ static updatePosition(i: number, riemann_space: Coordinates, tangent_space: Coordinates, velocity_decay: number): void;
325
+ }
326
+ /**
327
+ */
328
+ export class KamadaKawai {
329
+ free(): void;
330
+ /**
331
+ * @param {Graph} graph
332
+ * @param {Function} f
333
+ */
334
+ constructor(graph: Graph, f: Function);
335
+ /**
336
+ * @param {Coordinates} coordinates
337
+ * @returns {number | undefined}
338
+ */
339
+ selectNode(coordinates: Coordinates): number | undefined;
340
+ /**
341
+ * @param {number} m
342
+ * @param {Coordinates} coordinates
343
+ */
344
+ applyToNode(m: number, coordinates: Coordinates): void;
345
+ /**
346
+ * @param {Coordinates} coordinates
347
+ */
348
+ run(coordinates: Coordinates): void;
161
349
  }
162
350
  /**
163
351
  */
@@ -165,8 +353,20 @@ export class LinkForce {
165
353
  free(): void;
166
354
  /**
167
355
  * @param {Graph} graph
356
+ * @param {Function} f
357
+ */
358
+ constructor(graph: Graph, f: Function);
359
+ /**
360
+ * @param {Coordinates} coordinates
361
+ * @param {number} alpha
362
+ */
363
+ apply(coordinates: Coordinates, alpha: number): void;
364
+ /**
365
+ * @param {number} u
366
+ * @param {Coordinates} coordinates
367
+ * @param {number} alpha
168
368
  */
169
- constructor(graph: Graph);
369
+ applyToNode(u: number, coordinates: Coordinates, alpha: number): void;
170
370
  }
171
371
  /**
172
372
  */
@@ -174,12 +374,24 @@ export class ManyBodyForce {
174
374
  free(): void;
175
375
  /**
176
376
  * @param {Graph} graph
377
+ * @param {Function} f
378
+ */
379
+ constructor(graph: Graph, f: Function);
380
+ /**
381
+ * @param {Coordinates} coordinates
382
+ * @param {number} alpha
383
+ */
384
+ apply(coordinates: Coordinates, alpha: number): void;
385
+ /**
386
+ * @param {number} u
387
+ * @param {Coordinates} coordinates
388
+ * @param {number} alpha
177
389
  */
178
- constructor(graph: Graph);
390
+ applyToNode(u: number, coordinates: Coordinates, alpha: number): void;
179
391
  }
180
392
  /**
181
393
  */
182
- export class Simulation {
394
+ export class PositionForce {
183
395
  free(): void;
184
396
  /**
185
397
  * @param {Graph} graph
@@ -187,16 +399,54 @@ export class Simulation {
187
399
  */
188
400
  constructor(graph: Graph, f: Function);
189
401
  /**
190
- * @param {any[]} js_forces
191
- * @returns {any}
402
+ * @param {Coordinates} coordinates
403
+ * @param {number} alpha
404
+ */
405
+ apply(coordinates: Coordinates, alpha: number): void;
406
+ /**
407
+ * @param {number} u
408
+ * @param {Coordinates} coordinates
409
+ * @param {number} alpha
410
+ */
411
+ applyToNode(u: number, coordinates: Coordinates, alpha: number): void;
412
+ }
413
+ /**
414
+ */
415
+ export class RadialForce {
416
+ free(): void;
417
+ /**
418
+ * @param {Graph} graph
419
+ * @param {Function} f
420
+ */
421
+ constructor(graph: Graph, f: Function);
422
+ /**
423
+ * @param {Coordinates} coordinates
424
+ * @param {number} alpha
425
+ */
426
+ apply(coordinates: Coordinates, alpha: number): void;
427
+ /**
428
+ * @param {number} u
429
+ * @param {Coordinates} coordinates
430
+ * @param {number} alpha
431
+ */
432
+ applyToNode(u: number, coordinates: Coordinates, alpha: number): void;
433
+ }
434
+ /**
435
+ */
436
+ export class Simulation {
437
+ free(): void;
438
+ /**
192
439
  */
193
- run(js_forces: any[]): any;
440
+ constructor();
441
+ /**
442
+ * @param {Function} f
443
+ */
444
+ run(f: Function): void;
194
445
  /**
195
446
  * @param {number} n
196
- * @param {any[]} js_forces
197
- * @returns {any}
447
+ * @param {Function} f
198
448
  */
199
- runStep(n: number, js_forces: any[]): any;
449
+ runStep(n: number, f: Function): void;
200
450
  /**
201
451
  * @returns {boolean}
202
452
  */
@@ -221,8 +471,54 @@ export class Simulation {
221
471
  * @returns {number}
222
472
  */
223
473
  iterations: number;
474
+ }
475
+ /**
476
+ */
477
+ export class SphericalSpace {
478
+ free(): void;
479
+ /**
480
+ * @param {any} a
481
+ * @param {any} b
482
+ * @returns {any}
483
+ */
484
+ static toTangentSpace(a: any, b: any): any;
485
+ /**
486
+ * @param {any} a
487
+ * @param {any} b
488
+ * @returns {any}
489
+ */
490
+ static fromTangentSpace(a: any, b: any): any;
491
+ /**
492
+ * @param {number} i
493
+ * @param {Coordinates} riemann_space
494
+ * @param {Coordinates} tangent_space
495
+ */
496
+ static mapToTangentSpace(i: number, riemann_space: Coordinates, tangent_space: Coordinates): void;
224
497
  /**
498
+ * @param {number} i
499
+ * @param {Coordinates} riemann_space
500
+ * @param {Coordinates} tangent_space
501
+ * @param {number} velocity_decay
502
+ */
503
+ static updatePosition(i: number, riemann_space: Coordinates, tangent_space: Coordinates, velocity_decay: number): void;
504
+ }
505
+ /**
506
+ */
507
+ export class StressMajorization {
508
+ free(): void;
509
+ /**
510
+ * @param {Graph} graph
511
+ * @param {Coordinates} coordinates
512
+ * @param {Function} f
513
+ */
514
+ constructor(graph: Graph, coordinates: Coordinates, f: Function);
515
+ /**
516
+ * @param {Coordinates} coordinates
225
517
  * @returns {number}
226
518
  */
227
- velocityDecay: number;
519
+ apply(coordinates: Coordinates): number;
520
+ /**
521
+ * @param {Coordinates} coordinates
522
+ */
523
+ run(coordinates: Coordinates): void;
228
524
  }
Binary file