3
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];

}

With the above code, my expectation is to get 2 container boxes corresponding to the subgraph. However, I am getting the image as follows:

enter image description here

Also, I am getting two warnings.

Warning: cluster named Fleet not found
Warning: cluster named SJC not found
dknight
  • 1,243
  • 10
  • 23

2 Answers2

2

There were two errors:

  1. As explained in another post, the prefix "cluster" was missing in the name of subgraph.
  2. The tail and head were reversed.
dknight
  • 1,243
  • 10
  • 23
2

Here's your corrected code:

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];

}

My "cylinders" render as boxes. Never gotten the cylinder shape to work in graphviz 2.38.0.

The cluster_ convention before the subgraph name is a dot language construct that is not supported by all engines. enter image description here

TomServo
  • 7,248
  • 5
  • 30
  • 47