dot - children order in graphviz tree -
i have following tree:
digraph g { subgraph cluster0{ 37[label="+"]; 42[label="a"]; 44[label="b"]; 47[label="*"]; 46[label="c"]; 49[label="d"]; 51[label="e"]; 53[label="f"]; 55[label="g"]; 57[label="h"]; 61[label="*"]; 60[label="i"]; 63[label="j"]; 37 -> 42[label="c"]; 37 -> 44[label="c"]; 37 -> 47[label="c"]; 37 -> 61[label="c"]; 42 -> 37[label="p"]; 44 -> 37[label="p"]; 47 -> 37[label="p"]; 47 -> 46[label="c"]; 47 -> 49[label="c"]; 47 -> 51[label="c"]; 47 -> 53[label="c"]; 47 -> 55[label="c"]; 47 -> 57[label="c"]; 46 -> 47[label="p"]; 49 -> 47[label="p"]; 51 -> 47[label="p"]; 53 -> 47[label="p"]; 55 -> 47[label="p"]; 57 -> 47[label="p"]; 61 -> 37[label="p"]; 61 -> 60[label="c"]; 61 -> 63[label="c"]; 60 -> 61[label="p"]; 63 -> 61[label="p"]; } }
output here: http://i.imgur.com/q1qxkct.png
order of children in first *
subtree is: g h c d e f
, should c d e f g h
. have noticed if delete subgraph cluster0{
order right, can't way. can suggest other solution?
graphviz attempts retain lexical ordering of nodes when there no other constraint. however, edge labels can affect placement take space , can push nodes around.
if have specific order essential, try
{ rank = same; 46 -> 49 -> 51 -> 53 -> 55 -> 57 [style = invis]; }
to introduce additional ordering constraint graph.
you need careful though, can distort more complex graphs in ways difficult predict.
Comments
Post a Comment