Graphviz выравнивает подграфы по горизонтали

У меня есть следующий код:

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

Все работает идеально, за исключением того, что подграфы не отображаются. Как только ранг определяется вне кластеров, подграфы исчезают.

введите здесь описание изображения

Если он определен внутри тела кластера, один и тот же ранг между кластерами теряется.


person user1491229    schedule 11.05.2015    source источник


Ответы (1)


  • rankdir применимо только на уровне графика
  • узел может принадлежать только одному кластеру

.

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

дает

введите здесь описание изображения

person stefan    schedule 12.05.2015