Reputation: 22171
Regarding this excerpt of cyper request:
(assuming element
is a known node variable in the whole request)
MATCH p = shortestPath(element-[:LINKS*..3]-(user))
RETURN length(p)
Assuming that one element
might be a user
, how could I prevent retrieving in the result the element
representing the user itself?
It would be cool if we could do:
MATCH p = shortestPath(element-[:LINKS*1..3]-(user))
RETURN length(p)
But it leads to this error:
shortestPath(...) does not support a minimal length
What is the most efficient way to achieve this trick?
Upvotes: 1
Views: 211
Reputation: 66989
How about this:
MATCH p = shortestPath((element)-[:LINKS*..3]-(user))
WHERE element <> user
RETURN length(p)
Upvotes: 5