[Tex/LaTex] Is this a TikZ bug

tikz-pgftikz-trees

I have this TikZ code:

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture} [
    level 1/.style={sibling distance = 2cm, level distance = 1cm},
    level 2/.style={sibling distance = 1cm},
    level 3/.style={sibling distance = 1cm},
    every node/.style={circle, draw=black, minimum size = 0.5cm},
    edge from parent/.style={red,thick,draw}
  ]

  \node{} 
  child { node {}
    child { node {} }
    child { node {}
      child { node {} }
      child { node {} }
    }
  }
  child { node {}
    child { node {} }
    child { node {} }
  }
  child { node {} }
  ;

\end{tikzpicture}
\end{document}

And it produces this picture:

buggy render

Why are the bottom nodes thick?

Best Answer

Styles are inherited to the child nodes. The manual addresses this in the note at the end of section 18.6. This happens in other places with Tikz as well.

The solution in this case would be to override it by specifying the style for "every node", i.e.

every node/.style={circle, draw=black, thin, minimum size = 0.5cm}

Note that "thin" is actually the normal line width.

Edit: Since there was a reply while I was looking things up, I thought I'd bring in some more information by quoting the relevant section in the manual;

Besides inserting the edge from parent path, the edge from parent operation has another effect: The options are inserted directly before the edge from parent path and the following style is also installed prior to inserting the path:

Note: The options inserted before the edge from parent path is added apply to the whole child path. Thus, it is not possible to, say, draw a circle in red as part of the child path and then have an edge to parent in blue. However, as always, the child node is a node and can be drawn in a totally different way.

For the follow up question regarding modifying specific paths. I would interpret the manual as you will have to do apply styles to nodes manually.

\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture} [
    level 1/.style={sibling distance = 2cm, level distance = 1cm},
    level 2/.style={sibling distance = 1cm},
    level 3/.style={sibling distance = 1cm},
    every node/.style={circle, draw=black, minimum size = 0.5cm}
   ]
  \begin{scope}[xshift=6cm, edge from parent/.style={red,thin,draw}]
    \node{}
    child { node {}
      child { node {} }
      child { node {} edge from parent[thick]
        child { node[thin] {} } % Overriding the inherited thick property.
        child { node[thin] {} } % Overriding the inherited thick property.
       }
    }
    child { node {}
      child { node {} }
      child { node {} }
    }
    child { node {} }
    ;
  \end{scope}
\end{tikzpicture}
\end{document}