graphviz - 如何显示相同的节点标题
问题描述
我想像在 Wiki 1中一样绘制 RB-Tree ,
但我找不到为不同节点显示相同标题的可能性(在本例中为 nil - 节点)。有可能的?
digraph "rb-tree"{
bgcolor = whitesmoke;
forcelabels = true;
margin = 0;
node [shape = circle,
style = filled,
fontsize = 14,
margin = 0,
fillcolor = black,
fontcolor = white];
edge [fontsize = 10,
arrowhead = vee];
8 [fillcolor = red];
17 [fillcolor = red];
nil_8l [shape = box];
nil_8r [shape = box];
nil_17l [shape = box];
nil_17r [shape = box];
13->8;
13->17;
8->nil_8l;
8->nil_8r;
17->nil_17l;
17->nil_17r;
}
解决方案
Graphiz 可以设置标签。所以使用:
digraph "rb-tree"{
bgcolor = whitesmoke;
forcelabels = true;
margin = 0;
node [shape = circle,
style = filled,
fontsize = 14,
margin = 0,
fillcolor = black,
fontcolor = white];
edge [fontsize = 10,
arrowhead = vee];
8 [fillcolor = red];
17 [fillcolor = red];
nil_8l [shape = box label="nil"];
nil_8r [shape = box label="nil"];
nil_17l [shape = box label="nil"];
nil_17r [shape = box label="nil"];
13->8;
13->17;
8->nil_8l;
8->nil_8r;
17->nil_17l;
17->nil_17r;
}
推荐阅读
- curl - cURL 提供了添加 URL 片段的选项?
- macos - Xprinter xp-370b - 从 OS X 打印
- protocols - SSH 和 HTTP 有什么区别?
- google-bigquery - BigQuery 联合数据源:命令行界面中的 CSV 选项?
- node.js - 如何检查 Express Framework 中的请求中是否存在至少一个文件
- c# - ASP.NET Boilerplate 多个数据库和 DbContexts
- swift - iOS12 sirishortcut-成功捐赠交互但在App下设置sir&search找不到
- java - 从休眠 3 升级到休眠 5 后出现 InvalidDataAccessApiUsageException
- zend-framework - 使用 RowGateway 创建行
- android - 如何在android中找到谷歌浏览器的绝对路径