Class TraversalResult<V,R>
- Type Parameters:
V- the node typeR- the result type produced by theEvaluator
Instances are created by Traversals; there is no public constructor. All three
accessors return unmodifiable views.
-
Method Summary
-
Method Details
-
visited
The nodes that were visited, in the order they were visited.No node appears twice: the traversal keeps a visited set.
- Returns:
- the visited nodes, in visit order
-
results
The results theEvaluatorproduced, in visit order.Nodes for which the evaluator returned
Optional.empty()are absent, so this list may be shorter thanvisited(). For the traversals that take no evaluator, each node evaluates to itself and this list equalsvisited().- Returns:
- the results, in visit order
-
cameFrom
Which node each node was first reached from.The start node is absent, having been reached from nowhere. The map records first discovery: a node reached again by a longer route keeps its original predecessor.
This map is always empty for
Traversals.traverseTree(Object, NeighbourFunction, NeighbourFunction, Order), because the traversal engine does not record came-from for a tree — the parent of each node is already known from the tree's own shape.- Returns:
- the predecessor map, empty if the traversal did not record one
-
toString
-