Cypher: Matching nodes at arbitrary depth via a strictly alternating set of relations
问题 I'm quite new to Cypher but struggling to find how to do this. I want to generalise the following so that it will match at an arbitrary depth. MATCH (:start)-[:a]-()-[:b]-(:end) //Depth1 MATCH (:start)-[:a]-()-[:b]-()-[:a]-()-[:b]-(:end) //Depth2 MATCH (:start)-[:a]-()-[:b]-()-[:a]-()-[:b]-()-[:a]-()-[:b]-(:end) //Depth3 MATCH (:start)-[:a]-()-[:b]-()-[:a]-()-[:b]-()-[:a]-()-[:b]-()-[:a]-()-[:b]-(:end) //Depth4 In other words, the path needs to pass through any number of a-node-b in strict