I want to create graphs representing processes so the order of the nodes is important.
I'm struggling with graphviz logic for ordering clusters subgraphs and nodes. I'm using the graphviz python library to automate rendering. Each time I render the same code the result is not the same.
digraph G {
graph [rankdir=LR]
subgraph cluster_0 {
subgraph cluster_start {
start;
}
subgraph cluster_1 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
A00;
A0;
A1;
A2;
A3;
A00 -> A0;
A00 -> A1;
A1 -> A2;
A0 -> A3;
label = "process #1";
}
subgraph cluster_2 {
node [style=filled];
B00;
B0;
B1;
B2;
B3;
B00 -> B0;
B00 -> B1;
B1-> B3;
B0 -> B2;
label = "process #2";
}
subgraph cluster_end {
end;
}
start -> A00 [constraint=false];
A00 -> B00 [constraint=false];
B00-> end [constraint=false];
}
}
I've searched for hours but Graphviz still renders the graphs randomly. In some cases I will have what I want as the graph below.
But many times I will have

The things I'm quite certain about is I want to use the rankdir LR to display my nodes horizontally in clusters. I tried setting a high weight on 'vertical' edges or grouping first nodes of each clusters but it still displays my graph's clusters randomly and I'm quite frustrated about being unable to arrange thoses graphs as I want and this example is a very simple one compared to much more complex processes I want to represent
I have no other clue of what can impact the clusters positions. Any help or clue about what to check would be so much apreciated
