如何将_all_节点和所有关系从 Neo4j 导出到 Gephi?
How to export _all_ nodes and all relations from Neo4j into Gephi?
我打算将我的整个图(具有关系的节点和 "independent" 节点)导出到 Gephi。为了实现它,我目前执行两个查询:
// export relationships
match path = (n)--()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
// export independent nodes
match path = (p)
where not (p)--()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
我尝试用一个查询来替换它们,例如:
match path = (n)-[*0..]-()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
不幸的是,查询从未完成并且有效地拒绝了 Neo4j(导致 CPU 和 Neo4j 端的 RAM 消耗高,并使其无响应)。
我也曾尝试用 [*0..10]
限制关系深度,但没有用。
使用单个查询导出数据的正确方法是什么?
我会在你的情况下尝试以下...
match path = (n)-[*0..1]->()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
因此我们添加了关系的方向并限制为仅 1 跳。这样我们就可以删除导出重复项并加快导出速度。
我打算将我的整个图(具有关系的节点和 "independent" 节点)导出到 Gephi。为了实现它,我目前执行两个查询:
// export relationships
match path = (n)--()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
// export independent nodes
match path = (p)
where not (p)--()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
我尝试用一个查询来替换它们,例如:
match path = (n)-[*0..]-()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
不幸的是,查询从未完成并且有效地拒绝了 Neo4j(导致 CPU 和 Neo4j 端的 RAM 消耗高,并使其无响应)。
我也曾尝试用 [*0..10]
限制关系深度,但没有用。
使用单个查询导出数据的正确方法是什么?
我会在你的情况下尝试以下...
match path = (n)-[*0..1]->()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
因此我们添加了关系的方向并限制为仅 1 跳。这样我们就可以删除导出重复项并加快导出速度。