I have large neo4j graph. Is there any way I can export it into edgelist format?
Any links or pointers to external utilities or libraries would also be very helpful.
There's a great article on how to use jq to produce csv output, see https://neo4j.com/blog/export-csv-from-neo4j-curl-cypher-jq/. I assume you can use the very same approach to generate edgelist.
Related
Is there a way to export the neo4j data to svg output like the one that appears on the neo4j browser so we can use it inside our application.
This question is with respect to neo4j gem in rails and anyother suggestions are also welcome
So the Neo4j browser application builds its own user interface (including SVG's) using the standard query data from the Neo4j javascript driver. The Neo4j database doesn't contain a build in way to export information as SVG. Nor should it. SVG graphics are a business decision. The way you'd like to visualize graph data in your app is unlikely to be the same way I want to visualize graph data. You'll need to build this functionality yourself.
Neo4j has an article on graph visualization which may help you implement this. I believe the Neo4j browser app makes use of the very popular (and open source) D3.js data visualization library for building its graph visualizations / SVGs.
https://neo4j.com/developer/guide-data-visualization/
The neo4j browser can be used to view and export the result of a cypher query as an image. Is there a way to do this using the REST/Java or any other API interface?
I can probably get the result as a Json and visualize the result using linkurious but the inbuilt neo4j visualization is better for my purpose.
Any ideas?
Thanks!
There are a large number of options. Coming at it from the REST API, there are a few client packages available. One is RNeo4j for R. The README for the package includes a section on visualization. See that here
We wanted find closest zip code for a given zip code. This is one of the simple usecase we wanted to address from a number of other use cases.
We come across Neo4j and other graph db which seem to be addressing the use cases what we had, I am new to Neo4j and exploring to further. However, i stuck at a point how to represent the nodes and veritces in neo4j to solve the above use cases.
Any help would be greatly appreciated
It depends what you mean by closest ZIP code and for which country you want to find that.
Usually ZIP codes or post codes represents hierarchy structure. Also they could be attached to specific post office. Some countries provide GPS coordinates for each ZIP code and base on that information you can find closest ZIP code.
You can represent hierarchy structure in Neo4j as a tree and find closest ZIP code thru that tree.
Or you can represent ZIP codes in Quadtree structure in Neo4j.
Another options is to use Neo4j Spatial library.
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.
If the graph is small enough to fit into RAM, you could do this import in a few steps:
Use neo4j-shell-tools to export from neo4j to GraphML.
Use NetworkX to import from GraphML to a NetworkX Graph object (let's call it g).
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.
I have been playing with neo4j for a few months now (not so thoroughly, though!).
I have seen the examples of OSMImporter in test cases, and also how to make a WITHIN_DISTANCE_QUERY ( http://structr.org/blog//299fbc8d5d854c78a530793e1555ae77 )
I was wondering, how can someone integrate the above?
Should I modify the source of OSMImporter?
Cheers
So, you don't need the OSM importer if you are not using OSM files. Just add points from your domain to a layer, just like https://github.com/neo4j/spatial/blob/master/src/test/java/org/neo4j/gis/spatial/LayersTest.java#L57