Class DepthFirstSorter<V,​E extends GEdge<V>>

  • Type Parameters:
    V - the vertex type
    E - the edge type

    public class DepthFirstSorter<V,​E extends GEdge<V>>
    extends java.lang.Object
    Processes the given graph depth first and records that order of the vertices.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <V,​E extends GEdge<V>>
      java.util.List<V>
      postOrder​(GDirectedGraph<V,​E> g)
      Returns the vertices of the given graph in post-order, which is the order the vertices are last visited when performing a depth-first traversal.
      static <V,​E extends GEdge<V>>
      java.util.List<V>
      postOrder​(GDirectedGraph<V,​E> g, GraphNavigator<V,​E> navigator)
      Returns the vertices of the given graph in post-order, which is the order the vertices are last visited when performing a depth-first traversal.
      static <V,​E extends GEdge<V>>
      java.util.List<V>
      preOrder​(GDirectedGraph<V,​E> g)
      Returns the vertices of the given graph in pre-order, which is the order the vertices are encountered when performing a depth-first traversal.
      static <V,​E extends GEdge<V>>
      java.util.List<V>
      preOrder​(GDirectedGraph<V,​E> g, GraphNavigator<V,​E> navigator)
      Returns the vertices of the given graph in pre-order, which is the order the vertices are encountered when performing a depth-first traversal.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • postOrder

        public static <V,​E extends GEdge<V>> java.util.List<V> postOrder​(GDirectedGraph<V,​E> g)
        Returns the vertices of the given graph in post-order, which is the order the vertices are last visited when performing a depth-first traversal.
        Parameters:
        g - the graph
        Returns:
        the vertices in post-order
      • postOrder

        public static <V,​E extends GEdge<V>> java.util.List<V> postOrder​(GDirectedGraph<V,​E> g,
                                                                               GraphNavigator<V,​E> navigator)
        Returns the vertices of the given graph in post-order, which is the order the vertices are last visited when performing a depth-first traversal.
        Parameters:
        g - the graph
        navigator - the knower of the direction the graph should be traversed
        Returns:
        the vertices in post-order
      • preOrder

        public static <V,​E extends GEdge<V>> java.util.List<V> preOrder​(GDirectedGraph<V,​E> g)
        Returns the vertices of the given graph in pre-order, which is the order the vertices are encountered when performing a depth-first traversal.
        Parameters:
        g - the graph
        Returns:
        the vertices in pre-order
      • preOrder

        public static <V,​E extends GEdge<V>> java.util.List<V> preOrder​(GDirectedGraph<V,​E> g,
                                                                              GraphNavigator<V,​E> navigator)
        Returns the vertices of the given graph in pre-order, which is the order the vertices are encountered when performing a depth-first traversal.
        Parameters:
        g - the graph
        navigator - the knower of the direction the graph should be traversed
        Returns:
        the vertices in pre-order