add tag
topnush
Take this code:

```
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\makeatletter
\newcommand*{\slideinframe}{\number\beamer@slideinframe}
\makeatother

\def\mylistE{{"$\infty/$null", 0, 0, 0, 0, 0, 0}}
\def\mylistD{{"$\infty/$null", "$\infty/$null", "3/E", "3/E", "3/E", "3/E", "3/E"}}
\def\mylistB{{"$\infty/$null", "$\infty/$null", "$\infty/$null", "6/E", "5/F", "5/F", "5/F"}}
\def\mylistF{{"$\infty/$null", "$\infty/$null", "$\infty/$null", "$\infty/$null", "2/E", "2/E", "2/E"}}
\def\mylistC{{"$\infty/$null", "$\infty/$null", "$\infty/$null", "$\infty/$null", "$\infty/$null", "4/E", "4/E"}}
\def\mylistA{{"$\infty/$null", "$\infty/$null", "$\infty/$null", "$\infty/$null", "$\infty/$null", "3/D"}}



\begin{document}

\begin{frame}
\frametitle{Demonstration}
\begin{tikzpicture}
\begin{scope}[every node/.style={fill=black, text=white, circle,thick,draw, minimum size=1.2cm}]
    \node[label={[xshift=0em, yshift=-1em, text=black]  \pgfmathparse{\mylistA[\slideinframe-1]}\pgfmathresult}]  (A) at (0,5) {A};
    \node[label={[xshift=0em, yshift=-1em, text=black] \pgfmathparse{\mylistB[\slideinframe-1]}\pgfmathresult}]  (B) at (5,5) {B};
    \node[label={[xshift=0em, yshift=-1em, text=black] \pgfmathparse{\mylistC[\slideinframe-1]}\pgfmathresult}]  (C) at (10,5) {C};
    \node[label={[xshift=0em, yshift=-6em, text=black] \pgfmathparse{\mylistD[\slideinframe-1]}\pgfmathresult}]  (D) at (0,0) {D};
    \node[label={[xshift=0em, yshift=-6em, text=black] \pgfmathparse{\mylistE[\slideinframe-1]}\pgfmathresult}]  (E) at (5,0) {E};
    \node[label={[xshift=0em, yshift=-6em, text=black]  \pgfmathparse{\mylistF[\slideinframe-1]}\pgfmathresult}]  (F) at (10,0) {F} ;
\end{scope}

\begin{scope}[>={Stealth[black]},
              every node/.style={fill=white,circle},
              every edge/.style={draw=red,very thick}]
    \path [-] (A) edge node {$1$} (B);
    \path [-] (D) edge node {$2$} (B);
    \path [-] (A) edge node {$3$} (D);
    \path [-] (D) edge node {$3$} (E);
    \path [-] (E) edge node {$2$} (F);
    \path [-] (E) edge node {$6$} (B);
    \path [-, pos=0.25] (E) edge node {$4$} (C);
    \path [-] (B) edge node {$3$} (C);
    \path [-, pos=0.25] (B) edge node {$5$} (F);
    \path [-] (F) edge node {$4$} (C);
\end{scope}
\end{tikzpicture}
\pause[6]
\end{frame}
\end{document}
```

How can I make the E node to be red from the second transition, the F node to be red from the 5th transition, the D node to be red from the 6th (I will then add all the other transitions later).
Top Answer
samcarter
Using the `overlay-beamer-styles` library, you can add things like `alt=<2->{red}{black},text=white` to your node to change the colour on certain overlays

You might also want to ensure that your labels above and blow the nodes all have the same height with something like `minimum height=1.7cm` to avoid the image jumping around.

```
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{overlay-beamer-styles}

\def\mylistE{{"$\infty/$null", 0, 0, 0, 0, 0, 0}}
\def\mylistD{{"$\infty/$null", "$\infty/$null", "3/E", "3/E", "3/E", "3/E", "3/E"}}
\def\mylistB{{"$\infty/$null", "$\infty/$null", "$\infty/$null", "6/E", "5/F", "5/F", "5/F"}}
\def\mylistF{{"$\infty/$null", "$\infty/$null", "$\infty/$null", "$\infty/$null", "2/E", "2/E", "2/E"}}
\def\mylistC{{"$\infty/$null", "$\infty/$null", "$\infty/$null", "$\infty/$null", "$\infty/$null", "4/E", "4/E"}}
\def\mylistA{{"$\infty/$null", "$\infty/$null", "$\infty/$null", "$\infty/$null", "$\infty/$null", "3/D"}}

\begin{document}

\begin{frame}
\frametitle{Demonstration}
\begin{tikzpicture}
\begin{scope}[every node/.style={fill=black, text=white, circle,thick,draw, minimum size=1.2cm}]
    \node[label={[xshift=0em, yshift=-1em, text=black,minimum height=1.7cm]  \pgfmathparse{\mylistA[  \insertslidenumber-1]}\pgfmathresult}]  (A) at (0,5) {A};
    \node[label={[xshift=0em, yshift=-1em, text=black,minimum height=1.7cm] \pgfmathparse{\mylistB[  \insertslidenumber-1]}\pgfmathresult}]  (B) at (5,5) {B};
    \node[label={[xshift=0em, yshift=-1em, text=black,minimum height=1.7cm] \pgfmathparse{\mylistC[  \insertslidenumber-1]}\pgfmathresult}]  (C) at (10,5) {C};
    \node[label={[xshift=0em, yshift=-6em, text=black,minimum height=1.7cm] \pgfmathparse{\mylistD[  \insertslidenumber-1]}\pgfmathresult},alt=<6->{red}{black},text=white]  (D) at (0,0) {D};
    \node[label={[xshift=0em, yshift=-6em, text=black,minimum height=1.7cm] \pgfmathparse{\mylistE[  \insertslidenumber-1]}\pgfmathresult},alt=<2->{red}{black},text=white]  (E) at (5,0) {E};
    \node[label={[xshift=0em, yshift=-6em, text=black,minimum height=1.7cm]  \pgfmathparse{\mylistF[  \insertslidenumber-1]}\pgfmathresult},alt=<5->{red}{black},text=white]  (F) at (10,0) {F} ;
\end{scope}

\begin{scope}[>={Stealth[black]},
              every node/.style={fill=white,circle},
              every edge/.style={draw=red,very thick}]
    \path [-] (A) edge node {$1$} (B);
    \path [-] (D) edge node {$2$} (B);
    \path [-] (A) edge node {$3$} (D);
    \path [-] (D) edge node {$3$} (E);
    \path [-] (E) edge node {$2$} (F);
    \path [-] (E) edge node {$6$} (B);
    \path [-, pos=0.25] (E) edge node {$4$} (C);
    \path [-] (B) edge node {$3$} (C);
    \path [-, pos=0.25] (B) edge node {$5$} (F);
    \path [-] (F) edge node {$4$} (C);
\end{scope}
\end{tikzpicture}
\pause[6]
\end{frame}
\end{document}
```

![document.gif](/image?hash=5450867d520284b91012b75bfb6bd6df9c51ad12bafce6b29a46cea215d0d9e4)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.