The animation illustrates the topological sorting of a
directed graph.
Topological sorting sorts all nodes in sequence so
that all children of a node are positioned behind the node in the
list. This is only possible if the graph contains no cycles, so this
procedure is a good way to test if the graph is acyclic ( a "dag" --
directed acyclic graph).
Topological sorting can also be used to
generate a time plan, a possible sequence of activities which
considers all requirements ( availability of material - storage -
processing - sale). In large diagrams this can often become a problem,
as the dependencies are hard to see over long sequences of edges.
Two simple procedures for the topological sorting exist:
Generating the list by removing of nodes without parents
Generating the list by removing of nodes without children
In the animation the first procedure is presented, showing the
pseudo source code with colour highlighting as well as the affected
components.
Screen Shot(s):
Graph with pseudo code for topological sorting
Start of topological sorting - remove current node and its edges