Skip to main content

Module ordering

Module ordering 

Source
Expand description

Topological sorting and strongly connected components of directed graphs.

See the book entry Graphs, traversal and orderings.

Functions§

condensation
The condensation: the directed acyclic graph of strongly connected components.
strongly_connected_components
Strongly connected components by Tarjan’s algorithm (iterative, O(V + E)). Returns the component label of each vertex; labels are a reverse topological order of the condensation (component 0 has no edges to other components).
topological_sort
A topological order (every edge u → v has u before v) by Kahn’s algorithm, taking the smallest ready vertex at each step, so the result is the lexicographically smallest topological order. O((V + E) log V). Returns an error if the graph has a cycle.