Cross-cluster ranks w/o intermediate nodes?

Is it possible to get dot to obey node ranks across different clusters?

E.g., is there a way for this:

strict digraph "Cross cluster ranks" {
subgraph "cluster A" { A1; A3; label = "A"; }
subgraph "cluster B" { B2; label = "B"; }
A1 -> B2 -> A3;
}

To render similarly to this:

strict digraph "Cross cluster ranks" {
subgraph "cluster A" {
A1; A3; label = "A";
A2 [ shape = point, style = invis ];
}
subgraph "cluster B" { B2; label = "B"; }
A1 -> B2 -> A3;
A1 -> A2 -> A3 [ style = invis ];
}

I realize the workaround "works", however, in my real case the graph is generated. To add the intermediate nodes, I need to run a predictor on the rank of each node in my graph to decide where and how many intermediate nodes and edges to add, which "is far from being easy" (especially when we add nested clusters into the mix).

Set the newrank attribute to

Set the newrank attribute to true, or run dot -Gnewrank.

Recent comments