Class TopologicalSorter

java.lang.Object
dsa.lab11.exercises.TopologicalSorter

public class TopologicalSorter extends Object
Topological sort.
  • Constructor Details

    • TopologicalSorter

      public TopologicalSorter()
  • Method Details

    • sort

      public static <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.
      Type Parameters:
      Vertex - the vertex type
      Weight - the weight type
      Parameters:
      dag - the directed acyclic graph
      Returns:
      the topologically-sorted vertices