Graphviz / Dot - 如何标记具有独特颜色的树中的所有叶子? [英] Graphviz/Dot - how to mark all leaves in a tree with a distinctive color?

查看:636
本文介绍了Graphviz / Dot - 如何标记具有独特颜色的树中的所有叶子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将图形打印为.dot文件的脚本。我想用不同的颜色突出所有不同程度的顶点。是否可以使用Graphviz?



所以,我对以下内容感兴趣:

 对于每个i度顶点使用颜色[i]。 

作为一种特殊情况,如何在具有独特颜色的树中标记所有叶子? :

 对于每个1度顶点使用color_A。 


解决方案

尝试使用graphviz实用程序gvpr编写图形脚本。
特别是,

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

你可以增强这个定义一个数组(或关联图)和查找颜色[$。度]

Stephen North


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 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

这篇关于Graphviz / Dot - 如何标记具有独特颜色的树中的所有叶子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆