UNPKG

975 BTypeScriptView Raw
1declare type Levels = Record<string | number, number>;
2declare type Id = string | number;
3interface Edge {
4 connected: boolean;
5 from: Node;
6 fromId: Id;
7 to: Node;
8 toId: Id;
9}
10interface Node {
11 id: Id;
12 edges: Edge[];
13}
14/**
15 * Assign levels to nodes according to their positions in the hierarchy. Leaves will be lined up at the bottom and all other nodes as close to their children as possible.
16 *
17 * @param nodes - Visible nodes of the graph.
18 *
19 * @returns Populated node levels.
20 */
21export declare function fillLevelsByDirectionLeaves(nodes: Map<Id, Node>): Levels;
22/**
23 * Assign levels to nodes according to their positions in the hierarchy. Roots will be lined up at the top and all nodes as close to their parents as possible.
24 *
25 * @param nodes - Visible nodes of the graph.
26 *
27 * @returns Populated node levels.
28 */
29export declare function fillLevelsByDirectionRoots(nodes: Map<Id, Node>): Levels;
30export {};
31//# sourceMappingURL=index.d.ts.map
\No newline at end of file