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
GraphAcademy
CUP
Learn graphs.
Score for your country.
Represent your country in the GraphAcademy Cup.
Complete courses, earn points, and win weekly prizes.
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
You could write this:
MATCH (x:LABEL1 )
where not ((x)-[:LABEL3]->(:LABEL2))
RETURN x
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Query to get nodes who don't have any relationships? | 4 | 168 | September 16, 2022 | |
| Filter nodes based on relationships property and if property does not exist return all the nodes | 1 | 876 | July 6, 2020 | |
| Looking for nodes without a specific relation | 7 | 35829 | December 4, 2020 | |
| Match relationships if a certain parameter exists | 2 | 397 | September 17, 2020 | |
| WHERE NOT query not working as expected to find nodes without a specific type of relationship | 5 | 1683 | April 2, 2021 |