title: Graphviz - aligning nodes and clusters
body: <p>I'm trying to draw a finite state diagram with Graphviz but I cannot get it like I want it. Here's what I have written so far : </p>
  
  <pre><code>digraph G {
      rankdir = LR;
  
      subgraph cluster_op1 {
  
          subgraph cluster_0 {
              1 -&gt; 2 [label="a"]  
          }
  
          subgraph cluster_1 {
              3 -&gt; {4 6} [label="&amp;epsilon;"]
              4 -&gt; 5 [label="b"]
              5 -&gt; 4 [label="&amp;epsilon;"]
              5 -&gt; 6 [label="&amp;epsilon;"]
          }
  
          subgraph cluster_2 {
              7 -&gt; {8 10} [label="&amp;epsilon;"]
              8 -&gt; 9 [label="c"]
              9 -&gt; 8 [label="&amp;epsilon;"]
              9 -&gt; 10 [label="&amp;epsilon;"]
          }   
  
          2 -&gt; 3 [label="&amp;epsilon;"]
          6 -&gt; 7 [label="&amp;epsilon;"]
      }
  
      subgraph cluster_op2 {
  
          subgraph cluster_3 {
              11 -&gt; {12 14} [label="&amp;epsilon;"]
              12 -&gt; 13 [label="ab"]
              13 -&gt; 12 [label="&amp;epsilon;"]
              13 -&gt; 14 [label="&amp;epsilon;"]
          }   
  
          subgraph cluster_4 {
              15 -&gt; 16 [label="c"]    
          }
  
          14-&gt;15 [label="&amp;epsilon;"]
      }
  
      0 -&gt; {1 11} [label="&amp;epsilon;"]
      {10 16} -&gt; 17 [label="&amp;epsilon;"]
  }
  </code></pre>
  
  <p>Here's what it looks like : 
  <a href="https://i.stack.imgur.com/nBrPb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nBrPb.png" alt="enter image description here"></a></p>
  
  <p>What I want is : </p>
  
  <ol>
  <li>All the nodes within <code>cluster_op1</code> to be aligned horizontally (same for <code>cluster_op2</code>)</li>
  <li><code>cluster_op2</code> to be centered below <code>cluster_op1</code></li>
  <li>The edges from node <code>0</code> to <code>cluster_op1</code> and <code>cluster_op2</code> to be the same length (same for the edges from those two clusters to node <code>17</code>)</li>
  </ol>