Graph This – rendering your graph with Graphviz.


Graph with Graphviz

Triggered by a user question, let me just very briefly highlight a nice and easy graph visualization feature.

Sometimes, you just want to fast see what you are putting in your little example graph. In Neo4j, there is a well hidden gem-the Graphviz Component. To very shortly output a graphviz rendering, look at this test, demonstrating the basic usage (this code is actually taking a traversal instruction to walk the graph, you can easily just use the whole graph):









And gives you the following output in the Graphviz DOT notation: With this piped into a file, say neo4j.dot, you can now do (after installing graphviz and dot on your machine):

dot -Tpng -O neo4j.dot


And get an output file of neo4j.dot.png, pictured below.






















Voila, your are done and can see what you just programmed!


Happy hacking!


/peter



Want to learn more about graph databases? Click below to get your free copy of O’Reilly’s Graph Databases ebook and discover how to use graph technologies for your application today.

Download My Ebook