title: How to keep nodes on the same rank using Python and Graphviz?
body: <p>So apparently the way to keep certain nodes in GraphViz on the same level is to use something like:</p>
  
  <p><code>{rank = same; n5; n6; n7; n8;}</code></p>
  
  <p>However, I'm trying to automate all of this inside Python using:
  <a href="https://graphviz.readthedocs.io/en/stable/index.html" rel="nofollow noreferrer">https://graphviz.readthedocs.io/en/stable/index.html</a></p>
  
  <p>And while I can figure out how to add basic attributed to the graph (such as a label), I cannot figure out how to specify that certain nodes need to be in the same rank from inside Python!  I know that this can be done, but I cannot figure out the syntax.  If you see here:
  <a href="http://graphviz.readthedocs.io/en/stable/manual.html#attributes" rel="nofollow noreferrer">http://graphviz.readthedocs.io/en/stable/manual.html#attributes</a></p>
  
  <p>It even says that you can use "rank=same."  So I know that it can be done, but I just cannot figure out how to do it.</p>
  
  <p>Can somebody please provide a working example in Python where they specify that certain nodes are on the same rank (where they normally wouldn't be if the specification hadn't been made)?  Thank you very much</p>