0

I'm having a hard time trying to figure out how to align two graphs in graphviz. I'm using dot and below is the code I'm using.

digraph {
//rank=same;
q1 [shape="doublecircle"];
q2 [shape="doublecircle"];
q0->q1 
q0->q1 
q0->q1 
q1->q2 

rankdir=LR
node [shape=plaintext]
subgraph cluster_01 {
//rank=sink
label = "key";
key [label=<<table border="0" cellpadding="2" cellspacing="0" cellborder="0">
  <tr><td align="left" port="i1"></td></tr>
  <tr><td align="left" port="i2"></td></tr>
  <tr><td align="left" port="i3"></td></tr>
  <tr><td align="left" port="i4"></td></tr>
  </table>>]
}

I would like the table that is the key to be under the nodes. And I would like my nodes to line up horizontally. I've been messing with rank=same to get the nodes to go horizontally and rank=sink to get the key to be under the nodes. Any help is appreciated, I've been stuck on this for too long. Thanks.

ddiez
  • 1,087
  • 11
  • 26
user2743
  • 1,423
  • 3
  • 22
  • 34

1 Answers1

0

To have the node key under the nodes:

The order of appearance of the nodes in the script matters. In this case, if you simply define your key before the other nodes (q0, q1, ...), it will appear under those nodes.

The other nodes already align horizontally (they are on the same horizontal line).

marapet
  • 54,856
  • 12
  • 170
  • 184