# Circular Layout

Hi,

Just started with the evaluation for layout.
What's the easiest way of doing this...
I have one node, the CentralNode, and a bunch of other nodes.
Each of the other nodes has a JGoLink between itself and the CentralNode.
I'd like to lay them out as a sort of star topology
Whats the best layout for this and which params are the key ones?
Thanks
mike

Try using the force-directed layout (JGoForceDirectedAutoLayout). The force-directed algorithm uses the metaphore of forces in the physical world to layout the diagram. Nodes are treated as though they have an electrical charge and are therefore mutually repulsive. Links are treated as springs, which hold the nodes together. There is also gravitational force (in any direction) and you can erect “force-fields” to constrain the diagram to stay within a particular area.

If you have a central node connected to multiple other nodes, force-directed layout will tend to lay it out in a circular arrangement.
For more details, take a look at the JGo Layout User Guide.

Thanks, I’ll try that.

Hi,

I've tried implementing variations in the methods used to customise the forces for the force directed layout but don't seem to have hit the right algorithms in trying to balance the forces to give a circular layout.
Ideally what I want is to first check the number of nodes and from that determine how many concentric rings I'd need. For example for 10 nodes there would be just one ring. For say 30 there'd be two and so on. (Typically to a max of approx 250 nodes with maybe 4 rings.)
With more than one ring the outer rings would have proportioanlly more nodes than the inner ones. Having determined the rings/quantities the layout would then layout the nodes in the rings and, obviously, all nodes in a given ring would be the same distance from the central node.
I'm not asking for a complete solution to all of this :) but I would appreciate some guidance on how to layout a 'small' set of nodes in just one ring so that the particular case can then be generalised.
Many thanks
Mike

There isn’t any built-in circular layout, so you’ll need to write it. An opportunity to brush up on your Trig!

The following link looks like a good place to start: