Graphviz/Dot - 如何用独特的颜色标记树上的所有叶子?

发布于 2024-11-17 07:11:42 字数 254 浏览 8 评论 0原文

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

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

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

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

For each 1-degree vertex use color_A.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三五鸿雁 2024-11-24 07:11:42

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

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

您可以增强它来定义数组(或关联映射)并查找 color[$. Degree]

Stephen North

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文