I'm trying to draw the following (suffix-tree) using GraphViz:
digraph G {
1[label = " "];
2[label = " "];
3[label = " "];
4[label = " "];
5[label = " "];
6[label = " "];
7[label = " "];
8[label = " "];
// edges drawn vertically, all fine.
1 -> 2 [label="ab"];
1 -> 3 [label=" b"];
1 -> 4 [label=" c$"];
2 -> 5 [label="abc$"];
2 -> 6 [label="c$"];
3 -> 7 [label=" abc$"];
3 -> 8 [label="c$"];
// node 3 should be on the right side of node 2, and
// a cross line should be drawn horizontally
2 -> 3 [style=dotted,label="abc$"];
}
The problem is, that the node reached by following edges "abc$" and "b" is not on the same height like those 2 nodes reached by following "ab" and "c$".
Has annyone encountered the same situation and could share a solution?
Ah well, didnt search for the proper terms! "placing nodes on a horizontal line", offers a solution.
This code now positions the nodes 2,3,4 properly on the same "horizontal line".
digraph G {
1[label = " "];
2[label = " "];
3[label = " "];
4[label = " "];
5[label = " "];
6[label = " "];
7[label = " "];
8[label = " "];
node[group=sameheight];
{ rank = same; 2; 3; 4; }
1 -> 2 [label="ab"];
1 -> 3 [label=" b"];
1 -> 4 [label=" c$"];
2 -> 3 [style=dotted];
2 -> 5 [label="abc$"];
2 -> 6 [label="c$"];
3 -> 7 [label=" abc$"];
3 -> 8 [label="c$"];
}
Hope it helps someone.