public class BFSPathFinder<T> extends Object
This class follows the outNodes of the graph nodes to define the graph, but this behavior can be changed by overriding the getConnected method.
TODO: if finding many paths, use a dynamic programming algorithm instead of calling this repeatedly.
| Constructor and Description |
|---|
BFSPathFinder(Graph<T> G,
Iterator<T> nodes,
Predicate<T> f)
Construct a breadth-first enumerator across the (possibly improper) subset of nodes reachable
from the nodes in the given enumeration.
|
BFSPathFinder(Graph<T> G,
Iterator<T> sources,
T target)
Construct a breadth-first enumerator starting with any of a set of nodes in a directed graph.
|
BFSPathFinder(Graph<T> G,
T src,
Iterator<T> targets)
Construct a breadth-first enumerator starting with a particular node in a directed graph.
|
BFSPathFinder(Graph<T> G,
T N,
Predicate<T> f)
Construct a breadth-first enumerator starting with a particular node in a directed graph.
|
BFSPathFinder(Graph<T> G,
T src,
T target)
Construct a breadth-first enumerator starting with a particular node in a directed graph.
|
| Modifier and Type | Method and Description |
|---|---|
List<T> |
find() |
protected Iterator<? extends T> |
getConnected(T n)
get the out edges of a given node
|
public BFSPathFinder(Graph<T> G, T N, Predicate<T> f)
G - the graph whose nodes to enumeratepublic BFSPathFinder(Graph<T> G, T src, T target) throws IllegalArgumentException
G - the graph whose nodes to enumerateIllegalArgumentException - if G is nullpublic BFSPathFinder(Graph<T> G, T src, Iterator<T> targets)
G - the graph whose nodes to enumeratepublic BFSPathFinder(Graph<T> G, Iterator<T> sources, T target)
G - the graph whose nodes to enumerate