public class BoundedBFSIterator<T> extends Object implements Iterator<T>
Constructor and Description |
---|
BoundedBFSIterator(Graph<T> G,
Iterator<? extends T> nodes,
int k)
Construct a breadth-first enumerator across the (possibly improper) subset of nodes reachable from the nodes in the given
enumeration.
|
BoundedBFSIterator(Graph<T> G,
T N,
int k)
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
|
int |
getCurrentHops() |
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, wait
forEachRemaining
public BoundedBFSIterator(Graph<T> G, T N, int k)
G
- the graph whose nodes to enumerateIllegalArgumentException
- if G is nullpublic BoundedBFSIterator(Graph<T> G, Iterator<? extends T> nodes, int k)
G
- the graph whose nodes to enumeratenodes
- the set of nodes from which to start searchingIllegalArgumentException
- if G is nullpublic boolean hasNext()
public T next() throws NoSuchElementException
next
in interface Iterator<T>
NoSuchElementException
protected Iterator<? extends T> getConnected(T n)
n
- the node of which to get the out edgespublic void remove() throws UnsupportedOperationException
remove
in interface Iterator<T>
UnsupportedOperationException
Iterator.remove()
public int getCurrentHops()