Graphviz – horizontal edges between nodes

dotgraphgraphviz

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.

Best Answer

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.

Related Topic