# How do I change the radius of circle in a node in tikz style?

I have the following example:

\documentclass[]{beamer}
\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.

• Node size can be set with minimum width=2cm Sep 22, 2021 at 4:26
• Or minimum radius=2cm? (Did not check) Sep 22, 2021 at 5:41
• minimum size should also work, but if you want an exact size you may also need to adjust inner offset (not sure) Sep 22, 2021 at 5:46
• @AndrewStacey inner sep Sep 22, 2021 at 8:38
• TikZ nodes expand to fit the contents, hence the minimum in minimum size. Setting [inner sep=0pt] will help avoid filling the space. Setting [inner sep=-1cm] would help even more. Sep 22, 2021 at 13:28

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). \documentclass[]{beamer}
\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}
{"ft_lang_label":"__label__en","ft_lang_prob":0.5767452,"math_prob":0.78061944,"size":895,"snap":"2022-40-2023-06","text_gpt3_token_len":316,"char_repetition_ratio":0.099887766,"word_repetition_ratio":0.0,"special_character_ratio":0.31620112,"punctuation_ratio":0.13772455,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99456525,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-10-05T07:56:35Z\",\"WARC-Record-ID\":\"<urn:uuid:f7cf2c1a-9ee2-49f7-b819-518ca6f7fe67>\",\"Content-Length\":\"228361\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:789373b6-0c08-4ca2-a865-6e4ec23b9215>\",\"WARC-Concurrent-To\":\"<urn:uuid:a3b9bce0-a750-46e5-837c-df1098845cc4>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://tex.stackexchange.com/questions/616237/how-do-i-change-the-radius-of-circle-in-a-node-in-tikz-style\",\"WARC-Payload-Digest\":\"sha1:URDDGOL4FQONJX2ISFUIQB36VT5ZSJMM\",\"WARC-Block-Digest\":\"sha1:OEX62RD5LKFXSRW7TNFZQY6STQM26F6U\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030337595.1_warc_CC-MAIN-20221005073953-20221005103953-00369.warc.gz\"}"}