Graphviz子图不会被可视化

我试图创build一个图中有两个子图的点。 代码如下:

digraph G { subgraph step1 { style=filled; node [label="Compiler"] step1_Compiler; node [label="Maschine"] step1_Maschine; color=lightgrey; } subgraph step2 { style=filled; color=lightgrey; node [label="Interpretierer"] step2_Interpretierer; node [label="Maschine"] step2_Maschine; label="Virtuelle Maschine"; } "Programm (Java)" -> step1_Compiler; step1_Compiler -> step1_Maschine; step1_Maschine -> "Bytecode"; "Bytecode" -> step2_Interpretierer; step2_Interpretierer -> step2_Maschine; step2_Maschine -> "Ergebnis"; } 

我得到的结果如下所示:

以上代码的结果

我期望看到两个子图周围的框。 我在这里错过了什么?

您必须在集群中为子图的名称添加前缀:

 subgraph clusterstep1 { 

 subgraph clusterstep2 { 

以获得风格和标签。

从graphiz文档中,“子图和集群”部分 :

子图的第三个angular色直接涉及如何通过某些布局引擎来布局图。 如果子图的名称以簇开始,则Graphviz将子图logging为特殊的子图 。 如果支持,布局引擎将执行布局,以便将属于该集群的节点绘制在一起,并将集群的整个graphics包含在边界矩形内。 请注意,对于好的和坏的,聚类子图不是DOT语言的一部分,而只是某些布局引擎遵守的语法规则。