# [Tex/LaTex] TikZ Tree: Change style of specific tree edges

tikz-stylestikz-trees

I want to change the style of some edges of my tree. I want a dashed red path from to root to one leaf of my tree. But if I change some specific edges, all edges below also change. Even the labels are getting red what I do not want.

So that is what happens:

But I want something like that:

Any suggestions? It can't be so hard. But I spend over an hour trying to find out. Here is my code:

\documentclass[border=10pt,svgnames]{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning,automata,backgrounds}
\definecolor{light-gray}{gray}{0.6}

\begin{document}
\centering
\begin{tikzpicture}[level distance=1.5cm,
level 1/.style={sibling distance=3cm},
level 2/.style={sibling distance=1cm},
level 3/.style={sibling distance=1cm},
every node/.style={thin}]
\node {1}
child {node {00}
child {node {00}}
child {node {}}
child {node {10}}
child {node {}}
}
child {node {}}
child {node {10}
child {node {00} edge from parent[dashed, very thick, red]
child {node {00}}
child {node {01}}
child {node {10}}
child {node {11} edge from parent[dashed, very thick, red]}
}
child {node {}}
child {node {}}
child {node {11}}
}
child {node {}};
\end{tikzpicture}
\end{document}


You can use Forest package with a simple syntax to customize every edges of your tree, just insert edge options like this

edge={dashed,red,thick}


Complete code

\documentclass[border=10pt,svgnames]{standalone}
\usepackage{forest}

\begin{document}

\begin{forest}
for tree={delay={where content={}{content={\phantom{00}}}{}},s sep+=5mm,l+=5mm}
[1
[00
[00]
[]
[10]
[]
]
[]
[10,edge={dashed,red,thick}
[00,edge={dashed,red,thick}
[00]
[01]
[10]
[11,edge={dashed,red,thick}]
]
[]
[]
[11]
]
[\phantom{00}]
]
\end{forest}

\end{document}