为什么 graphviz 将 C 绘制在 B 的右侧?
为什么 graphviz 将 C 绘制在 B 的右侧?我希望它看起来像
A
B E
C
。
digraph {
compound=true
subgraph cluster_1 { a -> b }
b -> c
{rank=same b -> e }
}
Why is graphviz drawing C to the right of B? I want it to look like
A
B E
C
instead.
digraph {
compound=true
subgraph cluster_1 { a -> b }
b -> c
{rank=same b -> e }
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定你能做你正在寻找的事情。
当 dot 布置给定图时,它将 cluster_1 视为单个实体以进行排名。所以,如果你愿意, cluster_1 的等级为 0。那么因为你说 {rank=same b, e},e 的等级也为 0。当 dot 绘制 c 时,c 将具有更高的等级 - 等级 1 - 所以它会被绘制低于 e。因为此时不需要担心 x 轴上的空间,所以它在 e 的正下方绘制 c。
如果您希望节点 c 绝对绘制在其他所有节点下方,您可以添加
其中...看起来不像您的目标那么好。
I'm not sure you can do what you're looking for.
When dot lays out the given graph, it treats cluster_1 as a single entity for the purposes of ranking. So, if you like, cluster_1 has rank 0. Then because you say {rank=same b, e}, e also has rank 0. When dot draws c, c will have a higher rank - rank 1 - so it will be drawn below e. Because it has no need to worry about space in the x-axis at this point, it draws c right below e.
If you want node c to definitely be drawn below everything else you could add
which... doesn't look as great as what you're aiming at.
因为它会增加图形的总面积,而这正是 graphviz 试图最小化的。您可以尝试使用包中的不同布局实用程序(例如 lefty 或 neato),看看是否能获得更好的结果。
Because it would increase the total area of the graph, which is what graphviz tries to minimize. You can try to use different layout utilities in the packages such as lefty or neato to see if you get better results.