将 Neo4j 子图加载到 Networkx 中 [英] Loading a Neo4j subgraph into Networkx
问题描述
我一直在通过 python 的 Bulbflow 处理 Neo4j,现在需要一种方法来保存/导出子图.我已经看到 Java 甚至 Ruby 方法可以做到这一点,但是一个简单的 Python 方法似乎对我隐藏了..
I have been dealing with Neo4j through python's Bulbflow and now need a way to save/export subgraphs. I have seen Java and even Ruby approaches for doing this, however a simple Python approach seems to be hiding from me..
到目前为止,我发现了两条潜在的路径:
So far, I have found two potential paths:
通过 Geoff.html" rel="noreferrer">py2neo,但令人惊讶的是,从大型本地 Neo4j 数据库或 neo4jserver 中提取子图的文档很少.
Accessing Geoff through py2neo, but there is surprisingly little documentation for extracting a subgraph from a big local neo4j database or from a neo4jserver.
使用 Networkx:我发现 networkx 可以从许多不同的格式加载图形(我不确定 neo4j 存储哪种格式的 dbs),但是我还没有找到一种方法来将一个子图提取到 Networkx 中.我认为这应该通过 gremlin 查询来完成,但我不确定如何去做.
Using Networkx: I found networkx can load graphs from many different formats (I am unsure which format neo4j stores their dbs), however I haven't found a way to extract a only a subgraph into Networkx. I assume this should be done from a gremlin query, but I'm not sure how to go about this.
我更喜欢 Networkx 路径,因为它还带有我希望应用于子图的网络分析算法.我觉得这也可以避免 Bulbflow 和 py2neo 之间的潜在冲突,尽管我不确定是否会存在这种冲突.
I have a preference for the Networkx path, as it also comes with network analysis algorithms I wish to apply to subgraphs. I feel it would also avoid potential clashes between Bulbflow and py2neo, although I'm not sure whether such a clash would exist.
任何建议将不胜感激!
提前致谢
推荐答案
在你问之前我不知道答案,但似乎你可以用 gml 导出,networkx 可以读取.以下是一些可能有用的答案:
I didn't know the answer until you asked, but it seems like you can just export in gml, which networkx can read. Here are a few answers that might be useful:
https://github.com/tinkerpop/gremlin/wiki/Gremlin-Methods
希望有所帮助.
这篇关于将 Neo4j 子图加载到 Networkx 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!