我想在Wiki 1,中绘制RB-树
但是我找不到为不同节点(在本例中为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;
}
答案 0 :(得分:1)
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;
}