如何控制子图'点布局?
我有一个由许多独立且简单的各种大小的子图组成的有向图。 dot
水平放置所有这些子图,因此我最终得到一个 40000x200 的输出文件,例如:
G1 G2 G3 G.....4 G5
我如何告诉 dot
在两个维度上布局这些子图以获得类似:
G1 G2 G3
G.....4
G5
谢谢。
i have a digraph
composed of many independant and simple subgraphs
of various sizes. dot
lays all these subgraphs horizontally, so i end up with a 40000x200 output file, e.g:
G1 G2 G3 G.....4 G5
How do i tell dot
to layout these subgraphs in both dimensions to get something like:
G1 G2 G3
G.....4
G5
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实现此目的的步骤使用可以通过管道连接在一起的多个 graphviz 工具。
以下行是可能的配置,graph.dot 是包含图表的文件。您可能需要摆弄这些选项。
解释如下:
1. 分离断开的图
工具:ccomps
-x
选项(仅打印连接的组件,作为单独的图)可能就是所需要的。2. 布局每个图
工具:点
每个有向图都被一一布局。需要此步骤来获取节点和边的位置。
3. 将所有布局图打包到一个
工具中:gvpack
您应该阅读该工具的选项文档并使用这些选项。例如,
-array
用于以类似网格的方式布局图形,并提供多个标志来控制布局。4. 创建输出
工具:neato
选项
-n2
告诉neato不要布局输入图形,而是使用现有的位置属性。示例图:
编辑: 对 gvpack 中的二合字母进行排序
以确定外观 od 由
gvpack
创建的组合布局中的子图,每个子图都需要一个sortv
属性。例如,以下图形:
进行转换
可以使用结果
The steps to achieve this uses multiple graphviz tools which can be piped together.
The following line is a possible configuration, graph.dot being the file which contains your graph(s). You may have to fiddle with the options.
And here's the explanation:
1. Separate disconnected graphs
Tool: ccomps
The
-x
option (Only the connected components are printed, as separate graphs) is probably all that is needed.2. Layout each graph
Tool: dot
Each directed graph is layed out, one by one. This step is needed to get the position of the nodes and edges.
3. Pack all layed out graphs into one
Tool: gvpack
You should read the documentation of the options for this tool and play with the options. For example,
-array
is used to lay out the graphs in a grid like manner, and offers several flags to control the layout.4. Create the output
Tool: neato
The option
-n2
tells neato to not layout the input graphs but to use the existing position attributes.Example graph:
Edit: Sorting the digraphs in gvpack
In order to determine the order of appearance od the subgraphs in the combined layout created by
gvpack
, each subgraph will need asortv
attribute.For example, the following graphs:
can be transformed using
resulting in