问题
digraph foo {
a [label="<first> A | <rest> rest", shape=record];
b [label="<first> B | <rest> rest", shape=record];
a:rest -> b [label="foo", arrowtail=dot, dir=both];
}
I would like to start the tail of the edge (a to b) from within a:rest (ideally in the center), is this possible?
I am trying to draw linked lists using box and pointer like notation.
回答1:
Yes, this is possible. The attribute to use is called tailclip:
If true, the tail of an edge is clipped to the boundary of the tail node; otherwise, the end of the edge goes to the center of the node, or the center of a port, if applicable.
Just change your last line to
a:rest -> b [label="foo", arrowtail=dot, dir=both, tailclip=false];
Edit: As @Kyborek mentions in the comments, an additional compass point is needed for current versions of graphviz:
a:rest:c -> b [label="foo", arrowtail=dot, dir=both, tailclip=false];
See also this answer
来源:https://stackoverflow.com/questions/7020529/starting-an-edge-from-within-a-node