The Tikz manual gives "edge from parent" construct.
But it is peculiar (it changes all the edges in subtree and some nodes).
How to color and thicken exactly one edge?
Asked
Active
Viewed 1.2k times
13
Łukasz Lew
- 8,543
- 12
- 43
- 42
1 Answers
13
As Mikael mentioned in his answer to your previous question, I don't think this is actually a bug, but simply how TikZ works. So the solution to the problem is to change a specific branch, and then change it back on its daughters. As you ask in your comment, you can define two styles for plain and emphasized edges respectively, to save you some typing:
\documentclass{article}
\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,thin, minimum size = 0.5cm},
emph/.style={edge from parent/.style={red,very thick,draw}},
norm/.style={edge from parent/.style={black,thin,draw}}
]
\begin{scope}[xshift=6cm]
\node{}
child[emph] { node {}
child[norm] { node {} }
child[norm] { node {}
child[emph] { node {} }
child { node {} }
}
}
child { node {}
child { node {} }
child { node {} }
}
child { node {} }
;
\end{scope}
\end{tikzpicture}
\end{document}
Harry Richman
- 103
Alan Munn
- 218,180

edge from parent/style)from the example above, the lower emphasised branch is no longer emphasised. – Alan Munn Jan 20 '11 at 22:04emphfor every node. How can i make this option general?. – Fadwa Apr 16 '14 at 02:52emphandnormstyles, just useedge from parent/.style={red, very thick,draw}. – Alan Munn Apr 16 '14 at 03:33