@gravity-ui/graph
Version:
Modern graph editor component
10 lines (9 loc) • 419 B
TypeScript
import { TConnectionId } from "../../../store/connection/ConnectionState";
/**
* Assigns level to each block by BFS from nodes with no incoming edges (roots).
* Levels are 0-based; roots get 0, their direct successors 1, etc.
*/
export declare function computeLevels(blockIds: TConnectionId[], connections: Array<{
sourceBlockId: TConnectionId;
targetBlockId: TConnectionId;
}>): Map<TConnectionId, number>;