Digraph-like layout using ForceDirected layout


we are trying to come up with an algorithm (or a magic set of parameters) for force directed layout to be able to perform a layout where the most ‘significant’ nodes are placed in the centre of the document with less significant nodes placed radially outward from the centre.

I have created mini diagrams to help describe (approximately) what i’m trying to achieve.

The first diagram shows the layout of the nodes when we perform a digraph layout.


The second diagram shows an approximate layout that we would like to a achieve using a force directed layout.


I have tried to keep the node colours the same in both diagrams.

Could you provide any pointers about how we should approach implementing such a layout? Should we add extra JGoNetworkLinks between any of the nodes (besides those shown in the diagrams) to help the layout algorithm?


Does JGoForceDirectedAutoLayout not do what you want?

However, there might be a way to speed up the force-directed layout by pre-arranging the nodes in concentric circles, with the nodes positioned in circles according to the layer that they are in.

Hi Walter,

thanks for your reply. Umm the force Directed layout does quite well in some of our cases. In the case that i mentioned where we want to make a digraph layout look ‘radial’, the standard JGoForceDirectedLayout seems to work fairly well.

But we have another case where we want to do a similar radial layout but where the nodes are ranked differently. The node ranking has nothing to do with the links between nodes. (Whereas in the example i diagrammed, the node ranking was directly related to the links between the nodes).

So i’m wondering how we can push these higher ranked nodes towards the centre of the view regardless of the links between the nodes (well perhaps not regardless, but the links between the nodes should have MUCH lower priority than the ranking of the node).

Well, JGoLayout actually works on a JGoNetwork consisting of JGoNetworkNodes and JGoNetworkLinks. Normally this JGoNetwork is isomorphic to your JGoDocument, or subset thereof.

But there isn't any reason you couldn't just have the JGoNetworkLinks that you want, which might not correspond to any JGoLinks in your document.