我将以下输入提供给 Dot:
digraph G {
subgraph cluster1 {
fontsize = 20;
label = "Group 1";
A -> B -> C -> D;
style = "dashed";
}
subgraph {
O [shape=box];
}
subgraph cluster2 {
fontsize = 20;
label = "Group 2";
Z -> Y -> X -> W [dir=back];
style = "dashed";
}
D -> O [constraint=false];
W -> O [constraint=false, dir=back];
}
它产生:
如何对齐节点O
以使其具有与D
和相同的等级W
?也就是说,一个看起来像这样的图表:
A Z
| |
B Y
| |
C X
| |
D-O-W
添加
{ rank=same; D; O; W; }
产生错误
Warning: D was already in a rankset, ignored in cluster G
Warning: W was already in a rankset, ignored in cluster G
我想我可以通过在 的子图中添加不可见的节点和边来破解它O
,但我想知道我是否错过了一些 Dot 魔法。