Database Reference
In-Depth Information
The traversal description stays exactly the same as before, including NODE_PATH unique-
ness
. The only change is that you're returning paths instead of nodes from the tra-
versal
.
The console output of this code would look like this:
(Jane)--[KNOWS,0]-->(John)
(Jane)--[KNOWS,1]-->(Kate)<--[KNOWS,4]--(John)
This time it's clear why there were two john nodes as results previously—they're parts
of different paths, and these results illustrate that. Based on these results, Jane has two op-
tions:
• She can contact John, who knows Ben, directly.
• She can contact Kate, who can contact John. This could be a valid alternative if
Jane knows John only slightly, whereas Kate is her best friend and works with
John!
NODE_GLOBAL and NODE_PATH are the most typical uniqueness types used, but Neo4j
offers other uniqueness types that can be useful in some situations. We'll briefly introduce
other uniqueness types in the next section.
8.3.3. Other uniqueness types
NODE_GLOBAL and NODE_PATH are probably the two most common uniqueness types
for traversals. But for completeness, the Neo4j Traversal API includes six other types.
RELATIONSHIP_GLOBAL uniqueness states that each relationship in the graph can be
visited only once. If there are multiple relationships between nodes in a graph, each node
can be visited as many times as there are relationships that connect them.
RELATIONSHIP_PATH uniquenessissimilarto NODE_PATH uniquenessinthatrelation-
ships can be visited multiple times as long as the combination of relationships between the
starting node and the current node is unique. Nodes can be visited multiple times with this
uniqueness setting as well.
Search WWH ::




Custom Search