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