ipython-d3networkx
ipython-d3networkx copied to clipboard
Rendering a simple graph?
Thanks for this great code! We have been discussing it over at https://github.com/wrobstory/vincent/issues/96
How would one render a simple, static graph? Ideally something like:
g = networkx.erdos_renyi(100,.1)
render(g)
Unfortunately, even using the "demo simple" notebook it appears I can't even do:
g = networkx.erdos_renyi(100,.1)
G = EventfulGraph(g)
d3 = ForceDirectedGraphWidget(G)
floating_container.children = [d3]
display(floating_container)
I understand I could do:
G = EventfulGraph()
and build the network I want from there "manually", but that's painful and sometimes impractical.
In older networkx versions the graph generator functions had an argument create_using
so that you should be able to do:
g = EventfulGraph()
g = nx.erdos_renyi(100, 0.1, create_using=g)
...
Still, improvements would be a good thing :)
Interesting! Any idea how to create similar functionality with current versions of networkx? Maybe we could talk to the networkx folks.
Hi @jeffalstott , AFAIK there isn't a way to do that with the current design. However, I don't think it should be too difficult to implement.
Side note: I've been thinking a bit more about this repository and I think it'd be better named ipython-d3networkx
. That way I can use ipython-d3
for a more generic library that wraps d3 entirely.