V
- Vertex typeE
- Edge typepublic class DepthFirstIterator<V,E extends DefaultEdge>
extends java.lang.Object
implements java.util.Iterator<V>
Constructor and Description |
---|
DepthFirstIterator(DirectedGraph<V,E> graph,
V start) |
Modifier and Type | Method and Description |
---|---|
private static <V,E extends DefaultEdge> |
buildList(DirectedGraph<V,E> graph,
V start) |
private static <V,E extends DefaultEdge> |
buildListRecurse(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> |
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> |
reachable(java.util.Collection<V> list,
DirectedGraph<V,E> graph,
V start)
Populates a collection with the nodes reachable from a given node.
|
void |
remove() |
private final java.util.Iterator<V> iterator
public DepthFirstIterator(DirectedGraph<V,E> graph, V start)
private static <V,E extends DefaultEdge> java.util.List<V> buildList(DirectedGraph<V,E> graph, V start)
public static <V,E extends DefaultEdge> java.lang.Iterable<V> of(DirectedGraph<V,E> graph, V start)
public static <V,E extends DefaultEdge> void reachable(java.util.Collection<V> list, DirectedGraph<V,E> graph, V start)
private static <V,E extends DefaultEdge> void buildListRecurse(java.util.Collection<V> list, java.util.Set<V> activeVertices, DirectedGraph<V,E> graph, V start)
public boolean hasNext()
hasNext
in interface java.util.Iterator<V>
public void remove()
remove
in interface java.util.Iterator<V>
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.