topological-sort-group
Version:
Topological sorting and cycle detection. Optional grouping for parallel processing
19 lines (18 loc) • 425 B
TypeScript
export interface GraphOptions {
path?: string;
}
export type Key = string | number | symbol;
export type Node<T = Key> = {
value: T;
edges: Key[];
};
export type Cycle = Key[];
export interface SortResult<T = Key> {
nodes: Node<T>[][];
cycles: Cycle[];
}
export declare const SortMode: {
readonly Group: 1;
readonly Flat: 2;
};
export type SortModeEnum = (typeof SortMode)[keyof typeof SortMode];