export interface SortNode { name: string; edges: string[]; temporaryMarked?: boolean; permanentMarked?: boolean; } export interface SortNodes { [name: string]: SortNode; } /** * Implements a depth-first topological sort in Javascript. See https://en.wikipedia.org/wiki/Topological_sorting * for details on this algorithm. * * Takes a list of node objects as parameters of the following structure: * { * name: , //Name of this node * edges: List, //List of nodes to which this node has dependencies * temporaryMarked: , //Initialize to false, used internally * permanentMarked: //Initialize to false, used internally * } * * Returns a list of node names in topological sorted order, such as the following example: * [ 'F', 'G', 'C', 'H', 'D', 'A', 'E', 'B' ] * * Throws an error if there were circular dependencies */ export default function (nodes: SortNodes): string[];