TopoSort

TopoSort

new TopoSort()

Source:

Members

mapOfDependencies :object

Map of nodes to a set of nodes as dependencies, <string, Set.>

Source:
Type:
  • object

mapOfDependents :object

Map of nodes to a set of nodes as dependents, <string, Set.>

Source:
Type:
  • object

Methods

add(dependency, dependents)

Add edges(or one edge, if values is non-array).

Source:
Parameters:
Name Type Description
dependency string

Incoming node (dependency)

dependents string | array

Outgoing node or nodes

sort() → {Array}

Sort the graph. Circular graph throw an error with the circular nodes info. Implementation of http://en.wikipedia.org/wiki/Topological_sorting#Algorithms Reference: http://courses.cs.washington.edu/courses/cse326/03wi/lectures/RaoLect20.pdf

Source:
Returns:
Type:
Array

Sorted list