I have been trying to run this query as recommended in the neo4j google group and in other sources online:
START n = node(*) MATCH n-[r?]-() WHERE ID(n)>0 DELETE n, r;>
According to neo4j documentation, the deletion of a graph isa done through:
MATCH (n)
OPTIONAL MATCH (n)-[r]-()
DELETE n,r;
To avoid the java heap space error, I conbined this code with LIMIT:
MATCH (n)
OPTIONAL MATCH (n)-[r]-()
WITH n,r LIMIT 100000 DELETE n,r;
It works to reduce node number and eventually lets use the first, recomended and more general code.