- Type Parameters:
T
- The node type
public class TopologicalSorter<T>
extends java.lang.Object
Sorts a directed graph, obtaining a visiting sequence ("sorted" list) that
respects the "Predecessors" (as in a job/task requirements list). (when there
is freedom, the original ordering is preferred) The behaviour in case of
loops (cycles) depends on the "mode": permitLoops == false : loops are
detected, but result is UNDEFINED (simpler) permitLoops == true : loops are
detected, result a "best effort" try, original ordering is privileged
http://en.wikipedia.org/wiki/Topological_sort
- See Also:
- Sample Directed
Graph and Topological Sort Code