Database Reference
In-Depth Information
Collision evaluator —Each time the start-side and end-side traversals collide, you
have a potential solution of the traversal. The collision evaluator allows you to de-
termine if the solution should be included in the traversal end result.
Side selector —This component determines how quickly you should move the tra-
verser on each side. The alternating side selector is the most commonly used; it
alternates between moving the start-side and end-side traversals one step at a time.
ThefollowinglistingshowstheimplementationofabidirectionaltraverserusingtheNeo4j
Traversal API.
Listing 8.9. Bidirectional traversal that finds paths between two users in a social network
To initiate the bidirectional traversal description, you use the static helper method
Traversal.bidirectionalTraversal() , which is similar to the regular tra-
versal initialization
. Next, you set the traversal description for the outgoing direction
. Use the standard one-directional Traversal API to create the
BidirectionalTraversal-Description and follow the KNOWS relationships
with NODE_PATH uniqueness.
Search WWH ::




Custom Search