I have a problem with my graph and my background environment to highlight the edges in the "last" of my slides.
First I tried this:
\begin{frame}
\frametitle{Graphmodell Beispiel}
\tikzstyle{vertex}=[circle,fill=white!25,minimum size=20pt,inner sep=0pt]
\tikzstyle{selected vertex} = [vertex, fill=red!24]
\tikzstyle{edge} = [draw,thick,-]
\tikzstyle{weight} = [font=\small]
\tikzstyle{selected edge} = [draw,line width=5pt,-,red!50]
\tikzstyle{ignored edge} = [draw,line width=5pt,-,black!20]
\begin{figure}
\begin{tikzpicture}[every node/.style={circle,draw},level 1/.style={sibling distance=30mm},level 2/.style={sibling distance=20mm}
]
%\tikzstyle{every node}=[circle,draw]
\only<1,2>{\node[vertex] (1) {1}
child {node[vertex] (2) {2}
child{node[vertex] (3){3}}
child{node[vertex] (4){4}}
}
child { node[vertex] (5) {5}
child {node[vertex](6) {6}}
child {node[vertex] (7){7}
child{node[vertex] (8){8}}
child{node[vertex] (9){9}}
}
}};
\only<3>{\node[vertex, label=right:$T_{k}$] (1) {1}
child {node[vertex, label=left:$T_{k-in}$] (2) {2}
child{node[vertex] (3){3}}
child{node[vertex] (4){4}}
}
child { node[vertex, label=right:$T_{k-out}$] (5) {5}
child {node[vertex](6) {6}}
child {node[vertex] (7){7}
child{node[vertex] (8){8}}
child{node[vertex] (9){9}}
}
}};
\begin{pgfonlayer}{background}
\pause
\foreach \source / \dest in {1/2,2/4,1/5,5/7,7/8}
\path[selected edge] (\source.center) -- (\dest.center);
\end{pgfonlayer}
\end{tikzpicture}
\end{figure}
\visible<3->{\begin{center}Fahrzeug $k \in k^{+}$ mit Start-Endpunktvektor $(4,8)$\end{center}}
\end{frame}
It worked just fine besides the fact that the graph was switching the positions slightly because of using \only instead of \visible.
But when I replace \only with \visible I don't know how to "background" my edges any more, because it gives me the error that the vertices aren't found.
\begin{frame}
\frametitle{Graphmodell Beispiel}
\tikzstyle{vertex}=[circle,fill=white!25,minimum size=20pt,inner sep=0pt]
\tikzstyle{selected vertex} = [vertex, fill=red!24]
\tikzstyle{edge} = [draw,thick,-]
\tikzstyle{weight} = [font=\small]
\tikzstyle{selected edge} = [draw,line width=5pt,-,red!50]
\tikzstyle{ignored edge} = [draw,line width=5pt,-,black!20]
\begin{figure}
\begin{tikzpicture}[every node/.style={circle,draw},level 1/.style={sibling distance=30mm},level 2/.style={sibling distance=20mm}
]
%\tikzstyle{every node}=[circle,draw]
\node{{\visible<1>{[vertex] (1) {1}
child {node[vertex] (2) {2}
child{node[vertex] (3){3}}
child{node[vertex] (4){4}}
}
child { node[vertex] (5) {5}
child {node[vertex](6) {6}}
child {node[vertex] (7){7}
child{node[vertex] (8){8}}
child{node[vertex] (9){9}}
}
}}}};
\only<3>{\node[vertex, label=right:$T_{k}$] (1) {1}
child {node[vertex, label=left:$T_{k-in}$] (2) {2}
child{node[vertex] (3){3}}
child{node[vertex] (4){4}}
}
child { node[vertex, label=right:$T_{k-out}$] (5) {5}
child {node[vertex](6) {6}}
child {node[vertex] (7){7}
child{node[vertex] (8){8}}
child{node[vertex] (9){9}}
}
}};
\begin{pgfonlayer}{background}
\pause
\foreach \source / \dest in {1/2,2/4,1/5,5/7,7/8}
\path[selected edge] (\source.center) -- (\dest.center);
\end{pgfonlayer}
\end{tikzpicture}
\end{figure}
\visible<3->{\begin{center}Fahrzeug $k \in k^{+}$ mit Start-Endpunktvektor $(4,8)$\end{center}}
\end{frame}
Does anybody know how to get out of this trouble?
P.S: Thanks Claudio for the format. I understood that you just have to indent inside the code
