# Drawing a wheel graph with TikZ

Is there a fast way to add a central vertex connected to all others after drawing the cycle graph using the graph library of the tikz package?

This is what the code currently looks like:

\documentclass{article}
\begin{document}
\usepackage{tikz}
\usetikzlibrary{graphs,graphs.standard}

\begin{tikzpicture}[scale=0.8,every node/.style={scale=0.8}]
\graph  [nodes={circle,fill=black!25}, edges={black!60, semithick}, clockwise, radius=8em,
n=9, p=0.3]
\end{tikzpicture}
\end{document}

• Please make your code compilable by adding documentclass, \begin{document}, ... Sep 17 '20 at 23:11

Give a name to subgraph and then you can use the vertices. Finally find the center of subgraph and draw from center to each vertices.

\documentclass[tikz,margin=3mm]{standalone}

\usetikzlibrary{graphs,graphs.standard,calc}
\begin{document}
\begin{tikzpicture}[scale=0.8,every node/.style={scale=0.8}]
\graph  [nodes={circle,fill=black!25}, edges={black!60, semithick}, clockwise, radius=8em,
n=9, p=0.3]
\node at  ($(A 1)!.5!(A 4)$) (C){};
\foreach \i in {1,2,...,6}{
\draw (C)-- (A \i); }
\draw [fill=black!25](C) circle (0.4em);
\end{tikzpicture}
\end{document}


ADDENDUM: According to pgf manual on page 212, you can use mid definition.

\documentclass[tikz,margin=3mm]{standalone}

\usetikzlibrary{graphs,graphs.standard,calc}
\begin{document}
\begin{tikzpicture}[scale=0.8,every node/.style={scale=0.8}]
\graph  [empty nodes, nodes={circle,fill=black!25}, edges={black!60, semithick}, clockwise, radius=8em,
n=9, p=0.3]
\node at  ($(A 1)!.5!(A 4)$) (C){1};
\foreach \i [count=\xi from 2]  in {1,2,...,6}{
\node at (A \i){\xi}; }
\end{tikzpicture}
\end{document}


• Thank you. If I wanted the central vertex to look the same as all others, and number it as 1 (so that current number 1 becomes 2, etc...), how should I modify your code? I set its size to 0.8em and added the tag 1, but I'm note sure how to remove the boundary and change the other numbers... Sep 18 '20 at 11:25
• I like very much your work. Sep 18 '20 at 11:38