I am toying with neo4j and noticed that all Cypher queries need a starting point in the START
clause.
I was wondering how can I find all disconnected nodes using Cypher ?
thanks
If all your nodes are indexed (e.g. via auto-indexing) you could use an index query as a start point and then find those nodes that have no outgoing relationships.
start n=node:node_auto_index("id:*")
match n-[r?]->m
where r is null
return n
Nowadays I would rather use:
start n=node:node_auto_index("id:*")
where not (n-->m)
return n
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With