Database Reference
In-Depth Information
8.3. Managing uniqueness
The uniqueness aspect of the traversal determines how many times you can visit a node
overthedurationofthetraversal.ThereareafewdifferentuniquenesssettingsintheNeo4j
Traversal API that you can apply to your traversals, and in this section we're going to
demonstratetheirusesandbehavior.Allavailableuniquenessoptionsareaccessibleascon-
stants in the Uniqueness class in the Neo4j Java library.
8.3.1. NODE_GLOBAL uniqueness
The most typical uniqueness setting in Neo4j traversals is NODE_GLOBAL . It basically
means that each node can be visited once and only once during the traversal.
Note
NODE_GLOBAL is the default traversal setting, so if you don't specify the uniqueness, this
setting will be applied to your traversals.
NODE_GLOBAL is a common requirement for traversals, so let's illustrate it with an ex-
ample. Let's look at a simple social network graph, with six nodes representing users, and
KNOWS relationships between users who know each other. Figure 8.5 illustrates this.
Search WWH ::




Custom Search