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?
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.
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.
Checkout also django-netjsongraph.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With