Finding none existing realtionships between nodes

cypher

(Andersoxie) #1

I have two types of nodes that most often has a relation but not always. I would like to find the nodes that does not have a relation.

Something like:

MATCH (x:LABEL1 ) -[y:LABEL3]-> (z:LABEL2) WHERE y is not existing


(Mark Needham) #2

You could write this:

MATCH (x:LABEL1 ) 
where not ((x)-[:LABEL3]->(:LABEL2))
RETURN x