How to change the radius of circle in a node in tikz style

tikz-pgf

I have the following example:

\documentclass[]{beamer}
\usetheme{Darmstadt}
\usepackage{xcolor}
\usepackage{tikz}
\begin{document}
    \begin{frame}{}
        \begin{tikzpicture}[>=latex]
        \tikzstyle{vertex} = [circle, fill=black!10]
        \tikzstyle{selected vertex} = [circle, radius=0.1cm, fill=red!30]
        \tikzstyle{nedge} = [-]

        \node[vertex] (v1) at (3,0) {v1};
        \node[vertex] (v2) at (0,-1) {v2};
        \node[vertex] (v3) at (6,-1) {v3};
        \draw[nedge] (v1) -- (v2);
        \draw[nedge] (v1) -- (v3);
    \end{tikzpicture}
\end{frame}
\end{document}

I want to change the radius of vertice in tikz style. How to do it?
Thanks for the help.

Best Answer

First, don't use tikzstyle which is deprecated, but use tikzset instead. Then, define your nodes as circle with inner sep=0pt (you can also set the outer sep to 0pt), and with a minimum width which is your node diameter.

Finally, you can make other node style inherit a previous one like I did. The selected vertex inherits all parameters from the vertex style, and you can add/replace some afterwards (like the filling here).

circle node tikzset

\documentclass[]{beamer}
\usetheme{Darmstadt}
\usepackage{xcolor}
\usepackage{tikz}
\begin{document}
    \begin{frame}{}
        \begin{tikzpicture}[>=latex]
        \tikzset
            {
            vertex/.style={circle, inner sep=0pt, outer sep=0pt, minimum width=1cm,fill=black!10},
            selected vertex/.style = {vertex, fill=red!30},
            nedge/.style = {-}
            }

        \node[vertex] (v1) at (3,0) {v1};
        \node[vertex] (v2) at (0,-1) {v2};
        \node[vertex] (v3) at (6,-1) {v3};
        \draw[nedge] (v1) -- (v2);
        \draw[nedge] (v1) -- (v3);
    \end{tikzpicture}
\end{frame}
\end{document}