Database Reference
In-Depth Information
Pattern for relationships
Relationships can be of two types: unidirectional and bidirectional.
Unidirectional : This is defined using an arrow sign, with an arrow head defining
the direction of the relationship as shown in the following example:
(n)-->(n1)
This example defines a relationship between n and n1 , which starts from node n
and ends at node n1 .
Bidirectional : This is defined using an arrow sign with NO arrow head as shown
in the following example:
(n)--(n1)
This example defines a relationship between n and n1 , which can flow from either
end.
As with nodes, relationships can also have names or identifiers. Names or identifiers for re-
lationships are defined in a pair of square brackets as follows:
(n)-[r]->(n1)
(n)-[r]-(n1)
We can also define one or more than one relationship in a pattern:
(n)-[r:REL_TYPE]->(n1)
(n)-[r:REL_TYPE | REL_TYPE]-(n1)
As we do in nodes, we can also omit the names or identifiers in relationships:
(n)-[:REL_TYPE]->(n1)
(n)-[]-(n1)
Search WWH ::




Custom Search