red-devil
red-devil

Reputation: 1103

Data Analytics with Neo4j

I want to integrate my Neo4j graph database on Rails app with GraphLab for data analytics. Is it possible to integrate GraphLab directly without explicitly taking out the database snapshots?

Are there any other tools that can be easily integrated with Neo4j for the same?

If not possible, then the concern is that Neo4j doesn't allow to export data in csv format. While GraphLab only allows csv imports.

Upvotes: 1

Views: 636

Answers (1)

Zach
Zach

Reputation: 7940

If the graph is small enough to fit into RAM, you could do this import in a few steps:

  1. Use neo4j-shell-tools to export from neo4j to GraphML.
  2. Use NetworkX to import from GraphML to a NetworkX Graph object (let's call it g).
  3. Use a loop or list comprehension to add the vertices and edges from the NetworkX graph to a graphlab.SGraph (let's call it sg):

import graphlab sg = graphlab.SGraph() sg = sg.add_vertices([graphlab.Vertex(i) for i in g.nodes()]) sg = sg.add_edges([graphlab.Edge(*edge) for edge in g.edges()])

You could also use py2neo (as described in the comments above to query the graph) but instead of writing to CSV, directly build the SGraph from the queries, either using add_vertices and add_edges, or by building vertex/edge SFrames and then using those to construct the graph. This might be a faster solution for production (with no intermediate disk representation) and may also help get around the memory size limitation if your graph is larger than will fit in RAM.

Upvotes: 1

Related Questions