I have a dot file in which I create subgraph clusters which I want to appear in a specific order, let's say I have this:
digraph G {
splines=true;
sep="+25,25";
overlap=scalexy;
nodesep=0.6;
subgraph cluster_2 {
label="ADD_MORE_PROBLEMS";
subgraph cluster_3 {
label="pattern";
N1 [label="problem"];
}
subgraph cluster_4 {
label="replacement";
N2 [label="problem"];
N3 [label="problem"];
}
}
}
Which creates:
How do I ensure that "pattern" appears to the left of "replacement" (I may have an arbitrary number of subgraphs).
Clusters are one of the odd cases where simply the ordering in the code makes most (if not quite all) of the difference. If we simply reorder your code like this:
digraph G {
splines=true;
sep="+25,25";
overlap=scalexy;
nodesep=0.6;
subgraph cluster_2 {
label="ADD_MORE_PROBLEMS";
subgraph cluster_4 {
label="replacement";
N2 [label="problem"];
N3 [label="problem"];
}
subgraph cluster_3 {
label="pattern";
N1 [label="problem"];
}
}
}
that makes all the difference.
Now, that can fail, in which case setting up invisible edges is one of the more common solutions.