Starting an edge from within a node

此生再无相见时 提交于 2019-12-11 03:40:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!