Module topological_sort

Source
Expand description

§Topological Sort

This topological sort implementation takes an adjacency list of an acyclic graph and returns an array with the indexes of the nodes in a (non unique) topological order which tells you how to process the nodes in the graph. More precisely from wiki: A topological ordering is a linear ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u comes before v in the ordering.

  • Time Complexity: O(V + E)

§Resources