\documentclass[paper=a4, fontsize=10pt]{article} % A4
\usepackage{tikz}
\tikzstyle{every node}=[circle,draw]
\begin{document}
\begin{tikzpicture}[level/.style={sibling distance=50mm/#1}]
\node {6}
child {
child {
node {2} edge from parent node[left,draw=none] {0}
}
child {
node {2} edge from parent node[right,draw=none] {1}
}
node {2} edge from parent node[left,draw=none] {0}
}
child {
node {$4$}
};
\end{tikzpicture}
\end{document}
What happens here is that the node (2) are edges inside the circle... for some reason. Is there a way to automatically label 0 for left and 1 for right?
Updated the code to :
\begin{forest}
for tree={
if n=1{edge label={node [midway, left, anchor=south] {0} } }{edge label={node [midway, right, anchor=south] {1} } },
draw,
circle,
if level=0{}{!u.s sep/.wrap pgfmath arg={#1}{35mm/(level())}},
anchor=mid,
}
[6
[2
[2
[1]
[1]
]
]
[4
[2]
]
]
\end{forest}


0a child node. But you want it, I think, to be anedge label. – cfr 8 hours agofrench, paper=a4, fontsize=10ptnot being valid options. – cfr 8 hours ago