This is just to honorably mention one option that does not seem to have been mentioned above: trees from the graphdrawing
library. The advantage is a short code, the disadvantage is that you have to use lualatex
.1 Here is an example.2
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
\begin{document}
\begin{tikzpicture}[rn/.style={label={[anchor=center,circle,draw,minimum
size=5pt,inner sep=0pt]center:}},
graphs/every graph/.style={anchor at={(0,0.5em-0.5*\pgfmatrixcurrentrow*1em)},
empty nodes,tree layout,level distance=1em, sibling
distance=1em,grow=90,nodes={circle,fill,minimum size=3pt,inner sep=0pt,outer sep=0pt}}]
\matrix[row sep=1em,column sep=1em]{
\node{1}; & \graph { 1[rn]}; \\
\node{2}; & \graph { 1[rn]--2}; \\
\node{3}; & \graph[anchor at={(0,-1em)}] { 1[rn]--2--3}; &
\graph { 1[rn]--{2,3}}; \\
\node{4}; & \graph { 1[rn]--2--3--4}; &
\graph { 1[rn]--2--{3,4}};
& \graph { 1[rn]--{2,3--4}};
& \graph { 1[rn]--{2,3,4}};\\
};
\end{tikzpicture}
\end{document}
1To avoid lengthy discussions: I am not suggesting that there is something wrong with lualatex
. However, you cannot upload the above to the arXiv, which is IMHO a disadvantage.
2I am not a big fan of posts without an explicit example that allows one to back up the statements.