Reputation: 21
Coming from this graph:
digraph G {
a0 -> a1 -> a2;
x0 -> x1;
b0 -> b1 -> b2;
}
which is giving this graphical representation:
a 0 x 0 b 0
| | |
a 1 x 1 b 1
| |
a 2 b 2
I'd like to connect a2 to x1 and x1 to b2.
So I tried:
digraph G {
a0 -> a1 -> a2;
x0 -> x1;
b0 -> b1 -> b2;
a2 -> x1 [constraint=false];
x1 -> b2 [constraint=false];
}
My expectation would be this:
a 0 x 0 b 0
| | |
a 1 x 1 b 1
| / \ |
a 2 b 2
But unfortunately it is rendered like this and I have no clue why.
a 0 b 0 x 0
| | |
| | |
| | |
a 1 b 1 x 1
| | _ / /
| + /
| _/ | /
a 2 b 2
How can I gain a better understanding of why is that and help me to keep x0 -> x1 in the middle of the graph?
Upvotes: 2
Views: 313
Reputation: 21
Using constraint=false seems to lead to 'special' results.
The following graph gives the desired result. Looks like structuring the nodes in it's natural ranking and using dir=back works much better.
digraph G {
a0 -> a1 -> a2;
x0 -> x1;
b0 -> b1 -> b2;
x1 -> a2 [dir=back];
x1 -> b2;
}
Upvotes: 0
Reputation: 9587
Adding {rank=same; a0 -> x0 -> b0 [style=invis];}
to your graph gives the desired result - this forces the top nodes to be in a specific order, but hides the edges added to do this. I have absolutely no idea why this should be necessary, however.
Upvotes: 2