I'll try to describe these parts to the best of my ability.
- As to the difference between
PathExpander
andBranchOrderingPolicy
: aPathExpander
is invoked for each traversal branch the first time the traversal continues from that branch. (A traversal branch is a node including the path leading up to that node, note that there may be many paths, i.e. many branches to the same node, mostly depending on uniqueness). The result of invoking thePathExpander
is anIterator<Relationship>
which will lazily provide new relationships off of that traversal branch when needed. That brings us toBranchOrderingPolicy
which looks at all alive traversal branches. By "alive" I mean a branch that has one or more relationships on it such that more branches can be created from it. Given all alive branches it picks one of them, following its next relationship (retreived from the relationship iterator on that branch, potentially if it's the first call initializes that iterator using thePathExpander
(as described above). - Difference between
PathExpander
andEvaluator
: that split is very much a matter of convenience and separation of concerns.PathExpander
grows the number of branches andEvaluator
filters, i.e. reduces the number of branches. An expander creates new branches that are evaluated by theEvaluator
. With that said you can write aPathExpander
that does both those things and it could be more efficient doing so. But the convenience of having them separated, where there can be multipleEvaluator
s is quite useful. - See above (1)
- Some of this is described in (1), but a broader picture would be that the
BranchOrderingPolicy
is the driver in the traversal - out of every alive branch it picks one and follows it one relationship out to a new branch. Only branches that comply with the selected uniqueness will be created. The relationships for a branch are retreived on the first time this happens for every branch, in the form of a lazy relationship iterator using thePathExpander
. New branches get evaluated the first time they are selected where one result of the evaluation is whether or not this branch is a dead end and the other is whether or not to include it in the result out to the user. - I think the above explains that
Is this sufficient information?