Graphviz 图:虚线框围绕着;“相同”-分组框

Graphviz 图:虚线框围绕着;“相同”-分组框,graphviz,dot,Graphviz,Dot,我有许多箱子放在同一水平面上: 通过多个{rank=相同的a3 b3_1 b3_2 c3_1 c3_2 d3_1 d3_2}行,而我用a3[label=“Assigned”]定义元素行 我希望在同一级别上的所有元素周围都有一个框(如果可能的话,用虚线标出),例如(通过编辑器模拟): 整个来源如下所示: digraph customer { layout=dot label = "some diagram"; labelloc = "t"; // place the label at the

我有许多箱子放在同一水平面上: 通过多个
{rank=相同的a3 b3_1 b3_2 c3_1 c3_2 d3_1 d3_2}行,而我用
a3[label=“Assigned”]定义元素

我希望在同一级别上的所有元素周围都有一个框(如果可能的话,用虚线标出),例如(通过编辑器模拟):


整个来源如下所示:

digraph customer {
layout=dot
label = "some diagram";
labelloc = "t"; // place the label at the top
node [shape=record];

{rank=same a1 b1 c1 d1};
{rank=same a2 b2 c2 d2};
{rank=same a3 b3_1 b3_2 c3_1 c3_2 d3_1 d3_2};
{rank=same a4 b4_1_1 b4_1_2 b4_2_1 b4_2_2 c4_1_1 c4_1_2 c4_2_1 c4_2_2 d4_1_1 d4_1_2 d4_2_1 d4_2_2};
{rank=same a5  b5_1 b5_2 b5_3 b5_4 c5_1 c5_2 c5_3 c5_4 d5_1 d5_2 d5_3 d5_4};
{rank=same a6  b6_1 b6_2 b6_3 b6_4 c6_1 c6_2 c6_3 c6_4 d6_1 d6_2 d6_3 d6_4};

a1 [label = "Level 1"];
a2 [label = "Level 2"];
a3 [label = "Level 3"];
a4 [label = "Level 4"];
a5 [label = "Level 5"];
a6 [label = "Level 6"];
a1 -> a2 -> a3 -> a4; a4 -> a5 [label = "case ..." ]; a5 -> a6;


b1     [label = "Text A"];
b2     [label = "false"];
b3_1   [label = "no"];
b3_2   [label = "yes"];
b4_1_1 [label = "same"];
b4_1_2 [label = "different"];
b4_2_1 [label = "same"];
b4_2_2 [label = "different"];
b5_1   [label = "no", fillcolor = red, style=filled];
b5_2   [label = "no", fillcolor = red, style=filled];
b5_3   [label = "no", fillcolor = red, style=filled];
b5_4   [label = "yes", fillcolor = green, style=filled];
b6_1   [label = "yes", fillcolor = green, style=filled];
b6_2   [label = "yes", fillcolor = green, style=filled];
b6_3   [label = "yes", fillcolor = green, style=filled];
b6_4   [label = "yes", fillcolor = green, style=filled];


b1 -> b2;
b2 -> b3_1; b3_1 -> b4_1_1; b4_1_1 -> b5_1 [label = "A" ]; b5_1 -> b6_1;
            b3_1 -> b4_1_2; b4_1_2 -> b5_2 [label = "B" ]; b5_2 -> b6_2;
b2 -> b3_2; b3_2 -> b4_2_1; b4_2_1 -> b5_3 [label = "C" ]; b5_3 -> b6_3;
            b3_2 -> b4_2_2; b4_2_2 -> b5_4 [label = "D" ]; b5_4 -> b6_4;

subgraph clusterone {
    a1; b1; c1; d1;
    label="level 1";
    graph[style=dotted];
 }

c1     [label = "Text B"];
c2     [label = "true"];
c3_1   [label = "no"];
c3_2   [label = "yes"];
c4_1_1 [label = "same"];
c4_1_2 [label = "different"];
c4_2_1 [label = "same"];
c4_2_2 [label = "different"];
c5_1   [label = "no", fillcolor = red, style=filled];
c5_2   [label = "no", fillcolor = red, style=filled];
c5_3   [label = "yes", fillcolor = green, style=filled];
c5_4   [label = "yes", fillcolor = green, style=filled];
c6_1   [label = "yes", fillcolor = green, style=filled];
c6_2   [label = "yes", fillcolor = green, style=filled];
c6_3   [label = "yes", fillcolor = green, style=filled];
c6_4   [label = "yes", fillcolor = green, style=filled];


c1 -> c2;
c2 -> c3_1; c3_1 -> c4_1_1; c4_1_1 -> c5_1 [label = "E" ]; c5_1 -> c6_1;
            c3_1 -> c4_1_2; c4_1_2 -> c5_2 [label = "F" ]; c5_2 -> c6_2;
c2 -> c3_2; c3_2 -> c4_2_1; c4_2_1 -> c5_3 [label = "G" ]; c5_3 -> c6_3;
            c3_2 -> c4_2_2; c4_2_2 -> c5_4 [label = "H" ]; c5_4 -> c6_4;


d1     [label = "(else)"];
d2     [label = "???", fillcolor = yellow, style=filled];
d3_1   [label = "no"];
d3_2   [label = "yes"];
d4_1_1 [label = "same"];
d4_1_2 [label = "different"];
d4_2_1 [label = "same"];
d4_2_2 [label = "different"];
d5_1   [label = "no", fillcolor = red, style=filled];
d5_2   [label = "no", fillcolor = red, style=filled];
d5_3   [label = "no", fillcolor = red, style=filled];
d5_4   [label = "no", fillcolor = red, style=filled];
d6_1   [label = "yes", fillcolor = green, style=filled];
d6_2   [label = "yes", fillcolor = green, style=filled];
d6_3   [label = "yes", fillcolor = green, style=filled];
d6_4   [label = "yes", fillcolor = green, style=filled];


d1 -> d2;
d2 -> d3_1; d3_1 -> d4_1_1; d4_1_1 -> d5_1 [label = "I" ]; d5_1 -> d6_1;
            d3_1 -> d4_1_2; d4_1_2 -> d5_2 [label = "J" ]; d5_2 -> d6_2;
d2 -> d3_2; d3_2 -> d4_2_1; d4_2_1 -> d5_3 [label = "K" ]; d5_3 -> d6_3;
            d3_2 -> d4_2_2; d4_2_2 -> d5_4 [label = "L" ]; d5_4 -> d6_4;
}

由于某种原因,它与
rank=same
声明冲突

尝试将其删除,并使用内部带有
rank=same
的集群,如下所示:

subgraph cluster_one {
  label="cluster one";
  rank=same;
  style=dotted;
  a1 b1 c1 d1
};

subgraph cluster_two {
  label="cluster two";
  rank=same;
  style=dotted;
  a2 b2 c2 d2
};
甚至更短(一行):


请记住,子图的宽度将不同于以往。

谢谢!作品,在广告的范围内(“记住……”),就像一个魅力!
subgraph cluster_one { label="cluster one" rank=same style=dotted a1 b1 c1 d1 }