Search code examples
graph-theoryforce-layoutgephi

Automating force layout for a network graph


I'm trying to automate applying a force layout to a network graph (as in, node & edges). I'd like to do so without requiring human intervention (as in Gephi) and instead do things like equally space the larger nodes at distances that are friendly for humans to see. We basically want to replace Gephi with a server-side or automated solution.

Anyone know of a server-side solution to this, if it's possible?


Solution

  • With "automating", I suspect that you mean not having to monitor when the layout has reached convergence and therefore the nodes have stopped moving (?).

    Force layouts or similar, are used in a number of other packages which can be used server-side.

    For example, sfdp or neato from graphviz. Graphviz will produce a wide range of outputs, amongst which is SVG (for an option that provides some access to the elements of the graph more than what a bitmap image would do).

    As far as Python is concerned, there are modules such as Networkx and igraph that offer some drawing capabilities. Networkx in particular offers a wide range of drawing options such as force and spectral layout (which can be very useful for dense graphs) but it can also interface to graphviz and therefore provides much more control over the whole process of handling a graph.

    Hope this helps.