# Beamer + TikZ-foreach: Every step a new frame on handout

I'm preparing a presentation with Beamer and TikZ to explain Dijkstra. The following graph is explored step by step and for each step there's a new frame.

\tikzstyle{vertex}=[circle,fill=black!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}[scale=1.8, auto,swap]
\foreach \pos/\name in {{(0,2)/A}, {(2,1)/B}, {(4,1)/C},
{(0,0)/D}, {(3,0)/E}, {(2,-1)/F}, {(4,-1)/G}}
\node[vertex] (\name) at \pos {$\name$};
\foreach \source/ \dest /\weight in {B/A/7, C/B/8,D/A/5,D/B/9,
E/B/7, E/C/5,E/D/15,
F/D/6,F/E/8,
G/E/9,G/F/11}
\path[edge] (\source) -- node[weight] {$\weight$} (\dest);
\foreach \vertex / \fr in {A/2,D/3,B/4,F/5,E/6,C/7,G/8}
\path<\fr-> node[selected vertex] at (\vertex) {$\vertex$};
\end{tikzpicture}
\end{figure}


Now I'm looking for the same behavior for particularly this part of the presentation with the handout-option turned on. Does anybody have an idea?

Thanks a lot!

To include partially uncovered frames in the handout you can use the following trick:

\documentclass[handout]{beamer}

\begin{document}
\begin{frame}<handout:1->
step 1

\onslide<all:2>{step 2}
\end{frame}

\end{document}


(The code fragment from your questions does not compile, necessary packages etc are missing, so I replaced it with this dummy example)