I want to perform a shortest path query like the following:
START source=node:myIndex(name="<src>"), destination=node:myIndex(name = "<dst>")
MATCH p = shortestPath(source-[:REL1*..5]-destination),
source-[sourceRel:REL1]-m,
destination-[destRel:REL1]-k
WHERE sourceRel.a=<someValue> and destRel.a=<someOtherValue>
RETURN NODES(p);
I want to get the shortest path between <src>
and <dst>
with the constraint that the property a
has a certain value on the first relationship from src and dst respectively to the next node.
However, neo4j just returns any shortest path it finds without taking into account my constraint. What am I doing wrong? What is the correct way to specify constraints on the first "hop" of a shortest path for a shortest path query?
edit: I'm using Neo4j 1.8.2.