dknight
dknight

Reputation: 1243

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

}

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

Upvotes: 3

Views: 861

Answers (2)

TomServo
TomServo

Reputation: 7409

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

Upvotes: 2

dknight
dknight

Reputation: 1243

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.

Upvotes: 2

Related Questions