Here's the code I have
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\tikzset{
treenode/.style = {align=center, inner sep=0pt, text centered,
font=\sffamily},
arn_n/.style = {treenode, circle, white, font=\sffamily\bfseries, draw=black,
fill=black, text width=1.5em},% arbre rouge noir, noeud noir
arn_r/.style = {treenode, circle, red, draw=red,
text width=1.5em, very thick},% arbre rouge noir, noeud rouge
arn_x/.style = {treenode, rectangle, draw=black,
minimum width=0.5em, minimum height=0.5em}% arbre rouge noir, nil
}
\begin{document}
\begin{tikzpicture}[->,>=stealth',level/.style={sibling distance = 5cm/#1,
level distance = 1.5cm}]
\node [arn_n] {1}
child{ node [arn_r] {2}
child{ node [arn_n] {4}
child{ node [arn_r] {6}}
child{ node [arn_r] {7}}
}
child{ node [arn_r] {3} edge from parent node[above left]
{$x$}
}
;
\end{tikzpicture}
\end{document}
I want to write something beside each arrow… I tried using edge from parent node[above left]{$x$}
But it messes up the whole thing, probably cause I'm inserting it in the wrong location.
Plus, I wanna write something beside each circle.. Is there a way to do that too?
Help please!
Best Answer
A
forest
version just because: