Package org.neo4j.graphdb.traversal
Interface BidirectionalTraversalDescription
public interface BidirectionalTraversalDescription
Represents a description of a bidirectional traversal. A Bidirectional
traversal has a start side and an end side and an evaluator to handle
collisions between those two sides, collisions which generates paths
between start and end node(s).
A
BidirectionalTraversalDescription
is immutable and each
method which adds or modifies the behavior returns a new instances that
includes the new modification, leaving the instance which returns the new
instance intact.
The interface is still experimental and may still change significantly.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncollisionEvaluator
(Evaluator collisionEvaluator) Sets theEvaluator
to use for branch collisions.collisionEvaluator
(PathEvaluator collisionEvaluator) Sets thePathEvaluator
to use for branch collisions.collisionPolicy
(BranchCollisionPolicy collisionDetection) Sets the collision policy to use during this traversal.endSide
(TraversalDescription endSideDescription) Sets the end sideTraversalDescription
of this bidirectional traversal.mirroredSides
(TraversalDescription sideDescription) Sets both the start side and end side of this bidirectional traversal, thestart side
is assigned thesideDescription
and theend side
is assigned the same description, althoughreversed
.sideSelector
(SideSelectorPolicy sideSelector, int maxDepth) In a bidirectional traversal the traverser alternates which side (start or end) to move further for each step.startSide
(TraversalDescription startSideDescription) Sets the start sideTraversalDescription
of this bidirectional traversal.Traverse between a set ofstart
andend
nodes with all applied rules and behavior in this traversal description.Traverse between a givenstart
andend
node with all applied rules and behavior in this traversal description.
-
Method Details
-
startSide
Sets the start sideTraversalDescription
of this bidirectional traversal. The point of a bidirectional traversal is that the start and end side will meet (or collide) in the middle somewhere and generate paths evaluated and returned by this traversal.- Parameters:
startSideDescription
- theTraversalDescription
to use for the start side traversal.- Returns:
- a new traversal description with the new modifications.
-
endSide
Sets the end sideTraversalDescription
of this bidirectional traversal. The point of a bidirectional traversal is that the start and end side will meet (or collide) in the middle somewhere and generate paths evaluated and returned by this traversal.- Parameters:
endSideDescription
- theTraversalDescription
to use for the end side traversal.- Returns:
- a new traversal description with the new modifications.
-
mirroredSides
Sets both the start side and end side of this bidirectional traversal, thestart side
is assigned thesideDescription
and theend side
is assigned the same description, althoughreversed
. This will replace any traversal description previously set bystartSide(TraversalDescription)
orendSide(TraversalDescription)
.- Parameters:
sideDescription
- theTraversalDescription
to use for both sides of the bidirectional traversal. The end side will have itreversed
- Returns:
- a new traversal description with the new modifications.
-
collisionPolicy
Sets the collision policy to use during this traversal. Branch collisions happen betweenTraversalBranch
es where start and end branches meet andPath
s are generated from it.- Parameters:
collisionDetection
- theBranchCollisionPolicy
to use during this traversal.- Returns:
- a new traversal description with the new modifications.
-
collisionEvaluator
Sets theEvaluator
to use for branch collisions. The outcome returned from the evaluator affects the colliding branches.- Parameters:
collisionEvaluator
- theEvaluator
to use for evaluating branch collisions.- Returns:
- a new traversal description with the new modifications.
-
collisionEvaluator
Sets thePathEvaluator
to use for branch collisions. The outcome returned from the evaluator affects the colliding branches.- Parameters:
collisionEvaluator
- thePathEvaluator
to use for evaluating branch collisions.- Returns:
- a new traversal description with the new modifications.
-
sideSelector
In a bidirectional traversal the traverser alternates which side (start or end) to move further for each step. This sets theSideSelectorPolicy
to use.- Parameters:
sideSelector
- theSideSelectorPolicy
to use for this traversal.maxDepth
- optional max depth parameter to the side selector. Why is max depth a concern of theSideSelector
? Because it has got knowledge of both the sides of the traversal at any given point.- Returns:
- a new traversal description with the new modifications.
-
traverse
Traverse between a givenstart
andend
node with all applied rules and behavior in this traversal description. ATraverser
is returned which is used to step through the graph and getting results back. The traversal is not guaranteed to start before the Traverser is used. -
traverse
Traverse between a set ofstart
andend
nodes with all applied rules and behavior in this traversal description. ATraverser
is returned which is used to step through the graph and getting results back. The traversal is not guaranteed to start before the Traverser is used.- Parameters:
start
- set of nodes to use as starting points for the start side in this traversal.end
- set of nodes to use as starting points for the end side in this traversal.- Returns:
- a
Traverser
used to step through the graph and to get results from.
-