0
votes

I have following graph:

digraph G {
    rankdir=TB
    subgraph cluster_1 {
      label = "cluster1"
      1; 2; 3; 4; 5; 6; 7; 8; 9; 10;
    }
    subgraph cluster_2 {
      label = "cluster2"
      11; 12; 13; 14; 15;
    }
    subgraph cluster_3 {
      label = "cluster3"
      16; 17; 18; 19; 20; 21;
    }
  7 -> {10, 3, 4}
  10 -> 9
  4 -> {1, 6, 5, 2}
  4 -> 13
  8 -> {3, 4}
  13 -> {11, 12}
  11 -> {16, 14, 15}
  16 -> {17, 19, 20, 21, 18}
}

The output I see is: enter image description here

How I can place all clusters strictly vertically?

1

1 Answers

0
votes

Unfortunately, there is no single attribute to accomplish what you want. But if you add these 3 lines to your graph:

  edge [style=invis]
  {6 1} -> 13
  {14 15} ->16

You get this:
enter image description here