这是我目前所拥有的,但是我不确定如何从连接节点 A 和 B 的边绘制到新节点 G 的边:
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
[sibling distance=12em,level distance=6em,
every node/.style={shape=rectangle,draw,align=center}]
\node{A}
child{node{B}
child{node{C}
child{node{E}}}
child{node{D}
child{node{F}}}};
\end{tikzpicture}
\end{document}
提前致谢!
答案1
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
[sibling distance=12em,level distance=6em,
every node/.style={shape=rectangle,draw,minimum width=3em,rounded corners,
align=center}]
\node (A) {A}
child{node{B}
child{node{C}
child{node{E}}}
child{node{D}
child{node{F}}}};
\path (A) -- node[right=6em] (G){G} (A-1) (G) edge (G-|A);
\end{tikzpicture}
\end{document}