# Tikz tree and position of single leaf in binary tree

I am constructing a binary tree which looks as follows:

\begin{tikzpicture}
\node {root}
child {  node {left}   }
child {  node {right}
child { node {rightmost} }
}  ;
\end{tikzpicture}


In case of single children, as is the case with "rightmost", the edges are just pointing down. I'd like to influence the position of the single edge and node so that they are slanted as if they had a sibling:

How would I do that?

-
Welcome to TeX.SE! – cmhughes Nov 23 '12 at 19:11

One way is to use the missing option. This method is probably the most natural considering what you want to achieve : "as if there was a sibling".

\begin{tikzpicture}
\node {root}
child {  node {left}   }
child {  node {right}
child[missing] {node {}}
child { node {rightmost} }
}  ;
\end{tikzpicture}


Output :

The following code does the trick as well, making use of the right option.

\begin{tikzpicture}
\node {root}
child {  node {left}   }
child {  node {right}
child[right] { node {rightmost} }
}  ;
\end{tikzpicture}


And the output :

Note that the alignment of edges looks better with the first option. The reason is that missing is a tree-specific option, which asks tikz to act "as if there was a sibling", and as such it doesn't depend on the content of the nodes for the alignment.

On the other hand, as I understand it, right is an option which is passed to the node, and has it placed relatively to its leftmost edge, instead of its center. This option doesn't affect the rest of the tree nor depend on it, that's why the output is less satisfying.

-
I found that the missing child doesn't need to have a node. I.e., instead of child[missing] {node {}} you could also use child[missing] {}. – Camil Staps Nov 3 '15 at 11:50
Even without the {} seems to work fine. – Camil Staps Nov 3 '15 at 12:32