0
votes

Is there any convenient way to export Neo4j data to csv or GML(for import into Gephi)? I tried to use Gremlin with these command:

g = new Neo4jGraph('~/Documents/neo4j-community-1.9.1/data/graph.db');
g.saveGraphML('Mygraph.xml');

but it returns "null"

I'm not sure what happened exactly... I've got 2 million nodes and 5 million edges in neo4j database,btw.

I know that I can full import Neo4j into Gephi with neo4j-plugin, but maybe the size is too large for that way.. Gephi would hangs when it imported about 300 thousand nodes..

it would be appreciated if any help. Thanks.

2
I wrote some helper commands for the neo4j-shell, the cypher-import command can also export to CSV github.com/jexp/neo4j-shell-tools#cypher-importMichael Hunger

2 Answers

2
votes

You can use the following cypher:

 CALL apoc.export.graphml.all('graph.graphml', {useTypes:true, storeNodeIds:false})

You will find the GraphML in the import folder of your database. Gephi, yEd, Cytoscape all can import GraphML. Whether millions and billions is possible is another matter of course. Whether it makes sense to visualize millions of nodes is also questionable.

Note that APOC is not installed by default with Neo4j, see the Github repo for more information.

0
votes

Perhaps you should see this question/comments:

error while exporting neo4j to Graphml

I'm assuming that you are getting a "null" in this way from the console which is to be expected. Make sure that you have your Neo4jGraph instances pointed at the correct data directory as well.

You can also write to csv with something like:

http://gremlindocs.com/#recipes/writing-to-file