Package com.aoindustries.util.graph
Class TopologicalSorter<V,EX extends Exception>
- java.lang.Object
-
- com.aoindustries.util.graph.TopologicalSorter<V,EX>
-
- All Implemented Interfaces:
GraphSorter<V,EX>
public class TopologicalSorter<V,EX extends Exception> extends Object implements GraphSorter<V,EX>
Performs a topological sort of all the vertices in the provided symmetric multi graph. If forward, objects with no edges directed out are first. If backward, objects with no edges directed in are first.See https://wikipedia.org/wiki/Topological_sorting#Algorithms
- Author:
- AO Industries, Inc.
-
-
Constructor Summary
Constructors Constructor Description TopologicalSorter(SymmetricMultiGraph<V,?,? extends EX> graph, boolean isForward)
-
-
-
Constructor Detail
-
TopologicalSorter
public TopologicalSorter(SymmetricMultiGraph<V,?,? extends EX> graph, boolean isForward)
-
-
Method Detail
-
sortGraph
public Set<V> sortGraph() throws CycleException, EX extends Exception
- Specified by:
sortGraphin interfaceGraphSorter<V,EX extends Exception>- Throws:
CycleExceptionEX extends Exception
-
-