防止Graphviz箭头边缘越过邻居节点

时间:2013-03-19 17:31:44

标签: graphviz

我创建了以下graphviz图,代表了一个包含周期的链表:

igraph foo {
    rankdir=LR;
    node [shape=record];
    a [label="{ <data> 12 | <ref>  }", width=1.2]
    b [label="{ <data> 99 | <ref>  }"];
    c [label="{ <data> 37 | <ref>  }"];
    a:ref:c -> b:data [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false, arrowsize=1.2];
    b:ref:c -> c:data [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false];
    c:ref:c -> b:data [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false];
}

不幸的是,从c:refb:data的箭头跨越了节点c

enter image description here

如何强制边缘绕过节点而不穿过它们?

2 个答案:

答案 0 :(得分:3)

我无法找到一个简单且完全令人满意的答案,但更改罗盘点可能有所帮助。

digraph foo {
    rankdir=LR;
    node [shape=record];
    a [label="{ <data> 12 | <ref>  }", width=1.2]
    b [label="{ <data> 99 | <ref>  }"];
    c [label="{ <data> 37 | <ref>  }"];
    a:ref:c -> b:data [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false, arrowsize=1.2];
    b:ref:c -> c:data [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false];
    c:ref:s -> b:data:s [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false];
}

changed compass point

答案 1 :(得分:1)

您可以为点文件运行"dot -Tsvg",然后在svg之后打开ms visio文件并执行enter image description here

之类的操作