开发者

Graphviz/Dot - how to mark all leaves in a tree with a distinctive color?

开发者 https://www.devze.com 2023-03-16 02:12 出处:网络
I have a script which prints a graph as .dot file. I would like to highlight all vertices of different degree with distinctive colors. Is it possible with Graphviz?

I have a script which prints a graph as .dot file. I would like to highlight all vertices of different degree with distinctive colors. Is it possible with Graphviz?

So, I am interested in the following:

For each i-degree vertex use color[i].

and as a special case, how to mark all leaves in a tree with开发者_C百科 a distinctive color? :

For each 1-degree vertex use color_A.


Try the graphviz utility gvpr for writing graph scripts. In particular,

gvpr -c 'N[degree==1]{color="red"}'

You can enhance this to define an array (or associative map) and look up color[$.degree]

Stephen North

0

精彩评论

暂无评论...
验证码 换一张
取 消