Class DepthFirstIterator<V,E extends DefaultEdge>

Type Parameters:
V - Vertex type
E - Edge type
All Implemented Interfaces:

public class DepthFirstIterator<V,E extends DefaultEdge> extends Object implements Iterator<V>
Iterates over the vertices in a directed graph in depth-first order.
  • Constructor Details

    • DepthFirstIterator

      public DepthFirstIterator(DirectedGraph<V,E> graph, V start)
  • Method Details

    • of

      public static <V, E extends DefaultEdge> Iterable<V> of(DirectedGraph<V,E> graph, V start)
      Creates an iterable over the vertices in the given graph in a depth-first iteration order.
    • reachable

      public static <V, E extends DefaultEdge> void reachable(Collection<V> list, DirectedGraph<V,E> graph, V start)
      Populates a collection with the nodes reachable from a given node.
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<V>
    • next

      public V next()
      Specified by:
      next in interface Iterator<V>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<V>