How can I layout nodes in a graph "circularly", similar to the graphs in the following figure:
Graphviz offers the circo layout engine for circular layouts.
circo draws graphs using a circular layout (see Six and Tollis, GD ’99 and ALENEX ’99, and Kaufmann and Wiese, GD ’02.) The tool identifies biconnected components and draws the nodes of the component on a circle. The block-cutpoint tree is then laid out using a recursive radial algorithm. Edge crossings within a circle are minimized by placing as many edges on the circle’s perimeter as possible. In particular, if the component is outerplanar, the component will have a planar layout. If a node belongs to multiple non-trivial biconnected components, the layout puts the node in one of them. By default, this is the first non-trivial component found in the search from the root component.
A simple example for K3 would be:
graph K3 {
layout=circo;
node[shape=point, color=red];
a--b--c--a;
}
However, most of the graphs will be oriented differently than on your image. The K3 example would yield this:
To test other layout engines online you can use GraphvizOnline.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With