GraphViz 点。如何围绕盒装尺寸分布元素?

GraphViz Dot. How to distribute elements around a boxed size?

我有一个生成以下输出的点 graphviz 文件:

http://www.qlands.com/other_files/test.png

但是输出是垂直组织的。如果我将尺寸设置为例如 8.27 英寸;如何将元素分布在一个 8.27 x 8.27 英寸的盒子周围?

你的图是一个从左到右用点排列的有向图,第一层包含许多节点,因此图像非常高。

解决这个问题的主要工具是unflatten:

unflatten is a preprocessor to dot that is used to improve the aspect ratio of graphs having many leaves or disconnected nodes. The usual layout for such a graph is generally very wide or tall. unflatten inserts invisible edges or adjusts the minlen on edges to improve layout compaction.

您可以将其与其他工具和技术结合使用以获得您想要的结果:

  • 使用 unflatten 实用程序 - 请参阅 this answer 了解使用 unflatten 的详细示例。
  • 使用不可见的边缘引入新的行列(基本上是 unflatten 自动执行的操作,但有人类的灵感......示例也 here
  • 如果你需要这个精确大小的输出,一定要了解 graphviz 的各种对其有影响的属性,例如 sizemarginratio ...(另请参阅 this and yet another answer 提供详细信息)
  • 最后,您可以简单地使用不同的布局(例如neato