Hacker News new | past | comments | ask | show | jobs | submit login

Been a few years since I put NetworkX through its paces, but the several times I have tried it, found remarkably weak support for graph layout and display. NetworkX analytic routines may be strong, but attractively displaying graph-structured problems remarkably more interactive and attractive via d3.js, GraphViz, etc. At least for my problems, communicating graph structures, and having nodes and edges that represent different kinds of things…these are basic requirements, not optional frills.



> Been a few years since I put NetworkX through its paces, but the several times I have tried it, found remarkably weak support for graph layout and display.

Well, yeah, it is pretty open that it is the wrong tool for that job. Here's what the NetworkX documentation [0] says about its visualization support:

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.

Proper graph visualization is hard, and we highly recommend that people visualize their graphs with tools dedicated to that task. Notable examples of dedicated and fully-featured graph visualization tools are Cytoscape, Gephi, Graphviz and, for LaTeX typesetting, PGF/TikZ. To use these and other such tools, you should export your NetworkX graph into a format that can be read by those tools. For example, Cytoscape can read the GraphML format, and so, networkx.write_graphml(G, path) might be an appropriate choice.

[0] https://networkx.org/documentation/latest/reference/drawing....


Thanks for posting. I like using networkx for various tasks, and have been meaning to start exploring other visualization libraries.


Laying out a graph so it's "friendly to humans" is a seriously hard problem. I've built complex DAG workflow engines using networkx and its layout tools and they worked just fine. But, yeah, I guess it depends on what you need?

Export to .dot -> open in your favourite viewer.


I usually write small functions for postprocessing the proposed layouts from the default algorithms. So far this was always more than sufficient.


Export the graph to GML or to GraphML or to GraphViz DOT or to some other Graph format, and feed it to a dedicated utility. BTW I recommend 3D graph visualization over 2D when possible, that is when you're exploring interactively as opposed to printing figures. The Graphia tool is the only FOSS tool for this purpose that I know of:

https://graphia.app

https://github.com/graphia-app/graphia


You may like my Netgraph library [1], which is a Python library that aims to complement networkx, igraph, and graph-tool with publication-quality visualisations.

Netgraph implements numerous node layout algorithms and several edge routing routines. Uniquely among Python alternatives, it handles networks with multiple components gracefully (which otherwise break most node layout routines), and it post-processes the output of the node layout and edge routing algorithms with several heuristics to increase the interpretability of the visualisation (reduction of overlaps between nodes, edges, and labels; edge crossing minimisation and edge unbundling where applicable). The highly customisable plots are created using Matplotlib, and the resulting Matplotlib objects are exposed in an easily queryable format such that they can be further manipulated and/or animated using standard Matplotlib syntax. Finally, Netgraph also supports interactive changes: with the InteractiveGraph class, nodes and edges can be positioned using the mouse, and the EditableGraph class additionally supports insertion and deletion of nodes and edges as well as their (re-)labelling through standard text-entry.

[1] https://github.com/paulbrodersen/netgraph


We make it pretty easy to go from networkx or any other pydata (DF, csv, parquet, ...) to interactive GPU viz w all sorts of analytics built in: https://github.com/graphistry/pygraphistry#explore-any-data-...


I use NetworkX to build the graphs and Gephi to visualize them. No need to pick a single tool.


If I want to visualize a graph, particularly large ones I just dump it out to gexf[0] format and load it into gephi[1]. It kicks back some legacy formatting errors but it doesn't really impact the graph. Gephi also supports temporal based graph analysis which is nice.

[0] https://networkx.org/documentation/stable/reference/readwrit... [1] https://gephi.org/


I definitely agree. There’s no reason in my opinion not to have an extension library that does good visualization via a force-directed graph or similar. The existing visualization methods are pretty barebones.


I recently found Cosmograph and have been using it for a project, it’s quite good for the specific things it does.

https://cosmograph.app/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: