どのように私は正しくラテックス中の私のAVLツリーを表示することができますか?ソロ左の子供がまっすぐに垂れ下がっ
質問
以下のコードは、ほぼ完璧に動作し、9しかし子、7、まっすぐの代わりに左の子としてハング。私はこれを修正するにはどうすればよい?
\usepackage{tikz}
\usepackage{xytree}
\begin{tikzpicture}[level/.style={sibling distance=60mm/#1}]
\node [circle,draw] {4}
child {
node [circle,draw] {2}
child {node [circle,draw] {1}
}
child {
node [circle,draw]{3}
}
}
child {node [circle,draw] {6}
child {node [circle,draw] {5}
}
child {node [circle,draw] {9}
child {node [circle, draw] {7}}
}
};
\end{tikzpicture}}
おかげで、CB
解決 2
提案としては、TikZマニュアルと相談した後、私は次のようにこれを修正することができました。
\begin{tikzpicture}[level/.style={sibling distance=60mm/#1}]
\node [circle,draw] {4}
child {
node [circle,draw] {2}
child {node [circle,draw] {1}
}
child {
node [circle,draw]{3}
}
}
child {node [circle,draw] {6}
child {node [circle,draw] {5}
}
child {node [circle,draw] {9}
child {node [circle, draw] {7}}
child [missing]
}
};
\end{tikzpicture}
他のヒント
以下のコードは、私のために動作します。それは変化に、あなたのコードに基づいています。
1)は、TikZライブラリの木を使用し、 2)単一ノードの書式の変更(ノード7)
より多くの情報がは、TikZマニュアルを参照してください。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[level/.style={sibling distance=60mm/#1}]
\node [circle,draw] {4}
child {
node [circle,draw] {2}
child {node [circle,draw] {1}
}
child {
node [circle,draw]{3}
}
}
child {node [circle,draw] {6}
child {node [circle,draw] {5}
}
child {node [circle,draw] {9}
child[grow via three points={one child at (-1,-1) and two children at (-.5,1) and (.5,1)}] {node [circle, draw] {7}}
}
};
\end{tikzpicture}
\end{document}
所属していません StackOverflow