Here is a proposal. You can add and remove elements from the list of edges with the pgf keys `add edges` and `remove edges`, respectively. Since you are saying that you want to draw the result each time, this is built into these keys. Adding and removing is achieved by steering the visibility via `overlay-beamer-styles`.
```
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles}
\makeatletter
\tikzset{tgraph/.cd,nstep/.initial=0,
initialize/.code={\tikzset{tgraph/nstep=0}},
next/.code={\edef\pgfutil@tmpb{\the\numexpr\pgfkeysvalueof{/tikz/tgraph/nstep}+1}%
\tikzset{tgraph/nstep=\pgfutil@tmpb}%
},
edges/.initial={},
add edges/.code={\tikzset{tgraph/next}%
\edef\pgfutil@tmpa{\pgfkeysvalueof{/tikz/tgraph/edges}}%
\ifx\pgfutil@tmpa\pgfutil@empty
\edef\pgfutil@tmpa{#1}%
%\typeout{empty}%
\else
\edef\pgfutil@tmpa{\pgfutil@tmpa,#1}%
\fi
\tikzset{tgraph/edges=\pgfutil@tmpa}%
\tikzset{tgraph/draw edges={visible on=<\pgfkeysvalueof{/tikz/tgraph/nstep}>}}%
},
remove edges/.code={\tikzset{tgraph/next}%
\pgfutil@for\pgfutil@tmpg:={#1}\do{%
\edef\pgfutil@tmph{\noexpand\@removeelement{\pgfutil@tmpg}{\pgfkeysvalueof{/tikz/tgraph/edges}}{\noexpand\pgfutil@tmpd}}%
\pgfutil@tmph
\tikzset{tgraph/edges=\pgfutil@tmpd}%
}%
\tikzset{tgraph/draw edges={visible on=<\pgfkeysvalueof{/tikz/tgraph/nstep}>}}%
},
draw edges/.code={%
\edef\pgfutil@tmpd{\pgfkeysvalueof{/tikz/tgraph/edges}}%
\ifx\pgfutil@tmpd\pgfutil@empty
\typeout{No edges specified.}
\else
\path[#1] foreach \pgfutil@tmpe/\pgfutil@tmpf in \pgfutil@tmpd
{ (\pgfutil@tmpe) edge[tgraph/Edge] (\pgfutil@tmpf)};
\fi}}
\makeatother
\begin{document}
\begin{frame}
\frametitle{Title}
\tikzset{% \tikzstyle is deprecated
vertex/.style={very thick,draw=black, circle,minimum size=18pt,inner sep=0pt},
tgraph/Edge/.style={draw,thick,-}}
\begin{figure}
\begin{tikzpicture}[scale=1.8, auto,swap]
% First we draw the vertices
\path 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$}};
%{b/a,c/b,d/a,d/b,e/b, e/c,e/d,f/d,f/e,g/e,g/f},
\tikzset{tgraph/.cd,add edges={b/a},add edges={c/b},
add edges={d/a},remove edges={b/a,c/b},
add edges={b/a,c/b,d/b,e/b},remove edges={d/b}}
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
```
![ani.gif](/image?hash=af51eace976f6653eae60aea284e0d15af3ccff1cf80a6b0fa12394b4565f0c6)