Zsailer / nx_altair

Draw interactive NetworkX graphs with Altair
MIT License
223 stars 26 forks source link

test with real network #4

Closed empet closed 5 years ago

empet commented 6 years ago

Have you tried to plot a "real" graph, with many nodes? From my experience networkx does not assign the best layout to moderate and large graphs. For example the network of scientists http://networkdata.ics.uci.edu/data/netscience/netscience.gml with spring_layout or kamada_kawai_layout is either odd or with false connectivity.

Zsailer commented 6 years ago

I'm not sure what you mean by "real" graphs. Do you mean large graphs, complicated topologies, or ...?

I don't think those problems apply to this package. The point of nx_altair is to plot networks with Altair (which opens up all kinds of possibilities for interactivity). The layout of the nodes must be given by the user, and they can use whatever tool/package they'd like to compute those positions. Computing those positions is outside the scope of nx_altair.

empet commented 6 years ago

By a real graph I understand one that represents the relationship between items in different practical domains (like the networks associated to datasets in this repo http://networkrepository.com/), not one defined from synthetic data.

On github and Pypi it is mentioned that nx-altair Draw(s) NetworkX graphs with Altair. But the networkx documentation stresses that "NetworkX provides basic functionality for visualizing graphs, but its main goal is to enable graph analysis rather than perform graph visualization. In the future, graph visualization functionality may be removed from NetworkX or only available as an add-on package". It's not only this mention, but also my own experience with networkx layouts that lead to networks that either have cluttered edges and many crossings or have connectivity drawbacks. It's nice if you provide the option to set user's layout. nx from nx-altair was misleading.

Zsailer commented 6 years ago

By a real graph I understand one that represents the relationship between items in different practical domains (like the networks associated to datasets in this repo http://networkrepository.com/), not one defined from synthetic data.

Ah, I see. I haven't had much time to explore how networkx assigns layouts to different networkx. If you'd be interested in testing and adding notebooks/examples for "real" networks, that would awesome. I welcome PRs! :)

Again, I think layout design is (currently) outside the scope of this package and should be reported to networkx for now.

It's nice if you provide the option to set user's layout.

Technically, nx_altair does provide the option to set a layout. You explicitly pass the positions of the nodes to the pos argument, just like networkx. To compute these positions, however, you'll need to use a tool like networkx or nxviz. This is also true for networkx's draw_networkx methods, which this package mirrors.

That said, I could see nx_altair supporting it's own native layout module (perhaps like nxviz) in future releases, especially if networkx drops support for this. Again, if you're interested in pushing the project in that direction, I welcome PRs!

nx from nx-altair was misleading.

While I appreciate the criticism, I'm not sure I agree. The nx in nx_altair makes sense for two reasons. 1) the input to nx_altair is explicitly a networkx Graph object and 2) the API mirrors networkx's (current) draw module. What specifically is misleading?

I'm certainly open to suggestions (and again, any PRs)! :)

SmearingMap commented 6 years ago

I have a skeleton of an example using the Florentine families graph; I can tidy it up and submit a PR if interested. It will be my first PR on Github, so is there anything in particular I should know/plan on doing to save you time?

Zsailer commented 6 years ago

Hi @mtrenfield,

That would be great! I actually created a short infographics explaining how to submit PRs on Github. Perhaps it will help you?

Otherwise, I'm happy to work with you throughout the process. Feel free to reach out on the gitter if you need help.

Zsailer commented 5 years ago

Closing this issue for now.

@empet feel free to reopen if you'd like to continue the discussion!