3

I want to draw a wheel graph which is a cycle of nodes centred on another node. What I would like is to draw edges or other paths between the cycle's nodes in a way that they form an actual circle, not some wobbly thing like this:

enter image description here

The code I use is this

\documentclass{standalone}
\usepackage{tikz} 
\usetikzlibrary{fit,automata,positioning,calc}

\begin{document}
   \begin{tikzpicture}
      \node[state] (center) at (0,0) {$v_0$};
      \foreach \phi in {1,...,6}{
         \node[state] (v_\phi) at (360/6 * \phi:2cm) {$v_\phi$};
         \draw (v_\phi) -- (center);
      }
      \draw[blue] (v_1) edge[bend right] (v_2);
      \draw[blue] (v_2) edge[bend right] (v_3);
      \draw[blue] (v_3) edge[bend right] (v_4);
      \draw[blue] (v_4) edge[bend right] (v_5);
      \draw[blue] (v_5) edge[bend right] (v_6);
      \draw[blue] (v_6) -- (center);
      \draw[blue] (center) -- (v_1);
   \end{tikzpicture}

\end{document}

I know I could just draw a circle centred on v0 behind the cycle nodes, but since I might want to colour individual segments, I'd also like to draw them separately. How can this be done?

1
  • Instead of drawing a circle, draw separated arcs, before the nodes, so the nodes appear over them.
    – Manuel
    Nov 14 '15 at 11:26
5

Try and see if this is what you like to obtain:

\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{automata}

\begin{document}
   \begin{tikzpicture}
\draw[blue] (60:2) arc (60:360:20mm);
    \node[state,fill=white] (center) at (0,0) {$v_0$};
\foreach \phi in {1,...,6}{
    \node[state,fill=white] (v_\phi) at (360/6 * \phi:2cm) {$v_\phi$};
         \draw[blue] (v_\phi) -- (center);
      }
   \end{tikzpicture}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.