Estoy empezando a usar LaTeX para un curso de teoría de grafos que sigo en la universidad. Logré construir este árbol, solo me faltan las flechas (que deberían apuntar hacia abajo en todos los bordes).
\begin{tikzpicture}[level/.style={sibling distance=30mm/#1}]
\node [circle,draw] {1}
child {node [circle,draw] {2}
child {node [circle,draw] {5}}
child {node [circle,draw] {6}}
child {node [circle,draw] {7}}
}
child {node [circle,draw] {3}
}
child {node [circle,draw] {4}
child {node [circle,draw] {8}}
child {node [circle,draw] {9}}
child {node [circle,draw] {10}}
};
\end{tikzpicture}
Respuesta1
Sólo necesitas definir el estilo para los bordes:
\documentclass[tikz, margin=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[
level/.style={sibling distance=30mm/#1},
edge from parent/.style={->,draw} % <----
]
\node [circle,draw] {1}
child {node [circle,draw] {2}
child {node [circle,draw] {5}}
child {node [circle,draw] {6}}
child {node [circle,draw] {7}}
}
child {node [circle,draw] {3}
}
child {node [circle,draw] {4}
child {node [circle,draw] {8}}
child {node [circle,draw] {9}}
child {node [circle,draw] {10}}
};
\end{tikzpicture}
\end{document}
Se puede lograr un resultado similar utilizando el paquete forest
dedicado a dibujar diagramas de árbol:
\documentclass[margin=3mm]{standalone}
\usepackage{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
for tree = {
circle, draw,
minimum size=1.5em,
inner sep=2pt,
%
s sep=3mm,
l sep=7mm,
edge={-Straight Barb} % arrows head defined in 'arrows.meta'
}
[1
[2
[5]
[6]
[7]
]
[3,fit=band]
[4
[8]
[9]
[10]
]
r
]
\end{forest}
\end{document}