*here in the topic I may use terms incorrectly, but I try to explain in my words, so feel free to suggest me how to use it correctly.

I have graphs like these:

```
digraph {
rankdir=LR;
A1
A2
A3
B1
B2
B3
C1
C2
C3
A1 -> B1
B1 -> C1
//A1 -> B2
A1 -> A2
A1 -> A3
A2 -> A3
B1 -> B2
B2 -> B3
B1 -> B3
B2 -> A2
//B3 -> C2
C1 -> C2
C2 -> C3
//B1 -> C2
C3 -> B2
}
```

I like that arrows are constraints here (I mean, node A2 goes right of the B2).

But I donâ€™t like that A,B,C-nodes are mixed between each other vertically.

I want that all A-nodes are placed on its own â€ślineâ€ť (rank?) and only A-nodes are placed in this horizontal area.

All B-nodes = in B-line, under A-lineâ€¦

All C-nodes = in C-line, under B-lineâ€¦

In the certain order, defined manually and strictly for each node.

Now B and C nodes are mixed in one â€ślineâ€ť.

I tried clusters with the code below.

I like that A-nodes are placed on the same â€ślevelâ€ť and A-nodes are not mixed with B-nodes vertically, B-nodes not mixed with C-nodes.

But I donâ€™t like that links between nodes of the different clusters donâ€™t work as constraintsâ€¦

I donâ€™t like that B2 is placed under A2.

I want A2 to be placed right of the B2 due to the corresponding arrow.

I also would like to have control over placing B1 under C1, or C1 right of the B1, or C1 under B2, but it is somehow shown under B3.

```
digraph {
rankdir=LR;
subgraph cluster_1 {
A1
A2
A3
}
subgraph cluster_2 {
B1
B2
B3
}
subgraph cluster_3 {
C1
C2
C3
}
A1 -> B1
B1 -> C1
A1 -> B2
A1 -> A2
A1 -> A3
A2 -> A3
B1 -> B2
B2 -> B3
B1 -> B3
B2 -> A2
B3 -> C2
C1 -> C2
C2 -> C3
}
```

I also tried using rank=same AND groups and it looks better, but I donâ€™t understand how to ensure that the edges work as constraints so that B2 goes right after C3, not on the same level.

```
digraph {
rankdir=TB;
{rank=same; A1; A2; A3}
{rank=same; B1; B2; B3}
{rank=same; C1; C2; C3}
A1 [group=1]
A2 [group=2]
A3
B1 [group=1]
B2 [group=2]
B3
C1 [group=1]
C2
C3 [group=2]
A1 -> B1
B1 -> C1
//A1 -> B2
A1 -> A2
A1 -> A3
A2 -> A3
B1 -> B2
B2 -> B3
B1 -> B3
B2 -> A2
//B3 -> C2
C1 -> C2
C2 -> C3
//B1 -> C2
C3 -> B2
}
```

If I remove the group, the arrow from C3 goes left to B2, but I want this arrow to go right to B2 and B2 should be placed right, on a new rank(?) to obey constraint of the edge.

By the way, sometimes I will need this backward arrows, and sometimes I donâ€™t need them.

I expected to do it using constraint=true/false.

But even with default value, it doesnâ€™t take place.