Why is graphviz drawing C to the right of B?
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 http://grab.by/开发者_如何学JAVA33m4
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.
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.
精彩评论