\begin{tikzpicture}[
level 1/.style={sibling distance=2.2cm, level distance=0.8cm}, % 第1层子节点之间水平间距2.6cm,第一层和第二层之间高度1cm
level 2/.style={sibling distance=1.2cm, level distance=0.8cm}, % 第2层子节点间距
level 3/.style={sibling distance=1.2cm, level distance=0.8cm},
line width=0.7pt,
% 普通节点样式(带圆圈)
node style/.style={
circle, draw, minimum size=1.7em,
line width=0.7pt, inner sep=2.5pt
},
% NULL节点样式(无圆圈)
null node/.style={minimum size=1.7em}
]
% 根节点A(普通样式)
\node[node style] (A) {\ttfamily A}
% 子节点B(普通样式)
child {node[node style] (B) {\ttfamily B}
child {node[null node] {\ttfamily NULL}} % NULL无圆圈
child {node[null node] {\ttfamily NULL}}
}
child {node[node style] (C) {\ttfamily C}
child {node[null node] {\ttfamily NULL}}
child {node[node style] (D) {\ttfamily D}
child {node[null node] {\ttfamily NULL}}
child {node[null node] {\ttfamily NULL}}
}
};
\end{tikzpicture}
代码运行生成的图如下:
