将Neo4j子图加载到Networkx [英] Loading a Neo4j subgraph into Networkx

查看:677
本文介绍了将Neo4j子图加载到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:

  1. 通过 Geoff .html"rel =" noreferrer> py2neo ,但是令人惊讶的是,几乎没有任何文档可以从大型本地neo4j数据库或neo4jserver中提取子图.

  1. 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哪种格式存储了它们的数据库),但是我还没有找到一种仅将子图提取到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:

Neo4j导出树

将Neo4j DB转换为XML?

https://github.com/tinkerpop/gremlin/wiki/Gremlin-Methods

希望有帮助.

这篇关于将Neo4j子图加载到Networkx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆