Delete all nodes and relationships in neo4j 1.8

I know that many people already ask this question.
for my research, some questions are asked here before

But still they can’t solve our problems,
we just want to remove the "ALL" nodes and relations "ALL"

enter image description here

suppose delete "ALL" can see that there are remaining 0 nodes 0 properties and 0 relationships

This is a screenshot that I took after performing the removal of "ALL" proposed by the forum

My question is still the same, how to remove all nodes and all relations in neo4j

+58
neo4j nosql relationship
Jan 10 '13 at 7:12
source share
4 answers

Starting from version 2.3.0

MATCH (n) DETACH DELETE n 

Docs

Pre 2.3.0

 MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r 

Docs

+162
Jan 25 '14 at 23:13
source share

you are probably doing it right, only the control panel shows only a higher identifier, and therefore the number of "active" nodes, relationships, although they are not. it is just informative.

to make sure you have an empty graph, run the following command:

 START n=node(*) return count(n); START r=rel(*) return count(r); 

if both give you 0, your delete was successful.

+6
Jan 10 '13 at 8:44
source share

for a large database, you must either delete the database from disk (after you stop the engine, as I assume), or use something like Cypher:

 MATCH (n) OPTIONAL MATCH (n)-[r]-() WITH n,r LIMIT 50000 DELETE n,r RETURN count(n) as deletedNodesCount 

see https://zoomicon.wordpress.com/2015/04/18/howto-delete-all-nodes-and-relationships-from-neo4j-graph-database/ for more information. I compiled this from various answers.

+3
Apr 25 '15 at 19:34
source share

He will do the trick.

 Match (n)-[r]-() Delete n,r; 
-one
Oct 13 '14 at 11:18
source share



All Articles