Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django and interactive graph/network visualization

I am creating a Django app and want to have visualizations of a social network. I'm looking for a library that can draw a graph/network data structure, but also make it interactive. I'd like to be able to click on a node and have information from that node be displayed (Name, Network, etc) somewhere else on the page

So far I've found python-graph and graphviz to be very powerful visualization tools, but they create static images, so you can't click on them. I've also found this thread

Graph visualization library in JavaScript

which had a lot of suggestions, but some of them are for graphs as in charts, not graph as in social network graph. Some of them are very old, and some of them are interactive only in that the node can be dragged and moved elsewhere on a canvas. I don't care so much about the user being able to change the graph, I'd just like to have the node object carry data with it that can be displayed somewhere.

Any suggestions?

like image 366
JCWong Avatar asked Jan 12 '12 18:01

JCWong


3 Answers

I did something similar using PyGraphviz. You can save the graph as SVG and show the SVG in your website. Then you can use something like jQuery SVG to attach handlers to the nodes.

I implemented a more flexible solution and serialized all nodes and edges to a JSON format and sent it to the website. Then I draw the graph using Raphaël. This solution is cross-browser compatible and very flexible.

like image 150
Reto Aebersold Avatar answered Sep 30 '22 18:09

Reto Aebersold


I like d3. Here's an example of a force-directed graph (often used to display social networks).

It would be fairly easy to add the kind of click handling you're seeking to the d3 force example.

like image 44
Beau Avatar answered Sep 30 '22 16:09

Beau


Checkout also django-netjsongraph.

like image 34
nemesisdesign Avatar answered Sep 30 '22 16:09

nemesisdesign