Graphviz - 默认子图/簇样式

Graphviz - default subgraph / cluster style

目前我总是这样写subgraphs/clusters:

subgraph "cluster_001" {
    rank = TB;
    style = "filled";
    color = "#EEEEEE";
    004[label = "{<1>if\(gt \> 0\)|<2>else if\(gt == 0\)|<3>else if\(gt \< 0\)}"];
    005[label = "..."];
    006[label = "..."];
    007[label = "..."]
}

但我不喜欢这样。我不想为每个 subgraph/cluster 输入前三行。有没有办法只定义一次 subgraph/cluster 样式?就像为箭头所做的那样:

edge[
    fontname = "IBM Plex Mono Bold",
    style = "dotted",
    fontsize = 8,
    arrowhead = normal,
    arrowsize = 0.4,
    penwidth = 0.1;
    fontcolor = "#444444",
    color = "#777777",
]

我定义了一次,然后每个箭头都是这样设计的。这成为默认值。

我需要类似的集群...如何实现?

令我惊讶的是,有一种内置方式。把这个放在你的集群定义之前:

graph[ rank = TB;  style = "filled";   color = "#EEEEEE";]  

像这样:

digraph d {
  a -> b
  graph[ rank = TB;  style = "filled";   color = "#EEEEEE";]
  subgraph cluster1 {
   x1 ->x2->x3
   }
     subgraph cluster2 {
   y1 ->y2->y3
   }
     subgraph cluster3 {
   z1 ->z2->z3
   }
  {rank=same e->f}
}

给予: