Class BoundedBFSIterator<T>
java.lang.Object
com.ibm.wala.util.graph.traverse.BoundedBFSIterator<T>
- All Implemented Interfaces:
Iterator<T>
This class implements breadth-first search over a Graph, returning an Iterator of the nodes of
the graph in order of discovery. This class follows the outNodes of the graph nodes to define the
graph, but this behavior can be changed by overriding the getConnected method.
This traversal only visits nodes within k hops of a root.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBoundedBFSIterator(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. -
Method Summary
Modifier and TypeMethodDescriptiongetConnected(T n) get the out edges of a given nodeintbooleanhasNext()Return whether there are any more nodes left to enumerate.next()Find the next graph node in discover time order.voidremove()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
G
-
-
Constructor Details
-
BoundedBFSIterator
Construct a breadth-first iterator starting with a particular node in a directed graph.- Parameters:
G- the graph whose nodes to enumerate- Throws:
IllegalArgumentException- if G is null
-
BoundedBFSIterator
Construct a breadth-first enumerator across the (possibly improper) subset of nodes reachable from the nodes in the given enumeration.- Parameters:
G- the graph whose nodes to enumeratenodes- the set of nodes from which to start searching- Throws:
IllegalArgumentException- if G is null
-
-
Method Details
-
hasNext
-
next
Find the next graph node in discover time order.- Specified by:
nextin interfaceIterator<T>- Returns:
- the next graph node in discover time order.
- Throws:
NoSuchElementException
-
getConnected
-
remove
- Specified by:
removein interfaceIterator<T>- Throws:
UnsupportedOperationException
-
getCurrentHops
public int getCurrentHops()- Returns:
- the currentHops
-