Reputation: 3347
Say I have the following graph
(:A) -> (:B) -> (:C) -> (:D)
\ ^
\ |
-> (:X) -> (:Y)
Now from A to D, there are two paths
(:A) -> (:B) -> (:C) -> (:D)
and
(:A) -> (:X) -> (:Y) -> (:C) -> (:D)
I can use the query below to return the two path
MATCH p1 = ((:A)-[*]-(:Z))
return p1
But say I only want to see path that does not contain node type X. What query can I use?
Upvotes: 0
Views: 196
Reputation: 5385
You can use the NONE() predicate function (see https://neo4j.com/docs/cypher-manual/current/functions/predicate/#functions-none)
MATCH p1 = ...
WHERE NONE(node IN nodes(p1) WHERE node:X)
Upvotes: 2