I have the following code:
digraph G {
bgcolor=antiquewhite;
compound=true;
{
rankdir=LR ;
rank=same g0 p1 p2 p3 h1;
}
subgraph cluster0 {
style=filled;
color=khaki;
g0 [label="G",shape=circle,style="filled", color="red", fillcolor="lightpink"]
label = "Cluster 0";
g0 -> p1;
}
subgraph cluster1 {
style=filled;
color=khaki;
p1 [label="S2",shape=box,style="filled", color="blue", fillcolor="skyblue"];
p2 [label="S3",shape=box,style="filled", color="blue", fillcolor="skyblue"];
p3 [label="S3",shape=box,style="filled", color="blue", fillcolor="skyblue"];
label = "Cluster 1";
p1 -> p2 -> p3 [arrowhead=none] ;
}
subgraph cluster2 {
style=filled;
color=khaki;
h1 [label="h1",shape=box,style="invis"];
label = "Cluster 2";
p3 -> h1;
}
}
Everything works perfect except the subgraphs don't show up. As soon as rank is defined outside the clusters the subgraphs disappear.
If defined inside a cluster body, same rank between clusters is lost.
rankdir
is only applicable at graph level.
digraph G {
rankdir=LR ;
bgcolor=antiquewhite;
compound=true;
subgraph cluster0 {
style=filled;
color=khaki;
g0 [label="G",shape=circle,style="filled", color="red", fillcolor="lightpink"]
label = "Cluster 0";
}
subgraph cluster1 {
style=filled;
color=khaki;
p1 [label="S2",shape=box,style="filled", color="blue", fillcolor="skyblue"];
p2 [label="S3",shape=box,style="filled", color="blue", fillcolor="skyblue"];
p3 [label="S3",shape=box,style="filled", color="blue", fillcolor="skyblue"];
label = "Cluster 1";
p1 -> p2 -> p3 [arrowhead=none] ;
}
subgraph cluster2 {
style=filled;
color=khaki;
h1 [label="h1",shape=box,style="invis"];
label = "Cluster 2";
}
g0 -> p1;
p3 -> h1;
}
gives
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With