0

I'm trying to get the following dot file to output two subgraphs. I want the bLoop node in cluster0 to align with the ISR struct in cluster 2. I'm using an invisible node to do this now, but with the unintended consequence of lot of gray space left in cluster0.

Is there a way to do what I want without the invisible node? I can't post images yet, so here's the link.

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];
}
RYS
  • 442
  • 6
  • 22

1 Answers1

2

you need helper nodes to get the correct rank for 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];
}

enter image description here

stefan
  • 3,681
  • 15
  • 25