How to get balanced diagrams from graphviz?

Posted by user360872 on Stack Overflow See other posts from Stack Overflow or by user360872
Published on 2010-06-23T22:06:28Z Indexed on 2011/01/12 21:53 UTC
Read the original article Hit count: 192

Filed under:

Is there a setting in graphviz to generate balanced diagrams like this:

correct diagram

When diagram is more complex like below - it isn't balanced like that above (4 is below **).

not correctly balanced

Code to generate second diagram:

graph
{
  n1 [label="+"];
  n1 -- n2;
  n2 [label="/"];
  n2 -- n3;
  n3 [label="*"];
  n3 -- n4;
  n4 [label="1"];
  n3 -- n5;
  n5 [label="2"];
  n2 -- n6;
  n6 [label="3"];
  n1 -- n7;
  n7 [label="**"];
  n7 -- n8;
  n8 [label="4"];
  n7 -- n9;
  n9 [label="5"];
}

© Stack Overflow or respective owner

Related posts about graphviz