Package icyllis.arc3d.engine
Class TopologicalSort
java.lang.Object
icyllis.arc3d.engine.TopologicalSort
Provides a depth-first-search topological sort algorithm for simple directed acyclic graphs.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
topologicalSort
(List<T> graph, TopologicalSort.Access<T> access) Topologically sort the nodes in 'graph'.
-
Constructor Details
-
TopologicalSort
public TopologicalSort()
-
-
Method Details
-
topologicalSort
Topologically sort the nodes in 'graph'. For this sort, when node 'i' depends on node 'j' it means node 'j' must appear in the result before node 'i'.The graph to sort must be directed, must not allow self loops, and must not contain cycles. Otherwise,
IllegalStateException
will be thrown and the contents of 'graph' will be in some arbitrary state.- Type Parameters:
T
- the node type of the graph- Parameters:
graph
- the directed acyclic graph to sortaccess
- the node access- Throws:
IllegalStateException
- if the graph contains loops
-