Topological Sort Explained With Simple Example
Topological sort is a method to sort the vertices in directed acyclic graph in which each node comes before all the nodes to which it has edges going to. Topological sort is mainly used in cases where a certain node can be visited if and only if certain nodes has been visited before.
A Directed Acyclic graph or DAG is a graph which doesn’t have any cycle.
All pairs of consecutive vertices in topological sorted order are connected by edges which forms a directed Hamiltonian Path.
(more…)