public class BFSIterator<T> extends Object implements Iterator<T>
| Constructor and Description |
|---|
BFSIterator(Graph<T> G)
Constructor DFSFinishTimeIterator.
|
BFSIterator(Graph<T> G,
Iterator<? extends T> nodes)
Construct a breadth-first enumerator across the (possibly improper) subset of nodes reachable
from the nodes in the given enumeration.
|
BFSIterator(Graph<T> G,
T N)
Construct a breadth-first iterator starting with a particular node in a directed graph.
|
| Modifier and Type | Method and Description |
|---|---|
protected Iterator<? extends T> |
getConnected(T n)
get the out edges of a given node
|
boolean |
hasNext()
Return whether there are any more nodes left to enumerate.
|
T |
next()
Find the next graph node in discover time order.
|
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic BFSIterator(Graph<T> G, T N)
G - the graph whose nodes to enumerateIllegalArgumentException - if G is nullpublic BFSIterator(Graph<T> G, Iterator<? extends T> nodes)
nodes - the set of nodes from which to start searchingIllegalArgumentException - if G is nullpublic BFSIterator(Graph<T> G) throws NullPointerException
NullPointerException - if G is nullpublic boolean hasNext()
public T next() throws NoSuchElementException
next in interface Iterator<T>NoSuchElementExceptionprotected Iterator<? extends T> getConnected(T n)
n - the node of which to get the out edgespublic void remove()
throws UnimplementedError
remove in interface Iterator<T>UnimplementedError