Reputation: 1103
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
Reputation: 7940
If the graph is small enough to fit into RAM, you could do this import in a few steps:
g
).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