无法绘制子图

Unable to get subgraphs drawn

digraph G {
    compound=true;

    subgraph SJC {
        node [style="filled"];  
        label = "SJC";
        channel [shape=cylinder];

    }
    subgraph Fleet {
        node [style="filled"];
        App1 [shape=cylinder];
        App2 [shape=cylinder];
        App3 [shape=cylinder];
        label = "Fleet of machines";
        style="filled";
        color="lightgrey";

    }

    App1 -> channel [ltail=SJC, lhead=Fleet];

}

通过上面的代码,我的期望是得到子图对应的2个容器框。但是,我得到的图像如下:

此外,我收到了两个警告。

Warning: cluster named Fleet not found
Warning: cluster named SJC not found

有两个错误:

  1. 如另一个 post 中所述,子图名称中缺少前缀“cluster”。
  2. 尾巴和头颠倒了

这是您更正后的代码:

digraph G {
compound=true;

subgraph cluster_SJC {
    node [style="filled"];  
    label = "SJC";
    channel [shape=cylinder];
}

subgraph cluster_Fleet {
    node [style="filled"];
    App1 [shape=cylinder];
    App2 [shape=cylinder];
    App3 [shape=cylinder];
    label = "Fleet of machines";
    style="filled";
    color="lightgrey";
}

App1 -> channel [lhead=cluster_SJC, ltail=cluster_Fleet];

}

我的 "cylinders" 呈现为框。从来没有让圆柱形状在 graphviz 2.38.0 中工作。

子图名称前的 cluster_ 约定是一种 dot 语言结构,并非所有引擎都支持。