强行“主线” Graphviz 中的节点变成直线(或替代方案)
我正在尝试使用 Graphviz dot (但我愿意使用其他东西)来生成一个带有长“主线”节点和许多小分支的图。我希望主线从左到右是笔直的,其上方或下方有小分支。然而,Graphviz“平衡”了两个分支,所以我最终得到了一个弯曲的图。
为了说明这一点,这里有一个类似于我当前得到的草图:
这就是我真正想要的:
有没有办法强制或鼓励 Graphviz 生成像第二个这样的图表?我也许可以使用“虚拟”第二个分支来让它进行三向布局,然后隐藏/删除虚拟分支,但如果有更好的选择那就更好了。
I'm trying to use Graphviz dot (but am willing to use something else) to generate a graph with a long "main line" of nodes, and many small branches. I'd like the main line to be straight from left to right, with the small branches above or below it. However, Graphviz "balances" the two branches, so I end up with a crooked graph.
To illustrate, here's a sketch similar to what I currently get:
And this is what I actually want:
Is there any way to force or encourage Graphviz to generate a graph like the second one? I may be able to use "dummy" second branches to have it do a 3-way layout, and then hide/delete the dummies afterward, but if there's a better option that would be preferable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是使用边的 weight 属性的解决方案:
结果:
Here is a solution using the weight attribute of edges:
Result:
使用节点的 group 属性的第二个解决方案 - 又是一个有向图:
来自 graphviz dot 参考:
所以我们开始:
输出与我的第一个答案完全相同。
A second solution using the group attribute of nodes - again a directed graph:
From the graphviz dot reference:
So here we go:
Output is exactly the same as in my first answer.