I want to produce a circular graph with one (and possibly several others...) in the middle of the circle. As an example, consider this simple 7-nodes undirected graph:
graph g1 {
0--1;
0--2;
0--3;
0--4;
0--5;
0--6;
1--2--3--4--5--6--1;
}
I would like something like this (did online with csacademy.com/app/graph_editor/:
The Graphviz circo engine does a good job putting all the nodes in a circular layout, but I want the node 0 to be in the middle.
I read on its page that the attribute root can be used to specify which one is in the middle:
The center of the layout will be the root of the generated spanning tree. As a graph attribute, this gives the name of the node. As a node attribute, it specifies that the node should be used as a central node.
As I understand it, this attribute can be used either as a global graph attribute, either as a "node" attribute. So I tried adding:
0[root=true];
at the beginning, to tell him that the node 0 is the root one. No change.
I also tried graph [root=0];
, no success (see live demo here). How can I achieve this?
Other answers suggest adding a "hidden" node, but I can't do that because the dot file is used both to produce a rendering and as data input for something else.
Second question: would it be possible to have a "cluster" of several nodes in the middle of the circle, using that technique? Or does the "root" attribute need to be assigned to a single node?
Edit For example, something like this, with 3 nodes inside the circular layout.