I am looking for a way to draw where i can specify angle at which edge is drawn from the node using graphviz tool.
Example is shown in picture below.
Here i have taken the line going to north as 0 Degrees.
So i need something like
1--2 [angle="60"]
1--3 [angle="120"]
1--4 [angle="240"] // also can be angle="-120"
1--5 [angle="300"] // or angle ="-60"
I have already tried the following edge attributes = headport, tailport, dir and graph attribute rankdir but i am unable to get desired result.
The dot renderer allows the use of ports to specify the angle that an edge makes with a node. You can use the notation 1:sw -> 2:ne;
to describe the first edge in your graph.
There are limitations to this - for example only 45 degree precision, and the process appears to fail sometimes. If you have simple graphs, you could try to use the other renderers to do more balanced layouts than the hierarchical dot ones and attempt to tune them.
You can achieve the intended result by switching to a circular layout + invisible nodes:
graph G {
graph[layout="circo"];
node[shape="circle"];
6[style="invis"];
1 -- 4;
1 -- 3;
1 -- 6[style="invis"];
1 -- 2;
1 -- 5;
}
The angles are not as OP asked. Thanks to @albert for pointing it out.
graph G {
graph[layout="circo"];
node[shape="circle"];
1 -- 7[style=invis];
1 -- 2;
1 -- 5;
1 -- 6[style=invis];
1 -- 4;
1 -- 3;
6[style="invis"];
7[style="invis"];
}
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