In Graphviz, is it possible to draw the outgoing edges from sub-records starting from their centers instead of their borders?
This diagram (original article) makes it seem so, but the example code is wrong and I tested the code from Listing 1 (draws this, but I used twopi instead) in Graphviz 2.29 and the outcome is different (edges start at the record borders).
Any ideas?
Thanks in advance.
The linked article is from 2004, some changed were made to graphviz since then.
Here's how to adapt listing °1 do display edges originating from the center of record shape cells:
Add the following line before defining the edges:
edge[headclip=false, tailclip=false];
This tells graphviz to draw the edges to the end instead of clipping them at the border's node.
But this is not enough in this case because the edges use already a port - we can add a compass point to indicated where to place the end/beginning of the edge. For example, in order to have the first edge going from the center of J to the border of E:
"node0":f1:c -> "node1":f1;
Or just leave out the port and compass point to use the center of the node:
"node0" -> "node1":f1;
In order to have all edges originate and end in the center of the record nodes:
digraph G
{
node [shape = record];
edge[headclip=false, tailclip=false];
node0 [ label ="<f0> | <f1> J | <f2> "];
node1 [ label ="<f0> | <f1> E | <f2> "];
node4 [ label ="<f0> | <f1> C | <f2> "];
node6 [ label ="<f0> | <f1> I | <f2> "];
node2 [ label ="<f0> | <f1> U | <f2> "];
node5 [ label ="<f0> | <f1> N | <f2> "];
node9 [ label ="<f0> | <f1> Y | <f2> "];
node8 [ label ="<f0> | <f1> W | <f2> "];
node10 [ label ="<f0> | <f1> Z | <f2> "];
node7 [ label ="<f0> | <f1> A | <f2> "];
node3 [ label ="<f0> | <f1> G | <f2> "];
// identical result: "node0" -> "node1";
"node0":f1:c -> "node1":f1:c;
"node0":f1:c -> "node2":f1:c;
"node1":f1:c -> "node4":f1:c;
"node1":f1:c -> "node6":f1:c;
"node4":f1:c -> "node7":f1:c;
"node4":f1:c -> "node3":f1:c;
"node2":f1:c -> "node5":f1:c;
"node2":f1:c -> "node9":f1:c;
"node9":f1:c -> "node8":f1:c;
"node9":f1:c -> "node10":f1:c;
}

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