Created
April 11, 2013 18:52
-
-
Save tirthb/5366126 to your computer and use it in GitHub Desktop.
Neo4j cypher query to remove orphan nodes i.e. nodes with no relationships
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
START n=node(*) | |
WHERE not(n-[*..2]-()) | |
DELETE n; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a version where you can exclude some labels that are allowed to be orphans