I am using a query like
MATCH p=((:Start)-[:NEXT*..100]->(n))
WHERE ALL(node IN nodes(p) WHERE ...)
WITH DISTINCT n WHERE (n:RELEVANT)
...
RETURN n.someprop;
Where I want the results to be ordered by natural ordering, arising from the direction of the relationship -[:NEXT]->. But WITHin the third line takes this ordering. The problem is that I need to 1. filter for nodes :RELEVANTand 2. receive only different such nodes.
Is there a way to keep order? Maybe assign the order of numbers on the path and reuse it later with ORDER BY? I don’t know how to do it.
source
share