【发布时间】:2014-12-16 12:28:32
【问题描述】:
在 Graphviz / dot 中,是否可以让边缘精确连接在节点的顶部中心?阅读点指南,我认为 tailport 和 headport 会对我有所帮助,但添加它们并没有什么区别,有时会得到更奇怪的结果。
这就是我得到的:
这就是我要找的:
我用来获取(不正确)图表的代码是:
digraph G {
graph [splines = ortho];
node [shape = box];
edge [dir = none];
{
rank = same
A
AB [shape = point]
B
A -> AB
AB -> B
}
{
rank = same
point1 [shape = point]
point2 [shape = point]
point3 [shape = point]
}
AB -> point1
// The following section if to make the nodes appear in
// the correct order, not sure if there's a better way
{
edge [style = invisible]
rank = same
C
D
E
F
C -> D
D -> E
}
point2 -> point1
point2 -> C
point1 -> point3
point3 -> E
point1 -> D
}
【问题讨论】:
-
将您的代码复制粘贴到graphvizFiddle 会产生正确的结果。您使用的是最新版本的 graphviz 吗?
-
@marapet 谢谢!事实证明,最新的(2.38)版本在 Mac OS X Yosemite 中无法正常工作,我不得不降级到 2.36,如下载页面中所述:graphviz.org/Download_macos.php 如果您将此作为答案发布,我会接受,谢谢又来了!
-
我很高兴你知道了!既然你做了所有的工作,你应该添加并接受你自己的答案;)