[Tex/LaTex] Simple Tikz graph with colors

drawtikz-pgftikz-trees

In my LATEX document, I would like to have the following graph:

enter image description here

Is there a way I can put these colors next to the vertices without the vertex numbers disappear? I don't want to use online drawing tools..

Best Answer

Here is a possibility with distinct colors.

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[Bullet/.style={circle,draw=gray,ultra thick,minimum width=2em}]
 \def\LstColors{{"red","blue","orange","yellow","cyan"}}
 \path (0,0) node[Bullet,fill=green!60!black] (v0) {$\mathsf{v}0$};
 \foreach \X in {1,...,5}
 {\pgfmathsetmacro{\mycolor}{\LstColors[\X-1]}
 \draw[ultra thick,draw=gray] (v0) -- (90+72-72*\X:2) 
 node[Bullet,fill=\mycolor] (v\X){$\mathsf{v}\X$};}
\end{tikzpicture}
\end{document}

enter image description here

Or with also varying text colors (and numbers also sf, as implicitly asked for by Joule V ;-).

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[Bullet/.style={circle,draw=gray,ultra thick,minimum width=2em}]
 \def\LstColors{{"red","blue","yellow","orange","cyan"}}
 \path (0,0) node[Bullet,fill=green!60!black] (u) {$\mathsf{u}$};
 \foreach \X in {1,...,5}
 {\pgfmathsetmacro{\mycolor}{\LstColors[\X-1]}
 \pgfmathsetmacro{\mytextcolor}{\LstColors[mod(\X,5)]}
 \draw[ultra thick,draw=gray] (u) -- (90+72-72*\X:2) 
 node[Bullet,fill=\mycolor,text=\mytextcolor] (v\X){$\mathsf{v\X}$};}
\end{tikzpicture}
\end{document}

enter image description here