0

I’ve got four subgraphs that I’d like to (a) have the same width and (b) be aligned vertically (red > yellow > green > purple). I can’t figure out how to do that. Here is the dot code, simplified for clarity:

digraph {
    rankdir = "TB";
    compound=true;
    node [shape=box, style=filled,color=white];
    subgraph cluster_pre_proto_greek {
        label="Pre-Proto-Greek";
        style=filled;
        color=red;
        c1 [label = "1. Change of word-final *ms to *ns"];
        c2 [label = "2. Loss of word-final *i̯ after a long vowel"];
        c3 [label = "3. Change of dental stop to *s before dental stop"];
    }
    subgraph cluster_pre_proto_attic_ionic {
        label="Pre-Proto-Attic-Ionic";
        style=filled;
        color=yellow;
        c4 [label = "4. Merger of *K̑ with *K"];
        c5 [label = "5. Merger of *Ku̯ and *Kʷ"];
        c6 [label = "6. Loss of laryngeals"];
    }
    subgraph cluster_pre_homeric {
        label="Pre-Homeric";
        style=filled;
        color=green;
        c7 [label = "7. Early vowel contractions and rise of tones"];
        c8 [label = "8. Metathesis of *TK to *KT"];
        c9 [label = "9. Vowel epenthesis before word-initial *r"];
    }
    subgraph cluster_homeric {
        label="Homeric";
        style=filled;
        color=purple;
        c10 [label = "10. Devoicing of voiced aspirates"];
        c11 [label = "11. Vocalisation of syllabic sonorants before vowel or *i̯"];
        c12 [label = "12. Vocalisation of syllabic nasals"];
    }

    c1 -> c12;
    c3 -> c6;
    c3 -> c9;
    c4 -> c5;
    c5 -> c11;
    c6 -> c7;
    c6 -> c11;
    c6 -> c12;
    c7 -> c8;
    c9 -> c10;
    c10 -> c11;
    c10 -> c12;
    c11 -> c12;
}

And here is the output (from edotor.net):

Graphviz Graph (updated)

Any help is greatly appreciated!

Edit: Here is what I’d like to get at:

Graphviz Graph: modified

thomas
  • 1
  • 2
  • This is challenging (see https://gitlab.com/graphviz/graphviz/-/issues/1930). How should "Homeric" appear - width-wise? Padded horizontally to match "Pre-Proto-Greek"? all nodes on the same rank? or what? – sroush Jun 04 '21 at 22:14
  • All subgraphs, including “Homeric”, should have the same width. The internal nodes of “Homeric” are fine. I’ve added a graph showing approximately the output I’d like to get. – thomas Jun 05 '21 at 06:43

1 Answers1

0

I believe the problem comes about because it is trying to minimize the vertical height, a way to fix this is to pass minlen=2 to some of the edges so try:

c1 -> c12
c3 -> c6;
c3 -> c9;
c4 -> c5;
c5 -> c11;
c6 -> c7 [minlen=2];
c6 -> c11;
c6 -> c12;
c7 -> c8;
c9 -> c10 [minlen=2];
c10 -> c11;
c10 -> c12;
c11 -> c12;

You can also try commenting out various edges to see what effect they are having on the final image, and you can add constraint=false if you want to remove it's effect.

bio_dan
  • 78
  • 5