public class DFSPathFinder<T> extends ArrayList<T>
This class follows the outNodes of the graph nodes to define the graph, but this behavior can be changed by overriding the getConnected method.
| Modifier and Type | Field and Description |
|---|---|
protected Graph<T> |
G
The graph to search
|
protected Map<Object,Iterator<? extends T>> |
pendingChildren
An iterator of child nodes for each node being searched
|
static long |
serialVersionUID |
modCount| Constructor and Description |
|---|
DFSPathFinder(Graph<T> G,
Iterator<T> nodes,
Predicate<T> f)
Construct a depth-first enumerator across the (possibly improper) subset of nodes reachable
from the nodes in the given enumeration.
|
DFSPathFinder(Graph<T> G,
T N,
Predicate<T> f)
Construct a depth-first enumerator starting with a particular node in a directed graph.
|
| Modifier and Type | Method and Description |
|---|---|
protected List<T> |
currentPath() |
List<T> |
find() |
protected Iterator<? extends T> |
getConnected(T n)
get the out edges of a given node
|
protected Iterator<? extends T> |
getPendingChildren(T n)
Method getPendingChildren.
|
boolean |
hasNext()
Return whether there are any more nodes left to enumerate.
|
protected void |
setPendingChildren(T v,
Iterator<? extends T> iterator)
Method setPendingChildren.
|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streampublic static final long serialVersionUID
public DFSPathFinder(Graph<T> G, T N, Predicate<T> f) throws IllegalArgumentException
G - the graph whose nodes to enumerateIllegalArgumentException - if G is nullpublic List<T> find()
public boolean hasNext()
protected Iterator<? extends T> getPendingChildren(T n)
protected void setPendingChildren(T v, Iterator<? extends T> iterator)