Topological Sorts
A graph is a partial order which is weaker than <.
A topological sort converts a partial order into a full ordering.
There can be many topological sorts for a given graph (or none may be
possible).
There exists a topological sort for all DAGs.
For disconnetced graphs, there are always multple topo-sorts.
There are two algorithms for topo-sorting.
1) Do a breadth first search. As each node is finished, place it
at the front of the list.
2) Find a node with in-degree of zero. Put it in the back of the
list. Remove the node fom the graph. Repeat.
Uses:
- Task Management
- Subexpressions and code fragements
- Computing cells in a sreadsheet
- Sports Ranking
Links:
http://www.cs.auckland.ac.nz/~ute/220ft/graphalg/node16.html