Package dsa.lab11.solutions
Class TopologicalSorter
java.lang.Object
dsa.lab11.solutions.TopologicalSorter
Topological sort.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <Vertex,
Weight>
Iterable<Vertex> sort
(DirectedGraph<Vertex, Weight> dag) Get an iterable that yields each vertex of the given directed acyclic graph (DAG) in a topologically-sorted order.
-
Constructor Details
-
TopologicalSorter
public TopologicalSorter()
-
-
Method Details
-
sort
Get an iterable that yields each vertex of the given directed acyclic graph (DAG) in a topologically-sorted order.- Type Parameters:
Vertex
- the vertex typeWeight
- the weight type- Parameters:
dag
- the directed acyclic graph- Returns:
- the topologically-sorted vertices
-