Storing a Networkx DiGraph to a Neo4j database

715 views
Skip to first unread message

Athanasios Anastasiou

unread,
Jul 28, 2013, 4:23:14 PM7/28/13
to networkx...@googlegroups.com
Hello everyone

In case anyone else is interested in something like this too, here is a little routine that will store a Networkx DiGraph to a Neo4j graph database.

https://gist.github.com/aanastasiou/6099561


The routine doesn't handle the actual communication with the server (there are other modules to do that) but it simply generates a Cypher query (Neo4j's query language) that can re-create the graph in some Neo4j database. (It therefore is closer to something like "networkx.write_neo4j_cypher" )

The example included in the above GIST will generate a file which can then be sent to the server via the "neo4j-shell" client application but once the query is constructed it could be sent to the server via any other means (for example the Python Neo4j REST client https://neo4j-rest-client.readthedocs.org/en/latest/info.html).

This emerged out of a need to generate incrasingly more complex graphs (than what would be manually possible) to be able to test various different forms of Cypher queries for querying for specific paths in a graph.

All the best
Athanasios Anastasiou

Adam Lawrence

unread,
Jun 30, 2016, 3:09:12 PM6/30/16
to networkx-discuss
fantastic!
Reply all
Reply to author
Forward
0 new messages