graphviz - Dot language with concentrate=true confusing the graph -
i draw simple graph shown below , found different behavior of color display.
digraph g { concentrate=true edge [dir=none] -> b [color=red] b -> c c -> b b -> }
graph show edge between , b red >> 1 correct.
but when change
digraph g { concentrate=true edge [dir=none] -> b b -> c c -> b b -> [color=red] }
this time color of edge , b black not red color want. figure out wrong here?
analysis
because code in question draws 2 edges 1 on top of other, color of last edge drawn wins. layout engine dot works either bottom top or right left. means last edge drawn first 1 listed.
general solution
dot draws digraphs. undirected graph can simulated using dir=none
there should 1 edge:
digraph g { concentrate=true edge [dir=none] -> b [color=red] b -> c }
alternative
keep in mind dir=none
not intended display property. if goal 2 directed edges, dir=both
better alternative:
digraph g { concentrate=true edge [dir=both] -> b [color="red:black"] b -> c [color="black:black] }
notes
it useful conceptually separate modeling graph display properties. dot doesn't make particularly easy because encourages inlining style information. price of separating concerns pays off in debugging time.
Comments
Post a Comment