我想将其绘制为 TikZ:
\
\
+---+---+
| * | * |
+/--+---\
/ \
1 +---+---+
| * | * |
+/--+---\
/ \
2 +---+---+
| * | * |
+/--+---+
/
3
我尝试了各种方法来制作“带有分隔线的空矩形,但都无济于事......
答案1
这是一个帮助您入门的简单示例:
\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{
graphs,
graphdrawing,
shapes.multipart
}
\usegdlibrary{trees}
\tikzset{
link/.style={
rectangle split,
rectangle split horizontal,
rectangle split parts=2,
draw,
/tikz/graphs/as={\nodepart{two} \footnotesize\texttt{*ptr}},
}
}
\begin{document}
\tikz \graph [tree layout] {
head [draw, as=\emph{head}] -- {
link1 [link] -- {
1,
link2 [link] -- {
2,
link3 [link] -- {
3,
link4 [link]
}
}
}
}
};
\end{document}