Force node to be directly beneath another node
You can enumerate the nodes before defining the edges, and then constrain node B
to the same rank as node note
by putting them in a subgraph:
digraph "Test" {
rankdir = "LR"
A;D;
{rank=same; note; B;}
C;
A -> B
B -> C
D -> B
B -> note [dir=back]
note [ shape="house" ]
};
Please note that in order to have node note
below node B
, I had to reverse the edge direction and add dir=back
to have the arrow drawn correctly.
A general technique for moving nodes around is to create invisible edges. In your case, you could create an edge from A
to note
, mark it invisible, and then mark the edge from note
to B
as non-constraining:
A -> note [style="invis"];
note -> B [constraint=false];