I have a fairly large data set (20 million nodes, 200 million edges), the simplest shortestPath requests complete in milliseconds, everything is fine.
But ... I need to allow shortestPath to have a ZERO or ONE relation of type 999 and it can only be the first one from the beginning of the node.
So my query became something like this:
MATCH (one:Obj{oid:'startID'})-[r1*0..1]-(b:Obj)
WHERE all(rel in r1 where rel.val = 999)
WITH one, b
MATCH (two:Obj{oid:'endID'}), path=shortestPath((one) -[0..21]-(two))
WHERE ALL (x IN RELATIONSHIPS(path)
WHERE (x.val > -1 and x.val<101) or (x.val=999 or x.val=998)) return path
it starts in milliseconds when there is a short path (up to 2-4), but it can take 5 or 20 seconds for paths like 5 ++. Maybe I wrote an inefficient request?
This question will be asked if available.
source
share