tags:

views:

74

answers:

2

Why is graphviz drawing C to the right of B? I want it to look like

A
B E
C

instead.

digraph  {
    compound=true
    subgraph cluster_1 { a -> b }
    b -> c
    {rank=same b -> e  }
}

alt text

+2  A: 

Because it would increase the total area of the graph, which is what graphviz tries to minimize. You can try to use different layout utilities in the packages such as lefty or neato to see if you get better results.

Vlad
+2  A: 

I'm not sure you can do what you're looking for.

When dot lays out the given graph, it treats cluster_1 as a single entity for the purposes of ranking. So, if you like, cluster_1 has rank 0. Then because you say {rank=same b, e}, e also has rank 0. When dot draws c, c will have a higher rank - rank 1 - so it will be drawn below e. Because it has no need to worry about space in the x-axis at this point, it draws c right below e.

If you want node c to definitely be drawn below everything else you could add

{ rank=sink c }

which... doesn't look as great as what you're aiming at.

Frank Shearar