Проблема с выравниванием двух кластеров с использованием Graphviz и Dot

Я пытаюсь получить следующий точечный файл для вывода двух подграфов. Я хочу, чтобы узел bLoop в кластере 0 выравнивался со структурой ISR в кластере 2. Сейчас я использую для этого невидимый узел, но с непреднамеренным последствием большого количества серого пространства, оставшегося в кластере 0.

Есть ли способ сделать то, что я хочу, без невидимого узла? Я пока не могу публиковать изображения, поэтому вот ссылка.

digraph G {
    ranksep=.75;
    nodesep = 1.5;
     node [shape = none]
    node[fontsize=16,fixedsize=false,width=0.7,shape=rectangle];
    edge[fontsize=16];
    ratio=fill;
    splines=false;  

    compound=true;
        subgraph cluster0 {
            node [style=filled];
            style=filled;
            color=lightgrey;
            label = "Setup and Background Loop";

            a0[label = "Peripheral Configs"];
            a1[label = "Solar Library Block Configs"];
            a2[label = "Enable Interrupts"];
            bgLoop[label = "Start Background Loop"];
            e0[shape=rectangle, style=invis, fixedsize=true, width=.01];

            a0 -> a1 -> a2 -> bgLoop;
            bgLoop ->e0[style=invis]

        }

        subgraph cluster1 {
                node [style=filled, shape = "doublecircle"];
                start
                style="invis"
            }

        subgraph cluster2 {
            node [shape=record,color=white];
            style=filled;
            color=lightgrey;
            label = "ISRs";
            struct1 [shape = record, color=white, label="{<f1> Slow ISR | <f2> Fast ISR }"]; 
        }

    concentrate = true;


    struct1 -> bgLoop[lhead=cluster0, ltail=cluster4,  constraint=true];
    bgLoop -> struct1[lhead=cluster4, ltail=cluster0, constraint=true];
    struct1 -> e0[style=invis, constraint=true];
    start -> a0[lhead=cluster0];
}

person RYS    schedule 04.02.2015    source источник


Ответы (1)


вам нужны вспомогательные узлы, чтобы получить правильный ранг для struct1.

digraph G {
    ranksep=.75;
    nodesep = 1.5;
    node[fontsize=16,fixedsize=false,width=0.7,shape=rectangle];
    edge[fontsize=16];
    compound=true
        subgraph cluster2 { rank="max"
            node [shape=record,color=white];
            style=filled;
            color=lightgrey;
            label = "ISRs";
            struct1 [shape = record, color=white, label="{<f1> Slow ISR | <f2> Fast ISR }"]; 
        }

        subgraph cluster0 {
            node [style=filled];
            style=filled;
            color=lightgrey;
            label = "Setup and Background Loop";

            a0[label = "Peripheral Configs"];
            a1[label = "Solar Library Block Configs"];
            a2[label = "Enable Interrupts"];
            bgLoop[label = "Start Background Loop"];

            a0 -> a1 -> a2 -> bgLoop;

        }

        subgraph cluster1 {
                node [style=filled, shape = "doublecircle"];
                start
                style="invis"
            }


    {node [style=invis]; 0; 1; 2; 3; }
    {edge [style=invis]; 0->1->2->3->struct1; }

    struct1 -> bgLoop[lhead=cluster0, ltail=cluster2, constraint=false];
    bgLoop -> struct1[lhead=cluster2, ltail=cluster0, constraint=false];
    start -> a0[lhead=cluster0];
}

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

person stefan    schedule 09.03.2015