Search code examples
neo4jcypher

What is the name of this feature in cypher that allows depth matching rules in a path match statement? Where is the documentation?


I am having a hard time identifying the rules around this syntax, I see it and kind of understand it, but would like to find the documentation. I'm not sure how to google it though.

match (g:Group)<-[*1..2]-(s)
                   ^^^^
                   ^^^^ I would like to know more about this rule that limits path length

I understand that the above says "I only want to find paths that are between 1 and 2 edge traversals long", and it it really is that simple that's great; but I as I understand it the use of a star makes it a wildcard on which edges it can follow, while [:EdgeTypeIWant1..2] doesn't appear to be correct syntax. I probably have other questions as well that proper documentation (if I could find it) would be helpful with.


Solution

  • They are called variable length patterns.

    The star is only an indicator that you're specifying a pattern of variable length, it's not a wildcard.

    Your syntax would be: [:EdgeTypeIWant*1..2]