Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphviz – horizontal edges between nodes

Good evening, I'm trying to generate graph using graphviz.

I can't figure out how to model horizontal edges between some nodes. I use the next code to generate this graph:

Graph

digraph{ rankdir=LR;
//{rank=same; "[0]"; "[10B1]"; "[62]"; "[8]"; "[9]"; "[10]";}
"[0]"->"[37]"; "[37]"->"[4]"; "[37]"->"[8]";
"[8]"->"[9]"; "[9]"->"[10]"; "[62]"->"[8]";
"[0]"->"[10B1]"; "[10B1]"->"[62]"; "[0]"->"[2]";
"[2]"->"[3]"; "[7]"->"[8]"; "[4]"->"[7]";
}

I would like to align the nodes [8], [10B1], [62] [8], [9] and [10] in one horizontal line.

like image 676
Nanik Avatar asked Apr 29 '12 17:04

Nanik


1 Answers

You need to place those nodes in a cluster. Inside that cluster, you can then set rank=lr to have the nodes placed left-to-right. It's important that you define the cluster and the nodes you want in it before you add the connecting edges to the rest of the graph.

like image 63
apmasell Avatar answered Oct 13 '22 08:10

apmasell