This is a common request and to-date there is no guaranteed “fix”.
After many failed attempts, here is a pretty clean solution. It uses constraint=false, rank=same, and the group attributes.
[the input has also been edited to make it easier for me to read]
digraph {
rankdir=LR;
node[style=filled, fillcolor=white]
// success by using both group & constraint
subgraph cluster1 {
bgcolor=grey;
4 [fillcolor=yellow]
5 [fillcolor=red]
6 [fillcolor=lightblue]
7 [fillcolor=orange]
8 [fillcolor=lime]
9 [fillcolor=pink]
11 [fillcolor=violet group=S]
14 [fillcolor=magenta group=S]
13 [fillcolor=lightgreen]
12 [fillcolor=lightgrey]
{rank=same
edge [constraint=false]
4 -> 5 -> 6 -> 7 -> 8 -> 9
}
{rank=same
10 11
}
{rank=same
edge [constraint=false]
12 -> 13 -> 14
}
6 -> 10
6 -> 11
10 -> 12
10 -> 13
10 -> 14
}
1 -> 2
1 -> 3
2 -> 4
2 -> 5
2 -> 6
2 -> 7
2 -> 8
2 -> 9
14 -> 15
}
Giving: