| Learn | Algorithm - Graph - Topological sort |
|---|
| Topological Sort A topological ordering, or a topological sort, orders the vertices in a directed acyclic graph on a line, i.e. in a list, such that all directed edges go from left to right. Such an ordering cannot exist if the graph contains a directed cycle because there is no way that you can keep going right on a line and still return back to where you started from. Formally, in a graph It is important to note that each DAG has at least one topological sort. There are known algorithms for constructing a topological ordering of any DAG in linear time, one example is:
A topological sort can be performed in Many applications use directed acyclic graphs to indicate precedences among events. We use topological sorting so that we get an ordering to process each vertex before any of its successors. Vertices in a graph may represent tasks to be performed and the edges
may represent constraints that one task must be performed before
another; a topological ordering is a valid sequence to perform the
tasks set of tasks described in Problem instance and its solutionLet a vertice Let our graph be called where we connect the vertices with directed edges such that the graph is acyclic, then there are three possible topological orderings between
|
Read Article
https://develop.horje.com/learn/1434/reference