4
votes

I have seen different versions of "linking" in Cypher for example:

  1. match (n)-[r]-() delete, n, r
  2. merge (n) -[:TO {dist:line.distance}] -> (m)
  3. match (n:MyNode)-[r:TO]->(m) where not ((m)-->())

where these links can be assigned using 1) "-", 2) "->" 3) "-->", I was wondering what the difference between these three types are. In these different contexts, I see that they are used differently but was wondering if there was a general rule for understanding this.

1

1 Answers

8
votes
  1. (n)-[r]-() means that you do not care about the directionality of the relationship r.

  2. (n)-[r]->(m) means that the relationship r must be directed from n to m.

  3. (n)-->(m) means that you do not want to qualify the relationship pattern (e.g., specify a type) nor get any data from the relationship via an identifier (e.g., r).

You can read the documentation to get more informtion.