ipython-d3networkx icon indicating copy to clipboard operation
ipython-d3networkx copied to clipboard

Rendering a simple graph?

Open jeffalstott opened this issue 10 years ago • 3 comments

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.

jeffalstott avatar Jul 03 '14 22:07 jeffalstott

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 :)

Midnighter avatar Jul 04 '14 10:07 Midnighter

Interesting! Any idea how to create similar functionality with current versions of networkx? Maybe we could talk to the networkx folks.

jeffalstott avatar Jul 04 '14 15:07 jeffalstott

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.

jdfreder avatar Jul 30 '14 19:07 jdfreder