-
Notifications
You must be signed in to change notification settings - Fork 7
/
postgres-real-btree.dot
88 lines (83 loc) · 3.65 KB
/
postgres-real-btree.dot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Example B-Tree graph
//
// Breadth-first order
//
// Start from root, go left to right
//
// Workflow:
//
// $ dot -T svg btree.dot -o btree.svg;
digraph nbtree {
graph [fontname = "monospace"];
node [shape = none,height=.1,fontname = "monospace",fontsize=8];
// Level 1 (root level)
// Downlinks + highkey:
rootnode[ label=<<table>
<tr>
<td bgcolor='burlywood' port="s0">-∞</td>
<td bgcolor='white' port="d0">↧</td>
<td bgcolor='burlywood' port="s1">367, <font color="blue">'-∞'</font></td>
<td bgcolor='white' port="d1">↧</td>
<td bgcolor='burlywood' port="s2">733, <font color="blue">'-∞'</font></td>
<td bgcolor='white' port="d2">↧</td>
<td bgcolor='burlywood' port="hk">+∞</td>
</tr>
</table>
>
];
// Downlink arrows to children:
"rootnode":d0 -> "leafnode_1":t0
"rootnode":d1 -> "leafnode_2":t0
"rootnode":d2 -> "leafnode_3":t0
// sibling pointer:
// (None)
// Level 0 (leaf level)
leafnode_1[ label=<<table>
<tr>
<td bgcolor='darkseagreen1' port="t0">1, <font color="blue">'(0,1)'</font></td>
<td bgcolor='darkseagreen1' port="t1">2, <font color="blue">'(0,2)'</font></td>
<td border="0" bgcolor='white' port="t2">...</td>
<td bgcolor='darkseagreen1' port="t1">366, <font color="blue">'(5,61)'</font></td>
<td bgcolor='burlywood' port="hk">367, <font color="blue">'-∞'</font></td>
</tr>
<tr>
<td colspan="5" border="0" bgcolor='white'>366 non-pivot items & high key</td>
</tr>
</table>
>
];
// sibling pointer:
"leafnode_1" -> "leafnode_2"[constraint=false,color=black,style=dashed,arrowsize=0.5]
leafnode_2[ label=<<table>
<tr>
<td bgcolor='darkseagreen1' port="t0">367, <font color="blue">'(6,1)'</font></td>
<td bgcolor='darkseagreen1' port="t1">368, <font color="blue">'(6,2)'</font></td>
<td border="0" bgcolor='white' port="t2">...</td>
<td bgcolor='darkseagreen1' port="t3">732, <font color="blue">'(11,61)'</font></td>
<td bgcolor='burlywood' port="hk">733, <font color="blue">'-∞'</font></td>
</tr>
<tr>
<td colspan="5" border="0" bgcolor='white'>366 non-pivot items & high key</td>
</tr>
</table>
>
];
// sibling pointer:
"leafnode_2" -> "leafnode_3"[constraint=false,color=black,style=dashed,arrowsize=0.5]
leafnode_3[ label=<<table>
<tr>
<td bgcolor='darkseagreen1' port="t0">733, <font color="blue">'(12,1)'</font></td>
<td bgcolor='darkseagreen1' port="t1">734, <font color="blue">'(12,2)'</font></td>
<td border="0" bgcolor='white' port="t2">...</td>
<td bgcolor='burlywood' port="hk">+∞</td>
</tr>
<tr>
<td colspan="4" border="0" bgcolor='white'>2+ non-pivot items, implicit +∞ high key</td>
</tr>
</table>
>
];
//Force alignment from root to internal to leaf levels:
edge[style=invis];
"rootnode":d1 -> "leafnode_2":t2
}