Nodes without any properties


I habe found how to query for nodes without labels, but how do I have to write a query for all the nodes in the database that do not have any property and/or any relationship?

The background of my question: I have imported a CSV but due to misspelling in the Cypher-statement, I have created 20.000 „empty“ nodes without a label and without properties. I know how to find the ones without label, but Before deleting them I want to make sure that these are also the ones without properties and relationships.

Thank you,


nodes with no relationships is

match (n) where size (  (n)-[r]-() ) = 0 return n;

nodes with no properties :thinking:

TESTED ON Neo4j 4.2.2

MATCH (n) WHERE size((n--())) = 0 AND properties(n) = {} AND labels(n) =

As the function properties will always return the properties map of a node or relation, you will get an empty map for those who don't have any properties. Same for labels except that the return object is an empty list.

This query is not looking for the nodes without labels:


Thank you both, basically these are the solutions, but slightly different:

This is for the nodes without relationships:

MATCH (n) WHERE size (  (n)-[]-() ) = 0 RETURN n;

So, it’s square brackets for the relationship and no r within.

And this is for the nodes without labels:

MATCH (n) WHERE size(labels(n)) = 0 RETURN n

And this is for nodes without labels and without properties:

MATCH (n) WHERE size(labels(n)) = 0 AND properties(n) = {} RETURN n

THX again for your quick answers,


1 Like