1 | import { IterableOrArrayLike } from './iter';
|
2 | /**
|
3 | * Topologically sort an iterable of edges.
|
4 | *
|
5 | * @param edges - The iterable or array-like object of edges to sort.
|
6 | * An edge is represented as a 2-tuple of `[fromNode, toNode]`.
|
7 | *
|
8 | * @returns The topologically sorted array of nodes.
|
9 | *
|
10 | * #### Notes
|
11 | * If a cycle is present in the graph, the cycle will be ignored and
|
12 | * the return value will be only approximately sorted.
|
13 | *
|
14 | * #### Example
|
15 | * ```typescript
|
16 | * import { topologicSort } from '@lumino/algorithm';
|
17 | *
|
18 | * let data = [
|
19 | * ['d', 'e'],
|
20 | * ['c', 'd'],
|
21 | * ['a', 'b'],
|
22 | * ['b', 'c']
|
23 | * ];
|
24 | *
|
25 | * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']
|
26 | * ```
|
27 | */
|
28 | export declare function topologicSort<T>(edges: IterableOrArrayLike<[T, T]>): T[];
|
29 | //# sourceMappingURL=sort.d.ts.map |
\ | No newline at end of file |