Package org.apache.calcite.util.graph
Class DepthFirstIterator<V,E extends DefaultEdge>
- java.lang.Object
-
- org.apache.calcite.util.graph.DepthFirstIterator<V,E>
-
- Type Parameters:
V
- Vertex typeE
- Edge type
- All Implemented Interfaces:
java.util.Iterator<V>
public class DepthFirstIterator<V,E extends DefaultEdge> extends java.lang.Object implements java.util.Iterator<V>
Iterates over the vertices in a directed graph in depth-first order.
-
-
Constructor Summary
Constructors Constructor Description DepthFirstIterator(DirectedGraph<V,E> graph, V start)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static <V,E extends DefaultEdge>
java.util.List<V>buildList(DirectedGraph<V,E> graph, V start)
private static <V,E extends DefaultEdge>
voidbuildListRecurse(java.util.Collection<V> list, java.util.Set<V> activeVertices, DirectedGraph<V,E> graph, V start)
boolean
hasNext()
V
next()
static <V,E extends DefaultEdge>
java.lang.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.static <V,E extends DefaultEdge>
voidreachable(java.util.Collection<V> list, DirectedGraph<V,E> graph, V start)
Populates a collection with the nodes reachable from a given node.void
remove()
-
-
-
Field Detail
-
iterator
private final java.util.Iterator<V> iterator
-
-
Constructor Detail
-
DepthFirstIterator
public DepthFirstIterator(DirectedGraph<V,E> graph, V start)
-
-
Method Detail
-
buildList
private static <V,E extends DefaultEdge> java.util.List<V> buildList(DirectedGraph<V,E> graph, V start)
-
of
public static <V,E extends DefaultEdge> java.lang.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(java.util.Collection<V> list, DirectedGraph<V,E> graph, V start)
Populates a collection with the nodes reachable from a given node.
-
buildListRecurse
private static <V,E extends DefaultEdge> void buildListRecurse(java.util.Collection<V> list, java.util.Set<V> activeVertices, DirectedGraph<V,E> graph, V start)
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<V>
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<V>
-
-