I have a situation where I am looking for paths of the form (:A|B)-[:REL]->(A|B)-[:REL]-> ... -[:REL]->(A|B).
That is, the paths go through nodes with label A or B.
Specifically, if the path is only A nodes, then it can be included in the result set....
I'm new to Neo4j, but I have read the O'Reilly book and some of the Cypher manual. I am familiar with Graphs in general (from a mathematical perspective). I am getting confused with the basics of traversal performance in Neo4j.
Thank you! I was getting myself in a total muddle.
You actually made me realise I could simplify your example a bit;
match p = (x)-[:REL*1..]->(y)
where (x:A or x:B) and (y:A or y:B)
with x, y, [n in nodes(p) where 'B' in labels(n)] as b_nodes