T
- the type of node in the graphpublic class AcyclicDepthFirstPostOrderTraversal<T> extends Object
If a cycle is encountered, a CycleException
is thrown by traverse(Iterable)
.
Constructor and Description |
---|
AcyclicDepthFirstPostOrderTraversal(GraphTraversable<T> traversable) |
Modifier and Type | Method and Description |
---|---|
Iterable<T> |
traverse(Iterable<? extends T> initialNodes) |
Iterable<T> |
traverse(Iterable<? extends T> initialNodes,
java.util.function.Predicate<T> shouldExploreChildren)
Performs a depth-first, post-order traversal over a DAG.
|
public AcyclicDepthFirstPostOrderTraversal(GraphTraversable<T> traversable)
public Iterable<T> traverse(Iterable<? extends T> initialNodes) throws CycleException
CycleException
public Iterable<T> traverse(Iterable<? extends T> initialNodes, java.util.function.Predicate<T> shouldExploreChildren) throws CycleException
initialNodes
- The nodes from which to perform the traversal. Not allowed to contain
null
.shouldExploreChildren
- Whether or not to explore a particular node's children. Used to
support short circuiting in the traversal.CycleException
- if a cycle is found while performing the traversal.