@statelyai/graph 0.9.0 → 0.11.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/{algorithms-3xvCxHzo.mjs → algorithms-BHHg7lGq.mjs} +1448 -1988
- package/dist/algorithms-BlM-qoJb.d.mts +178 -0
- package/dist/algorithms.d.mts +1 -1
- package/dist/algorithms.mjs +1 -1
- package/dist/{converter-B5CUD0r9.mjs → converter-Dspillnn.mjs} +2 -2
- package/dist/format-support.d.mts +22 -0
- package/dist/format-support.mjs +294 -0
- package/dist/formats/adjacency-list/index.d.mts +1 -1
- package/dist/formats/adjacency-list/index.mjs +1 -1
- package/dist/formats/converter/index.d.mts +1 -1
- package/dist/formats/converter/index.mjs +1 -1
- package/dist/formats/cytoscape/index.d.mts +1 -1
- package/dist/formats/cytoscape/index.mjs +1 -1
- package/dist/formats/d3/index.d.mts +1 -1
- package/dist/formats/d3/index.mjs +1 -1
- package/dist/formats/dot/index.d.mts +1 -1
- package/dist/formats/dot/index.mjs +1 -1
- package/dist/formats/edge-list/index.d.mts +1 -1
- package/dist/formats/edge-list/index.mjs +1 -1
- package/dist/formats/elk/index.d.mts +1 -1
- package/dist/formats/gexf/index.d.mts +1 -1
- package/dist/formats/gexf/index.mjs +1 -1
- package/dist/formats/gml/index.d.mts +1 -1
- package/dist/formats/gml/index.mjs +1 -1
- package/dist/formats/graphml/index.d.mts +1 -1
- package/dist/formats/graphml/index.mjs +1 -1
- package/dist/formats/jgf/index.d.mts +1 -1
- package/dist/formats/jgf/index.mjs +1 -1
- package/dist/formats/mermaid/index.d.mts +1 -1
- package/dist/formats/mermaid/index.mjs +1 -1
- package/dist/formats/tgf/index.d.mts +1 -1
- package/dist/formats/tgf/index.mjs +1 -1
- package/dist/formats/xyflow/index.d.mts +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +5 -5
- package/dist/queries.d.mts +14 -14
- package/dist/queries.mjs +17 -10
- package/dist/schemas.d.mts +50 -1
- package/dist/schemas.mjs +21 -2
- package/dist/{types-BzckPChi.d.mts → types-CnZ01raw.d.mts} +31 -16
- package/package.json +5 -2
- package/schemas/edge.schema.json +16 -1
- package/schemas/graph.schema.json +72 -3
- package/schemas/node.schema.json +56 -1
- package/dist/algorithms-g2uWmPrb.d.mts +0 -786
- /package/dist/{adjacency-list-fldj-QAL.mjs → adjacency-list-Ca0VjKIf.mjs} +0 -0
- /package/dist/{edge-list-Br05wXMg.mjs → edge-list-gKe8-iRa.mjs} +0 -0
- /package/dist/{indexing-DyfgLuzw.mjs → indexing-CJc-ul8e.mjs} +0 -0
|
@@ -1,786 +0,0 @@
|
|
|
1
|
-
import { A as TraversalOptions, O as SinglePathOptions, S as MSTOptions, T as PathOptions, _ as GraphNode, n as AllPairsShortestPathsOptions, p as GraphEdge, t as AStarOptions, u as Graph, y as GraphPath } from "./types-BzckPChi.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/algorithms/centrality.d.ts
|
|
4
|
-
interface IterativeCentralityOptions {
|
|
5
|
-
alpha?: number;
|
|
6
|
-
maxIterations?: number;
|
|
7
|
-
tolerance?: number;
|
|
8
|
-
}
|
|
9
|
-
interface HITSResult {
|
|
10
|
-
hubs: Record<string, number>;
|
|
11
|
-
authorities: Record<string, number>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Returns degree centrality scores for all nodes.
|
|
15
|
-
*
|
|
16
|
-
* Degree centrality is the node degree normalized by `n - 1`.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* const scores = getDegreeCentrality(graph);
|
|
21
|
-
* console.log(scores.a); // 0.5
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
declare function getDegreeCentrality(graph: Graph): Record<string, number>;
|
|
25
|
-
/**
|
|
26
|
-
* Returns in-degree centrality scores for all nodes.
|
|
27
|
-
*
|
|
28
|
-
* In-degree centrality is the incoming degree normalized by `n - 1`.
|
|
29
|
-
*/
|
|
30
|
-
declare function getInDegreeCentrality(graph: Graph): Record<string, number>;
|
|
31
|
-
/**
|
|
32
|
-
* Returns out-degree centrality scores for all nodes.
|
|
33
|
-
*
|
|
34
|
-
* Out-degree centrality is the outgoing degree normalized by `n - 1`.
|
|
35
|
-
*/
|
|
36
|
-
declare function getOutDegreeCentrality(graph: Graph): Record<string, number>;
|
|
37
|
-
/**
|
|
38
|
-
* Returns closeness centrality scores for all nodes.
|
|
39
|
-
*
|
|
40
|
-
* Distances are computed over unweighted shortest paths using the graph's
|
|
41
|
-
* existing directed or undirected edge semantics.
|
|
42
|
-
*/
|
|
43
|
-
declare function getClosenessCentrality(graph: Graph): Record<string, number>;
|
|
44
|
-
/**
|
|
45
|
-
* Returns betweenness centrality scores for all nodes.
|
|
46
|
-
*
|
|
47
|
-
* Uses Brandes' algorithm over unweighted shortest paths and returns
|
|
48
|
-
* normalized scores.
|
|
49
|
-
*/
|
|
50
|
-
declare function getBetweennessCentrality(graph: Graph): Record<string, number>;
|
|
51
|
-
/**
|
|
52
|
-
* Returns PageRank scores for all nodes.
|
|
53
|
-
*
|
|
54
|
-
* Uses power iteration with damping factor `alpha`.
|
|
55
|
-
*/
|
|
56
|
-
declare function getPageRank(graph: Graph, options?: IterativeCentralityOptions): Record<string, number>;
|
|
57
|
-
/**
|
|
58
|
-
* Returns HITS hub and authority scores for all nodes.
|
|
59
|
-
*
|
|
60
|
-
* Uses power iteration and L2 normalization per iteration.
|
|
61
|
-
*/
|
|
62
|
-
declare function getHITS(graph: Graph, options?: IterativeCentralityOptions): HITSResult;
|
|
63
|
-
/**
|
|
64
|
-
* Returns eigenvector centrality scores for all nodes.
|
|
65
|
-
*
|
|
66
|
-
* Uses power iteration over incoming neighbors for directed graphs and
|
|
67
|
-
* undirected adjacency for undirected graphs.
|
|
68
|
-
*/
|
|
69
|
-
declare function getEigenvectorCentrality(graph: Graph, options?: IterativeCentralityOptions): Record<string, number>;
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/algorithms/community.d.ts
|
|
72
|
-
interface GirvanNewmanOptions {
|
|
73
|
-
level?: number;
|
|
74
|
-
maxLevels?: number;
|
|
75
|
-
}
|
|
76
|
-
interface LabelPropagationOptions {
|
|
77
|
-
maxIterations?: number;
|
|
78
|
-
}
|
|
79
|
-
type Community<N = any> = GraphNode<N>[];
|
|
80
|
-
/**
|
|
81
|
-
* Returns label-propagation communities for the graph.
|
|
82
|
-
*
|
|
83
|
-
* The implementation is deterministic: ties are broken by lexicographic label
|
|
84
|
-
* order so test results remain stable.
|
|
85
|
-
*/
|
|
86
|
-
declare function getLabelPropagationCommunities<N>(graph: Graph<N>, options?: LabelPropagationOptions): Community<N>[];
|
|
87
|
-
/**
|
|
88
|
-
* Lazily yields Girvan-Newman community splits as edge betweenness removes
|
|
89
|
-
* bridge-like edges from the graph.
|
|
90
|
-
*/
|
|
91
|
-
declare function genGirvanNewmanCommunities<N>(graph: Graph<N>, options?: GirvanNewmanOptions): Generator<Community<N>[]>;
|
|
92
|
-
/**
|
|
93
|
-
* Returns the requested Girvan-Newman split level eagerly.
|
|
94
|
-
*
|
|
95
|
-
* `level: 1` returns the first split yielded by `genGirvanNewmanCommunities`.
|
|
96
|
-
*/
|
|
97
|
-
declare function getGirvanNewmanCommunities<N>(graph: Graph<N>, options?: GirvanNewmanOptions): Community<N>[];
|
|
98
|
-
/**
|
|
99
|
-
* Returns the modularity score for a partition of communities.
|
|
100
|
-
*
|
|
101
|
-
* Community algorithms in this module treat the graph as undirected.
|
|
102
|
-
*/
|
|
103
|
-
declare function getModularity<N>(graph: Graph<N>, communities: Community<N>[]): number;
|
|
104
|
-
/**
|
|
105
|
-
* Returns communities found by greedily merging partitions that improve
|
|
106
|
-
* modularity the most at each step.
|
|
107
|
-
*/
|
|
108
|
-
declare function getGreedyModularityCommunities<N>(graph: Graph<N>): Community<N>[];
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/algorithms/connectivity.d.ts
|
|
111
|
-
/**
|
|
112
|
-
* Returns bridge edges whose removal disconnects the graph.
|
|
113
|
-
*
|
|
114
|
-
* Connectivity algorithms in this module treat the graph as undirected.
|
|
115
|
-
*/
|
|
116
|
-
declare function getBridges<N, E>(graph: Graph<N, E>): GraphEdge<E>[];
|
|
117
|
-
/**
|
|
118
|
-
* Returns articulation points (cut vertices) for the graph.
|
|
119
|
-
*
|
|
120
|
-
* Connectivity algorithms in this module treat the graph as undirected.
|
|
121
|
-
*/
|
|
122
|
-
declare function getArticulationPoints<N, E>(graph: Graph<N, E>): GraphNode<N>[];
|
|
123
|
-
/**
|
|
124
|
-
* Returns biconnected components as arrays of nodes.
|
|
125
|
-
*
|
|
126
|
-
* Articulation points may appear in multiple returned components.
|
|
127
|
-
*/
|
|
128
|
-
declare function getBiconnectedComponents<N, E>(graph: Graph<N, E>): GraphNode<N>[][];
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region src/algorithms/isomorphism.d.ts
|
|
131
|
-
interface IsomorphismOptions<N = any, E = any> {
|
|
132
|
-
nodeMatch?: (a: GraphNode<N>, b: GraphNode<N>) => boolean;
|
|
133
|
-
edgeMatch?: (a: GraphEdge<E>, b: GraphEdge<E>) => boolean;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Returns whether two graphs are structurally isomorphic.
|
|
137
|
-
*
|
|
138
|
-
* Optional `nodeMatch` and `edgeMatch` predicates can refine the match using
|
|
139
|
-
* node and edge payloads.
|
|
140
|
-
*/
|
|
141
|
-
declare function isIsomorphic<N, E>(graphA: Graph<N, E>, graphB: Graph<N, E>, options?: IsomorphismOptions<N, E>): boolean;
|
|
142
|
-
//#endregion
|
|
143
|
-
//#region src/algorithms.d.ts
|
|
144
|
-
/**
|
|
145
|
-
* Breadth-first traversal generator yielding nodes level by level.
|
|
146
|
-
*
|
|
147
|
-
* **O(V + E)** time, **O(V)** space.
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```ts
|
|
151
|
-
* import { createGraph, bfs } from '@statelyai/graph';
|
|
152
|
-
*
|
|
153
|
-
* const graph = createGraph({
|
|
154
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
155
|
-
* edges: [{ id: 'ab', sourceId: 'a', targetId: 'b' }, { id: 'bc', sourceId: 'b', targetId: 'c' }],
|
|
156
|
-
* });
|
|
157
|
-
*
|
|
158
|
-
* for (const node of bfs(graph, 'a')) {
|
|
159
|
-
* console.log(node.id); // 'a', 'b', 'c'
|
|
160
|
-
* }
|
|
161
|
-
* ```
|
|
162
|
-
*/
|
|
163
|
-
declare function bfs<N>(graph: Graph<N>, startId: string): Generator<GraphNode<N>>;
|
|
164
|
-
/**
|
|
165
|
-
* Depth-first traversal generator yielding nodes as visited.
|
|
166
|
-
*
|
|
167
|
-
* **O(V + E)** time, **O(V)** space.
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```ts
|
|
171
|
-
* import { createGraph, dfs } from '@statelyai/graph';
|
|
172
|
-
*
|
|
173
|
-
* const graph = createGraph({
|
|
174
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
175
|
-
* edges: [{ id: 'ab', sourceId: 'a', targetId: 'b' }, { id: 'bc', sourceId: 'b', targetId: 'c' }],
|
|
176
|
-
* });
|
|
177
|
-
*
|
|
178
|
-
* for (const node of dfs(graph, 'a')) {
|
|
179
|
-
* console.log(node.id); // 'a', 'b', 'c'
|
|
180
|
-
* }
|
|
181
|
-
* ```
|
|
182
|
-
*/
|
|
183
|
-
declare function dfs<N>(graph: Graph<N>, startId: string): Generator<GraphNode<N>>;
|
|
184
|
-
/**
|
|
185
|
-
* Checks whether the graph contains no cycles.
|
|
186
|
-
*
|
|
187
|
-
* **O(V + E)** time.
|
|
188
|
-
*
|
|
189
|
-
* @example
|
|
190
|
-
* ```ts
|
|
191
|
-
* import { createGraph, isAcyclic } from '@statelyai/graph';
|
|
192
|
-
*
|
|
193
|
-
* const dag = createGraph({
|
|
194
|
-
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
195
|
-
* edges: [{ id: 'ab', sourceId: 'a', targetId: 'b' }],
|
|
196
|
-
* });
|
|
197
|
-
*
|
|
198
|
-
* isAcyclic(dag); // true
|
|
199
|
-
* ```
|
|
200
|
-
*/
|
|
201
|
-
declare function isAcyclic(graph: Graph): boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Returns connected components as arrays of nodes.
|
|
204
|
-
* Treats all edges as undirected for connectivity.
|
|
205
|
-
*
|
|
206
|
-
* **O(V + E)** time.
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
* ```ts
|
|
210
|
-
* import { createGraph, getConnectedComponents } from '@statelyai/graph';
|
|
211
|
-
*
|
|
212
|
-
* const graph = createGraph({
|
|
213
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
214
|
-
* edges: [{ id: 'ab', sourceId: 'a', targetId: 'b' }],
|
|
215
|
-
* });
|
|
216
|
-
*
|
|
217
|
-
* const components = getConnectedComponents(graph);
|
|
218
|
-
* // [[nodeA, nodeB], [nodeC]]
|
|
219
|
-
* ```
|
|
220
|
-
*/
|
|
221
|
-
declare function getConnectedComponents<N>(graph: Graph<N>): GraphNode<N>[][];
|
|
222
|
-
/**
|
|
223
|
-
* Returns a topological ordering of nodes, or `null` if the graph is cyclic.
|
|
224
|
-
*
|
|
225
|
-
* **O(V + E)** time (Kahn's algorithm).
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* ```ts
|
|
229
|
-
* import { createGraph, getTopologicalSort } from '@statelyai/graph';
|
|
230
|
-
*
|
|
231
|
-
* const graph = createGraph({
|
|
232
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
233
|
-
* edges: [
|
|
234
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
235
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
236
|
-
* ],
|
|
237
|
-
* });
|
|
238
|
-
*
|
|
239
|
-
* const sorted = getTopologicalSort(graph);
|
|
240
|
-
* // [nodeA, nodeB, nodeC]
|
|
241
|
-
* ```
|
|
242
|
-
*/
|
|
243
|
-
declare function getTopologicalSort<N>(graph: Graph<N>): GraphNode<N>[] | null;
|
|
244
|
-
/**
|
|
245
|
-
* Checks whether a path exists between two nodes.
|
|
246
|
-
*
|
|
247
|
-
* **O(V + E)** time (BFS) or **O((V + E) log V)** (Dijkstra when weighted).
|
|
248
|
-
*
|
|
249
|
-
* @example
|
|
250
|
-
* ```ts
|
|
251
|
-
* import { createGraph, hasPath } from '@statelyai/graph';
|
|
252
|
-
*
|
|
253
|
-
* const graph = createGraph({
|
|
254
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
255
|
-
* edges: [{ id: 'ab', sourceId: 'a', targetId: 'b' }],
|
|
256
|
-
* });
|
|
257
|
-
*
|
|
258
|
-
* hasPath(graph, 'a', 'b'); // true
|
|
259
|
-
* hasPath(graph, 'a', 'c'); // false
|
|
260
|
-
* ```
|
|
261
|
-
*/
|
|
262
|
-
declare function hasPath(graph: Graph, sourceId: string, targetId: string): boolean;
|
|
263
|
-
/**
|
|
264
|
-
* Checks whether the graph is connected (all nodes reachable from any node).
|
|
265
|
-
*
|
|
266
|
-
* **O(V + E)** time.
|
|
267
|
-
*
|
|
268
|
-
* @example
|
|
269
|
-
* ```ts
|
|
270
|
-
* import { createGraph, isConnected } from '@statelyai/graph';
|
|
271
|
-
*
|
|
272
|
-
* const graph = createGraph({
|
|
273
|
-
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
274
|
-
* edges: [{ id: 'ab', sourceId: 'a', targetId: 'b' }],
|
|
275
|
-
* });
|
|
276
|
-
*
|
|
277
|
-
* isConnected(graph); // true
|
|
278
|
-
* ```
|
|
279
|
-
*/
|
|
280
|
-
declare function isConnected(graph: Graph): boolean;
|
|
281
|
-
/**
|
|
282
|
-
* Checks whether the graph is a tree (connected and acyclic).
|
|
283
|
-
*
|
|
284
|
-
* **O(V + E)** time.
|
|
285
|
-
*
|
|
286
|
-
* @example
|
|
287
|
-
* ```ts
|
|
288
|
-
* import { createGraph, isTree } from '@statelyai/graph';
|
|
289
|
-
*
|
|
290
|
-
* const tree = createGraph({
|
|
291
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
292
|
-
* edges: [
|
|
293
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
294
|
-
* { id: 'ac', sourceId: 'a', targetId: 'c' },
|
|
295
|
-
* ],
|
|
296
|
-
* });
|
|
297
|
-
*
|
|
298
|
-
* isTree(tree); // true
|
|
299
|
-
* ```
|
|
300
|
-
*/
|
|
301
|
-
declare function isTree(graph: Graph): boolean;
|
|
302
|
-
/**
|
|
303
|
-
* Lazily yields all shortest paths from a source node.
|
|
304
|
-
* Use `getShortestPaths` for the full array.
|
|
305
|
-
*
|
|
306
|
-
* **O(V + E)** time (BFS) or **O((V + E) log V)** (Dijkstra when weighted),
|
|
307
|
-
* plus **O(P)** per path yielded where P is the path length.
|
|
308
|
-
*
|
|
309
|
-
* @example
|
|
310
|
-
* ```ts
|
|
311
|
-
* import { createGraph, genShortestPaths } from '@statelyai/graph';
|
|
312
|
-
*
|
|
313
|
-
* const graph = createGraph({
|
|
314
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
315
|
-
* edges: [
|
|
316
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
317
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
318
|
-
* ],
|
|
319
|
-
* initialNodeId: 'a',
|
|
320
|
-
* });
|
|
321
|
-
*
|
|
322
|
-
* for (const path of genShortestPaths(graph)) {
|
|
323
|
-
* console.log(path.steps.map(s => s.node.id));
|
|
324
|
-
* }
|
|
325
|
-
* ```
|
|
326
|
-
*/
|
|
327
|
-
declare function genShortestPaths<N, E>(graph: Graph<N, E>, opts?: PathOptions<E>): Generator<GraphPath<N, E>>;
|
|
328
|
-
/**
|
|
329
|
-
* Returns all shortest paths from a source node as an array.
|
|
330
|
-
* Delegates to `genShortestPaths` internally.
|
|
331
|
-
*
|
|
332
|
-
* **O(V + E)** time (BFS) or **O((V + E) log V)** (Dijkstra when weighted).
|
|
333
|
-
*
|
|
334
|
-
* @example
|
|
335
|
-
* ```ts
|
|
336
|
-
* import { createGraph, getShortestPaths } from '@statelyai/graph';
|
|
337
|
-
*
|
|
338
|
-
* const graph = createGraph({
|
|
339
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
340
|
-
* edges: [
|
|
341
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
342
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
343
|
-
* ],
|
|
344
|
-
* initialNodeId: 'a',
|
|
345
|
-
* });
|
|
346
|
-
*
|
|
347
|
-
* const paths = getShortestPaths(graph);
|
|
348
|
-
* // paths to 'b' and 'c' from 'a'
|
|
349
|
-
* ```
|
|
350
|
-
*/
|
|
351
|
-
declare function getShortestPaths<N, E>(graph: Graph<N, E>, opts?: PathOptions<E>): GraphPath<N, E>[];
|
|
352
|
-
/**
|
|
353
|
-
* Returns a single shortest path from source to target, or `undefined` if unreachable.
|
|
354
|
-
*
|
|
355
|
-
* **O(V + E)** time (BFS) or **O((V + E) log V)** (Dijkstra when weighted).
|
|
356
|
-
*
|
|
357
|
-
* @example
|
|
358
|
-
* ```ts
|
|
359
|
-
* import { createGraph, getShortestPath } from '@statelyai/graph';
|
|
360
|
-
*
|
|
361
|
-
* const graph = createGraph({
|
|
362
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
363
|
-
* edges: [
|
|
364
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
365
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
366
|
-
* ],
|
|
367
|
-
* initialNodeId: 'a',
|
|
368
|
-
* });
|
|
369
|
-
*
|
|
370
|
-
* const path = getShortestPath(graph, { to: 'c' });
|
|
371
|
-
* // path.steps -> [{node: nodeB, edge: ...}, {node: nodeC, edge: ...}]
|
|
372
|
-
* ```
|
|
373
|
-
*/
|
|
374
|
-
declare function getShortestPath<N, E>(graph: Graph<N, E>, opts: SinglePathOptions<E>): GraphPath<N, E> | undefined;
|
|
375
|
-
/**
|
|
376
|
-
* Returns all simple (acyclic) paths from a source node as an array.
|
|
377
|
-
* Delegates to `genSimplePaths` internally.
|
|
378
|
-
*
|
|
379
|
-
* **O(V!)** worst-case (exponential in dense graphs).
|
|
380
|
-
*
|
|
381
|
-
* @example
|
|
382
|
-
* ```ts
|
|
383
|
-
* import { createGraph, getSimplePaths } from '@statelyai/graph';
|
|
384
|
-
*
|
|
385
|
-
* const graph = createGraph({
|
|
386
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
387
|
-
* edges: [
|
|
388
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
389
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
390
|
-
* { id: 'ac', sourceId: 'a', targetId: 'c' },
|
|
391
|
-
* ],
|
|
392
|
-
* initialNodeId: 'a',
|
|
393
|
-
* });
|
|
394
|
-
*
|
|
395
|
-
* const paths = getSimplePaths(graph, { to: 'c' });
|
|
396
|
-
* // two paths: a->b->c and a->c
|
|
397
|
-
* ```
|
|
398
|
-
*/
|
|
399
|
-
declare function getSimplePaths<N, E>(graph: Graph<N, E>, opts?: PathOptions<E>): GraphPath<N, E>[];
|
|
400
|
-
/**
|
|
401
|
-
* Lazily yields all simple (acyclic) paths from a source node via DFS backtracking.
|
|
402
|
-
* Use `getSimplePaths` for the full array.
|
|
403
|
-
*
|
|
404
|
-
* **O(V!)** worst-case (exponential in dense graphs).
|
|
405
|
-
*
|
|
406
|
-
* @example
|
|
407
|
-
* ```ts
|
|
408
|
-
* import { createGraph, genSimplePaths } from '@statelyai/graph';
|
|
409
|
-
*
|
|
410
|
-
* const graph = createGraph({
|
|
411
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
412
|
-
* edges: [
|
|
413
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
414
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
415
|
-
* { id: 'ac', sourceId: 'a', targetId: 'c' },
|
|
416
|
-
* ],
|
|
417
|
-
* initialNodeId: 'a',
|
|
418
|
-
* });
|
|
419
|
-
*
|
|
420
|
-
* for (const path of genSimplePaths(graph, { to: 'c' })) {
|
|
421
|
-
* console.log(path.steps.map(s => s.node.id));
|
|
422
|
-
* // ['b', 'c'] or ['c']
|
|
423
|
-
* }
|
|
424
|
-
* ```
|
|
425
|
-
*/
|
|
426
|
-
declare function genSimplePaths<N, E>(graph: Graph<N, E>, opts?: PathOptions<E>): Generator<GraphPath<N, E>>;
|
|
427
|
-
/**
|
|
428
|
-
* Returns a single simple (acyclic) path from source to target, or `undefined` if unreachable.
|
|
429
|
-
*
|
|
430
|
-
* **O(V + E)** typical, **O(V!)** worst-case.
|
|
431
|
-
*
|
|
432
|
-
* @example
|
|
433
|
-
* ```ts
|
|
434
|
-
* import { createGraph, getSimplePath } from '@statelyai/graph';
|
|
435
|
-
*
|
|
436
|
-
* const graph = createGraph({
|
|
437
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
438
|
-
* edges: [
|
|
439
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
440
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
441
|
-
* ],
|
|
442
|
-
* initialNodeId: 'a',
|
|
443
|
-
* });
|
|
444
|
-
*
|
|
445
|
-
* const path = getSimplePath(graph, { to: 'c' });
|
|
446
|
-
* // path.steps -> [{node: nodeB, edge: ...}, {node: nodeC, edge: ...}]
|
|
447
|
-
* ```
|
|
448
|
-
*/
|
|
449
|
-
declare function getSimplePath<N, E>(graph: Graph<N, E>, opts: SinglePathOptions<E>): GraphPath<N, E> | undefined;
|
|
450
|
-
/**
|
|
451
|
-
* Returns strongly connected components using Tarjan's algorithm.
|
|
452
|
-
* Only meaningful for directed graphs.
|
|
453
|
-
*
|
|
454
|
-
* **O(V + E)** time.
|
|
455
|
-
*
|
|
456
|
-
* @example
|
|
457
|
-
* ```ts
|
|
458
|
-
* import { createGraph, getStronglyConnectedComponents } from '@statelyai/graph';
|
|
459
|
-
*
|
|
460
|
-
* const graph = createGraph({
|
|
461
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
462
|
-
* edges: [
|
|
463
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
464
|
-
* { id: 'ba', sourceId: 'b', targetId: 'a' },
|
|
465
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
466
|
-
* ],
|
|
467
|
-
* });
|
|
468
|
-
*
|
|
469
|
-
* const sccs = getStronglyConnectedComponents(graph);
|
|
470
|
-
* // [[nodeA, nodeB], [nodeC]]
|
|
471
|
-
* ```
|
|
472
|
-
*/
|
|
473
|
-
declare function getStronglyConnectedComponents<N>(graph: Graph<N>): GraphNode<N>[][];
|
|
474
|
-
/**
|
|
475
|
-
* Returns all elementary cycles as an array of paths.
|
|
476
|
-
* Delegates to `genCycles` internally.
|
|
477
|
-
*
|
|
478
|
-
* **O((V + E) · C)** where C is the number of elementary cycles (can be exponential).
|
|
479
|
-
*
|
|
480
|
-
* @example
|
|
481
|
-
* ```ts
|
|
482
|
-
* import { createGraph, getCycles } from '@statelyai/graph';
|
|
483
|
-
*
|
|
484
|
-
* const graph = createGraph({
|
|
485
|
-
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
486
|
-
* edges: [
|
|
487
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
488
|
-
* { id: 'ba', sourceId: 'b', targetId: 'a' },
|
|
489
|
-
* ],
|
|
490
|
-
* });
|
|
491
|
-
*
|
|
492
|
-
* const cycles = getCycles(graph);
|
|
493
|
-
* // one cycle: a -> b -> a
|
|
494
|
-
* ```
|
|
495
|
-
*/
|
|
496
|
-
declare function getCycles<N, E>(graph: Graph<N, E>): GraphPath<N, E>[];
|
|
497
|
-
/**
|
|
498
|
-
* Lazily yields elementary cycles one at a time.
|
|
499
|
-
* Use `getCycles` for the full array.
|
|
500
|
-
*
|
|
501
|
-
* **O((V + E) · C)** where C is the number of elementary cycles (can be exponential).
|
|
502
|
-
*
|
|
503
|
-
* @example
|
|
504
|
-
* ```ts
|
|
505
|
-
* import { createGraph, genCycles } from '@statelyai/graph';
|
|
506
|
-
*
|
|
507
|
-
* const graph = createGraph({
|
|
508
|
-
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
509
|
-
* edges: [
|
|
510
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
511
|
-
* { id: 'ba', sourceId: 'b', targetId: 'a' },
|
|
512
|
-
* ],
|
|
513
|
-
* });
|
|
514
|
-
*
|
|
515
|
-
* for (const cycle of genCycles(graph)) {
|
|
516
|
-
* console.log(cycle.steps.map(s => s.node.id)); // ['b', 'a']
|
|
517
|
-
* }
|
|
518
|
-
* ```
|
|
519
|
-
*/
|
|
520
|
-
declare function genCycles<N, E>(graph: Graph<N, E>): Generator<GraphPath<N, E>>;
|
|
521
|
-
/**
|
|
522
|
-
* Returns a single canonical preorder (DFS visit-order) sequence.
|
|
523
|
-
* Visits neighbors in the order they appear in the adjacency list.
|
|
524
|
-
*
|
|
525
|
-
* **O(V + E)** time.
|
|
526
|
-
*
|
|
527
|
-
* @example
|
|
528
|
-
* ```ts
|
|
529
|
-
* import { createGraph, getPreorder } from '@statelyai/graph';
|
|
530
|
-
*
|
|
531
|
-
* const graph = createGraph({
|
|
532
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
533
|
-
* edges: [
|
|
534
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
535
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
536
|
-
* ],
|
|
537
|
-
* initialNodeId: 'a',
|
|
538
|
-
* });
|
|
539
|
-
*
|
|
540
|
-
* const order = getPreorder(graph);
|
|
541
|
-
* // [nodeA, nodeB, nodeC]
|
|
542
|
-
* ```
|
|
543
|
-
*/
|
|
544
|
-
declare function getPreorder<N>(graph: Graph<N>, opts?: TraversalOptions): GraphNode<N>[];
|
|
545
|
-
/**
|
|
546
|
-
* Returns a single canonical postorder (DFS finish-order) sequence.
|
|
547
|
-
* Visits neighbors in the order they appear in the adjacency list.
|
|
548
|
-
*
|
|
549
|
-
* **O(V + E)** time.
|
|
550
|
-
*
|
|
551
|
-
* @example
|
|
552
|
-
* ```ts
|
|
553
|
-
* import { createGraph, getPostorder } from '@statelyai/graph';
|
|
554
|
-
*
|
|
555
|
-
* const graph = createGraph({
|
|
556
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
557
|
-
* edges: [
|
|
558
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
559
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
560
|
-
* ],
|
|
561
|
-
* initialNodeId: 'a',
|
|
562
|
-
* });
|
|
563
|
-
*
|
|
564
|
-
* const order = getPostorder(graph);
|
|
565
|
-
* // [nodeC, nodeB, nodeA]
|
|
566
|
-
* ```
|
|
567
|
-
*/
|
|
568
|
-
declare function getPostorder<N>(graph: Graph<N>, opts?: TraversalOptions): GraphNode<N>[];
|
|
569
|
-
/**
|
|
570
|
-
* Returns all possible preorder sequences as an array. Can be exponential -- prefer `genPreorders`.
|
|
571
|
-
*
|
|
572
|
-
* **O(V! · V)** worst-case (exponential).
|
|
573
|
-
*
|
|
574
|
-
* @example
|
|
575
|
-
* ```ts
|
|
576
|
-
* import { createGraph, getPreorders } from '@statelyai/graph';
|
|
577
|
-
*
|
|
578
|
-
* const graph = createGraph({
|
|
579
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
580
|
-
* edges: [
|
|
581
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
582
|
-
* { id: 'ac', sourceId: 'a', targetId: 'c' },
|
|
583
|
-
* ],
|
|
584
|
-
* initialNodeId: 'a',
|
|
585
|
-
* });
|
|
586
|
-
*
|
|
587
|
-
* const allOrders = getPreorders(graph);
|
|
588
|
-
* // [[nodeA, nodeB, nodeC], [nodeA, nodeC, nodeB]]
|
|
589
|
-
* ```
|
|
590
|
-
*/
|
|
591
|
-
declare function getPreorders<N>(graph: Graph<N>, opts?: TraversalOptions): GraphNode<N>[][];
|
|
592
|
-
/**
|
|
593
|
-
* Returns all possible postorder sequences as an array. Can be exponential -- prefer `genPostorders`.
|
|
594
|
-
*
|
|
595
|
-
* **O(V! · V)** worst-case (exponential).
|
|
596
|
-
*
|
|
597
|
-
* @example
|
|
598
|
-
* ```ts
|
|
599
|
-
* import { createGraph, getPostorders } from '@statelyai/graph';
|
|
600
|
-
*
|
|
601
|
-
* const graph = createGraph({
|
|
602
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
603
|
-
* edges: [
|
|
604
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
605
|
-
* { id: 'ac', sourceId: 'a', targetId: 'c' },
|
|
606
|
-
* ],
|
|
607
|
-
* initialNodeId: 'a',
|
|
608
|
-
* });
|
|
609
|
-
*
|
|
610
|
-
* const allOrders = getPostorders(graph);
|
|
611
|
-
* // [[nodeB, nodeC, nodeA], [nodeC, nodeB, nodeA]]
|
|
612
|
-
* ```
|
|
613
|
-
*/
|
|
614
|
-
declare function getPostorders<N>(graph: Graph<N>, opts?: TraversalOptions): GraphNode<N>[][];
|
|
615
|
-
/**
|
|
616
|
-
* Lazily yields all possible preorder (DFS visit-order) sequences.
|
|
617
|
-
* Different neighbor exploration orders yield different sequences.
|
|
618
|
-
* Use `getPreorder()` for a single canonical ordering.
|
|
619
|
-
*
|
|
620
|
-
* **O(V! · V)** worst-case (exponential).
|
|
621
|
-
*
|
|
622
|
-
* @example
|
|
623
|
-
* ```ts
|
|
624
|
-
* import { createGraph, genPreorders } from '@statelyai/graph';
|
|
625
|
-
*
|
|
626
|
-
* const graph = createGraph({
|
|
627
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
628
|
-
* edges: [
|
|
629
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
630
|
-
* { id: 'ac', sourceId: 'a', targetId: 'c' },
|
|
631
|
-
* ],
|
|
632
|
-
* initialNodeId: 'a',
|
|
633
|
-
* });
|
|
634
|
-
*
|
|
635
|
-
* for (const order of genPreorders(graph)) {
|
|
636
|
-
* console.log(order.map(n => n.id));
|
|
637
|
-
* // ['a', 'b', 'c'] or ['a', 'c', 'b']
|
|
638
|
-
* }
|
|
639
|
-
* ```
|
|
640
|
-
*/
|
|
641
|
-
declare function genPreorders<N>(graph: Graph<N>, opts?: TraversalOptions): Generator<GraphNode<N>[]>;
|
|
642
|
-
/**
|
|
643
|
-
* Lazily yields all possible postorder (DFS finish-order) sequences.
|
|
644
|
-
* Different neighbor exploration orders yield different sequences.
|
|
645
|
-
* Use `getPostorder()` for a single canonical ordering.
|
|
646
|
-
*
|
|
647
|
-
* **O(V! · V)** worst-case (exponential).
|
|
648
|
-
*
|
|
649
|
-
* @example
|
|
650
|
-
* ```ts
|
|
651
|
-
* import { createGraph, genPostorders } from '@statelyai/graph';
|
|
652
|
-
*
|
|
653
|
-
* const graph = createGraph({
|
|
654
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
655
|
-
* edges: [
|
|
656
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
657
|
-
* { id: 'ac', sourceId: 'a', targetId: 'c' },
|
|
658
|
-
* ],
|
|
659
|
-
* initialNodeId: 'a',
|
|
660
|
-
* });
|
|
661
|
-
*
|
|
662
|
-
* for (const order of genPostorders(graph)) {
|
|
663
|
-
* console.log(order.map(n => n.id));
|
|
664
|
-
* // ['b', 'c', 'a'] or ['c', 'b', 'a']
|
|
665
|
-
* }
|
|
666
|
-
* ```
|
|
667
|
-
*/
|
|
668
|
-
declare function genPostorders<N>(graph: Graph<N>, opts?: TraversalOptions): Generator<GraphNode<N>[]>;
|
|
669
|
-
/**
|
|
670
|
-
* Returns a minimum spanning tree of the graph.
|
|
671
|
-
* Only meaningful for connected undirected graphs (or the component reachable
|
|
672
|
-
* from an arbitrary start node in directed graphs).
|
|
673
|
-
*
|
|
674
|
-
* **O(E log E)** using either edge sorting (Kruskal) or a min-heap (Prim).
|
|
675
|
-
*
|
|
676
|
-
* @example
|
|
677
|
-
* ```ts
|
|
678
|
-
* import { createGraph, getMinimumSpanningTree } from '@statelyai/graph';
|
|
679
|
-
*
|
|
680
|
-
* const graph = createGraph({
|
|
681
|
-
* type: 'undirected',
|
|
682
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
683
|
-
* edges: [
|
|
684
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b', data: { weight: 1 } },
|
|
685
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c', data: { weight: 2 } },
|
|
686
|
-
* { id: 'ac', sourceId: 'a', targetId: 'c', data: { weight: 3 } },
|
|
687
|
-
* ],
|
|
688
|
-
* });
|
|
689
|
-
*
|
|
690
|
-
* const mst = getMinimumSpanningTree(graph, {
|
|
691
|
-
* getWeight: (e) => e.data.weight,
|
|
692
|
-
* });
|
|
693
|
-
* // mst has edges 'ab' and 'bc' (total weight 3)
|
|
694
|
-
* ```
|
|
695
|
-
*/
|
|
696
|
-
declare function getMinimumSpanningTree<N, E>(graph: Graph<N, E>, opts?: MSTOptions<E>): Graph<N, E>;
|
|
697
|
-
/**
|
|
698
|
-
* Returns shortest paths between all pairs of nodes.
|
|
699
|
-
* Algorithm 'dijkstra' (default): runs getShortestPaths per source node.
|
|
700
|
-
* Algorithm 'floyd-warshall': classic dynamic programming.
|
|
701
|
-
*
|
|
702
|
-
* **O(V · (V + E) log V)** (Dijkstra) or **O(V³)** (Floyd-Warshall).
|
|
703
|
-
*
|
|
704
|
-
* @example
|
|
705
|
-
* ```ts
|
|
706
|
-
* import { createGraph, getAllPairsShortestPaths } from '@statelyai/graph';
|
|
707
|
-
*
|
|
708
|
-
* const graph = createGraph({
|
|
709
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
710
|
-
* edges: [
|
|
711
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
712
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
713
|
-
* ],
|
|
714
|
-
* });
|
|
715
|
-
*
|
|
716
|
-
* const allPaths = getAllPairsShortestPaths(graph);
|
|
717
|
-
* // paths for every reachable (source, target) pair
|
|
718
|
-
* ```
|
|
719
|
-
*/
|
|
720
|
-
declare function getAllPairsShortestPaths<N, E>(graph: Graph<N, E>, opts?: AllPairsShortestPathsOptions<E>): GraphPath<N, E>[];
|
|
721
|
-
/**
|
|
722
|
-
* Returns a shortest path using A* search with an admissible heuristic.
|
|
723
|
-
* More efficient than Dijkstra when a good heuristic is available.
|
|
724
|
-
*
|
|
725
|
-
* **O((V + E) log V)** time with a good heuristic; degrades to Dijkstra
|
|
726
|
-
* with `heuristic: () => 0`.
|
|
727
|
-
*
|
|
728
|
-
* @example
|
|
729
|
-
* ```ts
|
|
730
|
-
* import { createGraph, getAStarPath } from '@statelyai/graph';
|
|
731
|
-
*
|
|
732
|
-
* const graph = createGraph({
|
|
733
|
-
* nodes: [
|
|
734
|
-
* { id: 'a', x: 0, y: 0 },
|
|
735
|
-
* { id: 'b', x: 1, y: 0 },
|
|
736
|
-
* { id: 'c', x: 1, y: 1 },
|
|
737
|
-
* ],
|
|
738
|
-
* edges: [
|
|
739
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b', weight: 1 },
|
|
740
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c', weight: 1 },
|
|
741
|
-
* { id: 'ac', sourceId: 'a', targetId: 'c', weight: 3 },
|
|
742
|
-
* ],
|
|
743
|
-
* });
|
|
744
|
-
*
|
|
745
|
-
* const path = getAStarPath(graph, {
|
|
746
|
-
* from: 'a',
|
|
747
|
-
* to: 'c',
|
|
748
|
-
* heuristic: (nodeId) => {
|
|
749
|
-
* const node = graph.nodes.find(n => n.id === nodeId)!;
|
|
750
|
-
* const target = graph.nodes.find(n => n.id === 'c')!;
|
|
751
|
-
* return Math.abs(node.x! - target.x!) + Math.abs(node.y! - target.y!);
|
|
752
|
-
* },
|
|
753
|
-
* });
|
|
754
|
-
* // path: a -> b -> c (weight 2, cheaper than direct a -> c)
|
|
755
|
-
* ```
|
|
756
|
-
*/
|
|
757
|
-
declare function getAStarPath<N, E>(graph: Graph<N, E>, opts: AStarOptions<E>): GraphPath<N, E> | undefined;
|
|
758
|
-
/**
|
|
759
|
-
* Joins two paths end-to-end. The last node of the head path must equal
|
|
760
|
-
* the source of the tail path (the overlap node).
|
|
761
|
-
*
|
|
762
|
-
* Steps are concatenated: head.steps ++ tail.steps (tail already starts
|
|
763
|
-
* from the overlap node, so no slicing is needed).
|
|
764
|
-
*
|
|
765
|
-
* @example
|
|
766
|
-
* ```ts
|
|
767
|
-
* import { createGraph, getShortestPath, joinPaths } from '@statelyai/graph';
|
|
768
|
-
*
|
|
769
|
-
* const graph = createGraph({
|
|
770
|
-
* nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
|
|
771
|
-
* edges: [
|
|
772
|
-
* { id: 'ab', sourceId: 'a', targetId: 'b' },
|
|
773
|
-
* { id: 'bc', sourceId: 'b', targetId: 'c' },
|
|
774
|
-
* ],
|
|
775
|
-
* initialNodeId: 'a',
|
|
776
|
-
* });
|
|
777
|
-
*
|
|
778
|
-
* const ab = getShortestPath(graph, { to: 'b' })!;
|
|
779
|
-
* const bc = getShortestPath(graph, { from: 'b', to: 'c' })!;
|
|
780
|
-
* const ac = joinPaths(ab, bc);
|
|
781
|
-
* // ac: a -> b -> c
|
|
782
|
-
* ```
|
|
783
|
-
*/
|
|
784
|
-
declare function joinPaths<N, E>(headPath: GraphPath<N, E>, tailPath: GraphPath<N, E>): GraphPath<N, E>;
|
|
785
|
-
//#endregion
|
|
786
|
-
export { getArticulationPoints as A, HITSResult as B, hasPath as C, joinPaths as D, isTree as E, genGirvanNewmanCommunities as F, getEigenvectorCentrality as G, getBetweennessCentrality as H, getGirvanNewmanCommunities as I, getOutDegreeCentrality as J, getHITS as K, getGreedyModularityCommunities as L, getBridges as M, GirvanNewmanOptions as N, IsomorphismOptions as O, LabelPropagationOptions as P, getLabelPropagationCommunities as R, getTopologicalSort as S, isConnected as T, getClosenessCentrality as U, IterativeCentralityOptions as V, getDegreeCentrality as W, getPageRank as Y, getShortestPath as _, genPreorders as a, getSimplePaths as b, getAStarPath as c, getCycles as d, getMinimumSpanningTree as f, getPreorders as g, getPreorder as h, genPostorders as i, getBiconnectedComponents as j, isIsomorphic as k, getAllPairsShortestPaths as l, getPostorders as m, dfs as n, genShortestPaths as o, getPostorder as p, getInDegreeCentrality as q, genCycles as r, genSimplePaths as s, bfs as t, getConnectedComponents as u, getShortestPaths as v, isAcyclic as w, getStronglyConnectedComponents as x, getSimplePath as y, getModularity as z };
|