如何删除neo4j图中的所有关系?

时间:2022-04-08 18:04:51

I need to delete all relationships between all nodes. Is there any way to delete all relationships in the neo4j graph? Note that I am using ruby bindings - the neography gem. There is no info about that in the wiki of the gem. I've also tried to find a way to do it in the neo4j documentation without any result.

我需要删除所有节点之间的所有关系。有没有办法删除neo4j图中的所有关系?请注意,我正在使用ruby绑定 - neography gem。在gem的wiki中没有关于它的信息。我也试图在neo4j文档中找到一种方法,没有任何结果。

Neo4j version is 1.7.2.

Neo4j版本是1.7.2。

1 个解决方案

#1


23  

in cypher:

在密码中:

deleting all relationships:

删除所有关系:

start r=relationship(*) delete r;

creating all relationships between all nodes, i'd assume:

创建所有节点之间的所有关系,我假设:

start n=node(*),m=node(*) create unique n-[r:RELTYPE]-m;

but you rather dont want to have too many vertices, since it collapse on low memory (at least in my case i got 1mil vertices and 1gb ram)

但你宁愿不要有太多顶点,因为它在低内存上崩溃(至少在我的情况下我有1mil顶点和1gb ram)

#1


23  

in cypher:

在密码中:

deleting all relationships:

删除所有关系:

start r=relationship(*) delete r;

creating all relationships between all nodes, i'd assume:

创建所有节点之间的所有关系,我假设:

start n=node(*),m=node(*) create unique n-[r:RELTYPE]-m;

but you rather dont want to have too many vertices, since it collapse on low memory (at least in my case i got 1mil vertices and 1gb ram)

但你宁愿不要有太多顶点,因为它在低内存上崩溃(至少在我的情况下我有1mil顶点和1gb ram)