DataStructure Topological Sorting
Topological Sorting
AOV(Activity On Vertex) network
Topological Order
a topological sort or topological ordering of a directed graph 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.
The process of getting the order is called topological sorting.
If AOV has a reasonable topological order, it has to be DAG(Directed Acyclic Graph).
Algorithm
Find vertexes that has no in-degree, delete them and their out-degree.
1 | void TopSort() { |
1 | void TopSort(){ |