@hpcc-js/util 2.38.0 → 2.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +73 -72
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/lib-es6/__package__.js +2 -2
- package/lib-es6/array.js +1 -1
- package/lib-es6/array.js.map +1 -1
- package/lib-es6/graph.js +1 -1
- package/lib-es6/graph.js.map +1 -1
- package/lib-es6/graph2.js +24 -24
- package/lib-es6/graph2.js.map +1 -1
- package/lib-es6/logging.js +2 -2
- package/lib-es6/logging.js.map +1 -1
- package/lib-es6/object.js +3 -3
- package/lib-es6/object.js.map +1 -1
- package/lib-es6/url.js +1 -1
- package/lib-es6/url.js.map +1 -1
- package/package.json +18 -17
- package/src/__package__.ts +2 -2
- package/src/graph2.ts +36 -34
- package/types/__package__.d.ts +2 -2
- package/types/graph2.d.ts +29 -28
- package/types/graph2.d.ts.map +1 -1
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/graph2.d.ts +29 -28
package/src/graph2.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { compare2 } from "./array";
|
|
2
2
|
|
|
3
|
+
type ID = string | number;
|
|
4
|
+
|
|
3
5
|
class GraphItem<T = any> {
|
|
4
6
|
protected _graph: Graph2;
|
|
5
7
|
_: T;
|
|
6
|
-
id():
|
|
8
|
+
id(): ID {
|
|
7
9
|
return this._graph.id(this._);
|
|
8
10
|
}
|
|
9
11
|
|
|
@@ -92,7 +94,7 @@ class Vertex<V = any> extends ChildGraphItem<V> {
|
|
|
92
94
|
this._inEdges.push(e);
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
removeInEdge(id:
|
|
97
|
+
removeInEdge(id: ID) {
|
|
96
98
|
this._inEdges = this._inEdges.filter(e => e._.id !== id);
|
|
97
99
|
}
|
|
98
100
|
|
|
@@ -104,7 +106,7 @@ class Vertex<V = any> extends ChildGraphItem<V> {
|
|
|
104
106
|
this._outEdges.push(e);
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
removeOutEdge(id:
|
|
109
|
+
removeOutEdge(id: ID) {
|
|
108
110
|
this._outEdges = this._outEdges.filter(e => e._.id !== id);
|
|
109
111
|
}
|
|
110
112
|
}
|
|
@@ -165,14 +167,14 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
165
167
|
return this;
|
|
166
168
|
}
|
|
167
169
|
|
|
168
|
-
_sourceFunc = (_: any):
|
|
169
|
-
sourceFunc(_: (_: E) =>
|
|
170
|
+
_sourceFunc = (_: any): ID => typeof _.source === "function" ? _.source() : _.source;
|
|
171
|
+
sourceFunc(_: (_: E) => ID): this {
|
|
170
172
|
this._sourceFunc = _;
|
|
171
173
|
return this;
|
|
172
174
|
}
|
|
173
175
|
|
|
174
|
-
_targetFunc = (_: any):
|
|
175
|
-
targetFunc(_: (_: E) =>
|
|
176
|
+
_targetFunc = (_: any): ID => typeof _.target === "function" ? _.target() : _.target;
|
|
177
|
+
targetFunc(_: (_: E) => ID): this {
|
|
176
178
|
this._targetFunc = _;
|
|
177
179
|
return this;
|
|
178
180
|
}
|
|
@@ -187,7 +189,7 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
187
189
|
return this._idFunc(_);
|
|
188
190
|
}
|
|
189
191
|
|
|
190
|
-
type(id:
|
|
192
|
+
type(id: ID): "S" | "V" | "E" | "" {
|
|
191
193
|
if (this.subgraphExists(id)) return "S";
|
|
192
194
|
if (this.vertexExists(id)) return "V";
|
|
193
195
|
if (this.edgeExists(id)) return "E";
|
|
@@ -210,14 +212,14 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
210
212
|
return [...this.allSubgraphs(), ...this.allVertices(), ...this.allEdges()];
|
|
211
213
|
}
|
|
212
214
|
|
|
213
|
-
item(id:
|
|
215
|
+
item(id: ID): S | V | E | undefined {
|
|
214
216
|
if (this.subgraphExists(id)) return this.subgraph(id);
|
|
215
217
|
if (this.vertexExists(id)) return this.vertex(id);
|
|
216
218
|
if (this.edgeExists(id)) return this.edge(id);
|
|
217
219
|
return undefined;
|
|
218
220
|
}
|
|
219
221
|
|
|
220
|
-
itemExists(id:
|
|
222
|
+
itemExists(id: ID): boolean {
|
|
221
223
|
return this.edgeExists(id) || this.vertexExists(id) || this.subgraphExists(id);
|
|
222
224
|
}
|
|
223
225
|
|
|
@@ -240,23 +242,23 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
240
242
|
return retVal;
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
subgraphExists(id:
|
|
245
|
+
subgraphExists(id: ID): boolean {
|
|
244
246
|
return !!this._subgraphMap[id];
|
|
245
247
|
}
|
|
246
248
|
|
|
247
|
-
subgraph(id:
|
|
249
|
+
subgraph(id: ID): S {
|
|
248
250
|
return this._subgraphMap[id]._;
|
|
249
251
|
}
|
|
250
252
|
|
|
251
|
-
subgraphSubgraphs(id:
|
|
253
|
+
subgraphSubgraphs(id: ID): S[] {
|
|
252
254
|
return this._subgraphMap[id].children().filter(child => this.isSubgraph(child._)).map(child => child._);
|
|
253
255
|
}
|
|
254
256
|
|
|
255
|
-
subgraphVertices(id:
|
|
257
|
+
subgraphVertices(id: ID): V[] {
|
|
256
258
|
return this._subgraphMap[id].children().filter(child => this.isVertex(child._)).map(child => child._);
|
|
257
259
|
}
|
|
258
260
|
|
|
259
|
-
subgraphEdges(id:
|
|
261
|
+
subgraphEdges(id: ID): E[] {
|
|
260
262
|
return this._subgraphMap[id].children().filter(child => this.isEdge(child._)).map(child => child._);
|
|
261
263
|
}
|
|
262
264
|
|
|
@@ -289,7 +291,7 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
289
291
|
return this;
|
|
290
292
|
}
|
|
291
293
|
|
|
292
|
-
removeSubgraph(id:
|
|
294
|
+
removeSubgraph(id: ID, promoteChildren = true): this {
|
|
293
295
|
const sg = this._subgraphMap[id];
|
|
294
296
|
if (!sg) throw new Error(`Subgraph '${id}' does not exist.`);
|
|
295
297
|
sg.children().forEach(child => {
|
|
@@ -307,9 +309,9 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
307
309
|
return this;
|
|
308
310
|
}
|
|
309
311
|
|
|
310
|
-
subgraphParent(id:
|
|
311
|
-
subgraphParent(id:
|
|
312
|
-
subgraphParent(id:
|
|
312
|
+
subgraphParent(id: ID): S | undefined;
|
|
313
|
+
subgraphParent(id: ID, parentID: ID): this;
|
|
314
|
+
subgraphParent(id: ID, parentID?: ID): S | undefined | this {
|
|
313
315
|
const item = this._subgraphMap[id];
|
|
314
316
|
if (!item) throw new Error(`Subgraph '${id}' does not exist.`);
|
|
315
317
|
if (parentID === void 0) {
|
|
@@ -341,11 +343,11 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
341
343
|
return retVal;
|
|
342
344
|
}
|
|
343
345
|
|
|
344
|
-
vertexExists(id:
|
|
346
|
+
vertexExists(id: ID): boolean {
|
|
345
347
|
return !!this._vertexMap[id];
|
|
346
348
|
}
|
|
347
349
|
|
|
348
|
-
vertex(id:
|
|
350
|
+
vertex(id: ID): V {
|
|
349
351
|
return this._vertexMap[id]._;
|
|
350
352
|
}
|
|
351
353
|
|
|
@@ -379,15 +381,15 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
379
381
|
return this._vertexMap[vertexID].outEdges().map(e => e._);
|
|
380
382
|
}
|
|
381
383
|
|
|
382
|
-
private _neighbors(id:
|
|
384
|
+
private _neighbors(id: ID): Vertex[] {
|
|
383
385
|
return [...this._vertexMap[id].outEdges().map(e => e._target), ...this._vertexMap[id].inEdges().map(e => e._source)];
|
|
384
386
|
}
|
|
385
387
|
|
|
386
|
-
neighbors(id:
|
|
388
|
+
neighbors(id: ID): V[] {
|
|
387
389
|
return this._neighbors(id).map(n => n._);
|
|
388
390
|
}
|
|
389
391
|
|
|
390
|
-
singleNeighbors(id:
|
|
392
|
+
singleNeighbors(id: ID): V[] {
|
|
391
393
|
return this._neighbors(id).filter(n => n.edgeCount() === 1).map(n => n._);
|
|
392
394
|
}
|
|
393
395
|
|
|
@@ -420,7 +422,7 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
420
422
|
return this;
|
|
421
423
|
}
|
|
422
424
|
|
|
423
|
-
removeVertex(id:
|
|
425
|
+
removeVertex(id: ID): this {
|
|
424
426
|
const v = this._vertexMap[id];
|
|
425
427
|
if (!v) throw new Error(`Vertex '${id}' does not exist.`);
|
|
426
428
|
v.edges().forEach(e => {
|
|
@@ -430,9 +432,9 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
430
432
|
return this;
|
|
431
433
|
}
|
|
432
434
|
|
|
433
|
-
vertexParent(id:
|
|
434
|
-
vertexParent(id:
|
|
435
|
-
vertexParent(id:
|
|
435
|
+
vertexParent(id: ID): S | undefined;
|
|
436
|
+
vertexParent(id: ID, parentID: ID): this;
|
|
437
|
+
vertexParent(id: ID, parentID?: ID): S | undefined | this {
|
|
436
438
|
const item = this._vertexMap[id];
|
|
437
439
|
if (!item) throw new Error(`Vertex '${id}' does not exist.`);
|
|
438
440
|
if (parentID === void 0) {
|
|
@@ -446,11 +448,11 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
446
448
|
}
|
|
447
449
|
|
|
448
450
|
// Edges ---
|
|
449
|
-
edgeExists(id:
|
|
451
|
+
edgeExists(id: ID): boolean {
|
|
450
452
|
return !!this._edgeMap[id];
|
|
451
453
|
}
|
|
452
454
|
|
|
453
|
-
edge(id:
|
|
455
|
+
edge(id: ID): E {
|
|
454
456
|
return this._edgeMap[id]._;
|
|
455
457
|
}
|
|
456
458
|
|
|
@@ -489,7 +491,7 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
489
491
|
return this;
|
|
490
492
|
}
|
|
491
493
|
|
|
492
|
-
removeEdge(id:
|
|
494
|
+
removeEdge(id: ID): this {
|
|
493
495
|
const e: Edge<E> = this._edgeMap[id];
|
|
494
496
|
if (!e) throw new Error(`Edge '${id}' does not exist.`);
|
|
495
497
|
|
|
@@ -532,14 +534,14 @@ export class Graph2<V = any, E = any, S = any> {
|
|
|
532
534
|
|
|
533
535
|
dijkstra(source: string, target: string): { ids: string[], len: number } {
|
|
534
536
|
const edges = this.allEdges();
|
|
535
|
-
const Q = new Set<string>();
|
|
537
|
+
const Q = new Set<string | number>();
|
|
536
538
|
const prev: { [key: string]: string } = {};
|
|
537
539
|
const dist: { [key: string]: number } = {};
|
|
538
540
|
const adj: { [key: string]: { [key: string]: number } } = {};
|
|
539
541
|
|
|
540
|
-
function vertex_with_min_dist(Q: Set<string>, dist: { [key: string]: number }) {
|
|
542
|
+
function vertex_with_min_dist(Q: Set<string | number>, dist: { [key: string]: number }) {
|
|
541
543
|
let min_distance = Infinity;
|
|
542
|
-
let u: string | null = null;
|
|
544
|
+
let u: string | number | null = null;
|
|
543
545
|
|
|
544
546
|
Q.forEach(v => {
|
|
545
547
|
if (dist[v] < min_distance) {
|
package/types/__package__.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const PKG_NAME = "@hpcc-js/util";
|
|
2
|
-
export declare const PKG_VERSION = "2.
|
|
3
|
-
export declare const BUILD_VERSION = "2.
|
|
2
|
+
export declare const PKG_VERSION = "2.42.0";
|
|
3
|
+
export declare const BUILD_VERSION = "2.97.0";
|
|
4
4
|
//# sourceMappingURL=__package__.d.ts.map
|
package/types/graph2.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
declare type ID = string | number;
|
|
1
2
|
declare class GraphItem<T = any> {
|
|
2
3
|
protected _graph: Graph2;
|
|
3
4
|
_: T;
|
|
4
|
-
id():
|
|
5
|
+
id(): ID;
|
|
5
6
|
constructor(g: Graph2, _: T);
|
|
6
7
|
}
|
|
7
8
|
declare class ChildGraphItem<S = any> extends GraphItem<S> {
|
|
@@ -26,10 +27,10 @@ declare class Vertex<V = any> extends ChildGraphItem<V> {
|
|
|
26
27
|
edgeCount(): number;
|
|
27
28
|
inEdges(): Edge<any>[];
|
|
28
29
|
addInEdge(e: Edge): void;
|
|
29
|
-
removeInEdge(id:
|
|
30
|
+
removeInEdge(id: ID): void;
|
|
30
31
|
outEdges(): Edge<any>[];
|
|
31
32
|
addOutEdge(e: Edge): void;
|
|
32
|
-
removeOutEdge(id:
|
|
33
|
+
removeOutEdge(id: ID): void;
|
|
33
34
|
}
|
|
34
35
|
declare class Edge<E = any> extends ChildGraphItem<E> {
|
|
35
36
|
_source: Vertex;
|
|
@@ -48,57 +49,57 @@ export declare class Graph2<V = any, E = any, S = any> {
|
|
|
48
49
|
isDirected(): boolean;
|
|
49
50
|
_idFunc: (_: any) => string;
|
|
50
51
|
idFunc(_: (_: S | V | E) => string): this;
|
|
51
|
-
_sourceFunc: (_: any) =>
|
|
52
|
-
sourceFunc(_: (_: E) =>
|
|
53
|
-
_targetFunc: (_: any) =>
|
|
54
|
-
targetFunc(_: (_: E) =>
|
|
52
|
+
_sourceFunc: (_: any) => ID;
|
|
53
|
+
sourceFunc(_: (_: E) => ID): this;
|
|
54
|
+
_targetFunc: (_: any) => ID;
|
|
55
|
+
targetFunc(_: (_: E) => ID): this;
|
|
55
56
|
_updateFunc: (before: S | V | E, after: S | V | E) => S | V | E;
|
|
56
57
|
updateFunc(_: (before: S | V | E, after: S | V | E) => S | V | E): this;
|
|
57
58
|
id(_: S | V | E): string;
|
|
58
|
-
type(id:
|
|
59
|
+
type(id: ID): "S" | "V" | "E" | "";
|
|
59
60
|
isSubgraph(_: S | V | E): _ is S;
|
|
60
61
|
isVertex(_: S | V | E): _ is V;
|
|
61
62
|
isEdge(_: S | V | E): _ is E;
|
|
62
63
|
allItems(): Array<S | V | E>;
|
|
63
|
-
item(id:
|
|
64
|
-
itemExists(id:
|
|
64
|
+
item(id: ID): S | V | E | undefined;
|
|
65
|
+
itemExists(id: ID): boolean;
|
|
65
66
|
allSubgraphs(): S[];
|
|
66
67
|
subgraphs(): S[];
|
|
67
|
-
subgraphExists(id:
|
|
68
|
-
subgraph(id:
|
|
69
|
-
subgraphSubgraphs(id:
|
|
70
|
-
subgraphVertices(id:
|
|
71
|
-
subgraphEdges(id:
|
|
68
|
+
subgraphExists(id: ID): boolean;
|
|
69
|
+
subgraph(id: ID): S;
|
|
70
|
+
subgraphSubgraphs(id: ID): S[];
|
|
71
|
+
subgraphVertices(id: ID): V[];
|
|
72
|
+
subgraphEdges(id: ID): E[];
|
|
72
73
|
addSubgraph(s: S, parent?: S): this;
|
|
73
74
|
mergeSubgraphs(_subgraphs?: S[]): this;
|
|
74
75
|
updateSubgraph(sg: S): this;
|
|
75
|
-
removeSubgraph(id:
|
|
76
|
-
subgraphParent(id:
|
|
77
|
-
subgraphParent(id:
|
|
76
|
+
removeSubgraph(id: ID, promoteChildren?: boolean): this;
|
|
77
|
+
subgraphParent(id: ID): S | undefined;
|
|
78
|
+
subgraphParent(id: ID, parentID: ID): this;
|
|
78
79
|
allVertices(): V[];
|
|
79
80
|
vertices(): V[];
|
|
80
|
-
vertexExists(id:
|
|
81
|
-
vertex(id:
|
|
81
|
+
vertexExists(id: ID): boolean;
|
|
82
|
+
vertex(id: ID): V;
|
|
82
83
|
allEdges(): E[];
|
|
83
84
|
edges(): E[];
|
|
84
85
|
vertexEdges(vertexID: string): E[];
|
|
85
86
|
inEdges(vertexID: string): E[];
|
|
86
87
|
outEdges(vertexID: string): E[];
|
|
87
88
|
private _neighbors;
|
|
88
|
-
neighbors(id:
|
|
89
|
-
singleNeighbors(id:
|
|
89
|
+
neighbors(id: ID): V[];
|
|
90
|
+
singleNeighbors(id: ID): V[];
|
|
90
91
|
addVertex(v: V, parent?: S): this;
|
|
91
92
|
mergeVertices(_vertices: V[]): this;
|
|
92
93
|
updateVertex(v: V): this;
|
|
93
|
-
removeVertex(id:
|
|
94
|
-
vertexParent(id:
|
|
95
|
-
vertexParent(id:
|
|
96
|
-
edgeExists(id:
|
|
97
|
-
edge(id:
|
|
94
|
+
removeVertex(id: ID): this;
|
|
95
|
+
vertexParent(id: ID): S | undefined;
|
|
96
|
+
vertexParent(id: ID, parentID: ID): this;
|
|
97
|
+
edgeExists(id: ID): boolean;
|
|
98
|
+
edge(id: ID): E;
|
|
98
99
|
addEdge(e: E, parent?: S): this;
|
|
99
100
|
mergeEdges(_edges: E[]): this;
|
|
100
101
|
updateEdge(e: E): this;
|
|
101
|
-
removeEdge(id:
|
|
102
|
+
removeEdge(id: ID): this;
|
|
102
103
|
protected _hwalk(item: Subgraph<S> | Vertex<V>, formatter: HierarchyFormatter<V, S>): object;
|
|
103
104
|
hierarchy(formatter: HierarchyFormatter<V, S>): object[];
|
|
104
105
|
dijkstra(source: string, target: string): {
|
package/types/graph2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph2.d.ts","sourceRoot":"","sources":["../src/graph2.ts"],"names":[],"mappings":"AAEA,cAAM,SAAS,CAAC,CAAC,GAAG,GAAG;IACnB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,CAAC,EAAE,CAAC,CAAC;IACL,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"graph2.d.ts","sourceRoot":"","sources":["../src/graph2.ts"],"names":[],"mappings":"AAEA,aAAK,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1B,cAAM,SAAS,CAAC,CAAC,GAAG,GAAG;IACnB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,CAAC,EAAE,CAAC,CAAC;IACL,EAAE,IAAI,EAAE;gBAII,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;CAI9B;AAED,cAAM,cAAc,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAE9C,OAAO,CAAC,OAAO,CAAuB;gBAE1B,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAI3B,WAAW,IAAI,IAAI;IAQnB,MAAM,IAAI,QAAQ,GAAG,SAAS;IAC9B,MAAM,CAAC,CAAC,EAAE,QAAQ,GAAG,SAAS,GAA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C,CAAC,GAAG,MAAM,EAAE;IAiBxD,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAsExE,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE;CA2B3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const PKG_NAME = "@hpcc-js/util";
|
|
2
|
-
export declare const PKG_VERSION = "2.
|
|
3
|
-
export declare const BUILD_VERSION = "2.
|
|
2
|
+
export declare const PKG_VERSION = "2.42.0";
|
|
3
|
+
export declare const BUILD_VERSION = "2.97.0";
|
|
4
4
|
//# sourceMappingURL=__package__.d.ts.map
|
package/types-3.4/graph2.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
declare type ID = string | number;
|
|
1
2
|
declare class GraphItem<T = any> {
|
|
2
3
|
protected _graph: Graph2;
|
|
3
4
|
_: T;
|
|
4
|
-
id():
|
|
5
|
+
id(): ID;
|
|
5
6
|
constructor(g: Graph2, _: T);
|
|
6
7
|
}
|
|
7
8
|
declare class ChildGraphItem<S = any> extends GraphItem<S> {
|
|
@@ -26,10 +27,10 @@ declare class Vertex<V = any> extends ChildGraphItem<V> {
|
|
|
26
27
|
edgeCount(): number;
|
|
27
28
|
inEdges(): Edge<any>[];
|
|
28
29
|
addInEdge(e: Edge): void;
|
|
29
|
-
removeInEdge(id:
|
|
30
|
+
removeInEdge(id: ID): void;
|
|
30
31
|
outEdges(): Edge<any>[];
|
|
31
32
|
addOutEdge(e: Edge): void;
|
|
32
|
-
removeOutEdge(id:
|
|
33
|
+
removeOutEdge(id: ID): void;
|
|
33
34
|
}
|
|
34
35
|
declare class Edge<E = any> extends ChildGraphItem<E> {
|
|
35
36
|
_source: Vertex;
|
|
@@ -48,57 +49,57 @@ export declare class Graph2<V = any, E = any, S = any> {
|
|
|
48
49
|
isDirected(): boolean;
|
|
49
50
|
_idFunc: (_: any) => string;
|
|
50
51
|
idFunc(_: (_: S | V | E) => string): this;
|
|
51
|
-
_sourceFunc: (_: any) =>
|
|
52
|
-
sourceFunc(_: (_: E) =>
|
|
53
|
-
_targetFunc: (_: any) =>
|
|
54
|
-
targetFunc(_: (_: E) =>
|
|
52
|
+
_sourceFunc: (_: any) => ID;
|
|
53
|
+
sourceFunc(_: (_: E) => ID): this;
|
|
54
|
+
_targetFunc: (_: any) => ID;
|
|
55
|
+
targetFunc(_: (_: E) => ID): this;
|
|
55
56
|
_updateFunc: (before: S | V | E, after: S | V | E) => S | V | E;
|
|
56
57
|
updateFunc(_: (before: S | V | E, after: S | V | E) => S | V | E): this;
|
|
57
58
|
id(_: S | V | E): string;
|
|
58
|
-
type(id:
|
|
59
|
+
type(id: ID): "S" | "V" | "E" | "";
|
|
59
60
|
isSubgraph(_: S | V | E): _ is S;
|
|
60
61
|
isVertex(_: S | V | E): _ is V;
|
|
61
62
|
isEdge(_: S | V | E): _ is E;
|
|
62
63
|
allItems(): Array<S | V | E>;
|
|
63
|
-
item(id:
|
|
64
|
-
itemExists(id:
|
|
64
|
+
item(id: ID): S | V | E | undefined;
|
|
65
|
+
itemExists(id: ID): boolean;
|
|
65
66
|
allSubgraphs(): S[];
|
|
66
67
|
subgraphs(): S[];
|
|
67
|
-
subgraphExists(id:
|
|
68
|
-
subgraph(id:
|
|
69
|
-
subgraphSubgraphs(id:
|
|
70
|
-
subgraphVertices(id:
|
|
71
|
-
subgraphEdges(id:
|
|
68
|
+
subgraphExists(id: ID): boolean;
|
|
69
|
+
subgraph(id: ID): S;
|
|
70
|
+
subgraphSubgraphs(id: ID): S[];
|
|
71
|
+
subgraphVertices(id: ID): V[];
|
|
72
|
+
subgraphEdges(id: ID): E[];
|
|
72
73
|
addSubgraph(s: S, parent?: S): this;
|
|
73
74
|
mergeSubgraphs(_subgraphs?: S[]): this;
|
|
74
75
|
updateSubgraph(sg: S): this;
|
|
75
|
-
removeSubgraph(id:
|
|
76
|
-
subgraphParent(id:
|
|
77
|
-
subgraphParent(id:
|
|
76
|
+
removeSubgraph(id: ID, promoteChildren?: boolean): this;
|
|
77
|
+
subgraphParent(id: ID): S | undefined;
|
|
78
|
+
subgraphParent(id: ID, parentID: ID): this;
|
|
78
79
|
allVertices(): V[];
|
|
79
80
|
vertices(): V[];
|
|
80
|
-
vertexExists(id:
|
|
81
|
-
vertex(id:
|
|
81
|
+
vertexExists(id: ID): boolean;
|
|
82
|
+
vertex(id: ID): V;
|
|
82
83
|
allEdges(): E[];
|
|
83
84
|
edges(): E[];
|
|
84
85
|
vertexEdges(vertexID: string): E[];
|
|
85
86
|
inEdges(vertexID: string): E[];
|
|
86
87
|
outEdges(vertexID: string): E[];
|
|
87
88
|
private _neighbors;
|
|
88
|
-
neighbors(id:
|
|
89
|
-
singleNeighbors(id:
|
|
89
|
+
neighbors(id: ID): V[];
|
|
90
|
+
singleNeighbors(id: ID): V[];
|
|
90
91
|
addVertex(v: V, parent?: S): this;
|
|
91
92
|
mergeVertices(_vertices: V[]): this;
|
|
92
93
|
updateVertex(v: V): this;
|
|
93
|
-
removeVertex(id:
|
|
94
|
-
vertexParent(id:
|
|
95
|
-
vertexParent(id:
|
|
96
|
-
edgeExists(id:
|
|
97
|
-
edge(id:
|
|
94
|
+
removeVertex(id: ID): this;
|
|
95
|
+
vertexParent(id: ID): S | undefined;
|
|
96
|
+
vertexParent(id: ID, parentID: ID): this;
|
|
97
|
+
edgeExists(id: ID): boolean;
|
|
98
|
+
edge(id: ID): E;
|
|
98
99
|
addEdge(e: E, parent?: S): this;
|
|
99
100
|
mergeEdges(_edges: E[]): this;
|
|
100
101
|
updateEdge(e: E): this;
|
|
101
|
-
removeEdge(id:
|
|
102
|
+
removeEdge(id: ID): this;
|
|
102
103
|
protected _hwalk(item: Subgraph<S> | Vertex<V>, formatter: HierarchyFormatter<V, S>): object;
|
|
103
104
|
hierarchy(formatter: HierarchyFormatter<V, S>): object[];
|
|
104
105
|
dijkstra(source: string, target: string): {
|