Can anyone recommend a Python library that can do interactive graph visualization?
I specifically want something like d3.js but for python
One recipe that I have used (described here: Co-Director Network Data Files in GEXF and JSON from OpenCorporates Data via Scraperwiki and networkx ) runs as follows:
The networkx JSON exporter takes the form:
from networkx.readwrite import json_graph
import json
print json.dumps(json_graph.node_link_data(G))
Alternatively you can export the network as a GEXF XML file and then import this representation into the sigma.js Javascript visualisation library.
from xml.etree.cElementTree import tostring
writer=gf.GEXFWriter(encoding='utf-8',prettyprint=True,version='1.1draft')
writer.add_graph(G)
print tostring(writer.xml)