# Placing Nodes Around a Circle

I want to draw e.g. 9,13,17 nodes, evenly, around a circle in TikZ. How do I do this?

Then I also want to be able to edit easily the edges between the different nodes (to represent different graphs on those nodes).

A very simple approach using polar coordinates. Change the value of \n to adjust the number of circles. The nodes are named was n-<number>

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=3]
\pgfmathsetmacro\n{9}
\draw(0,0) circle (1);
\foreach \i in {0,...,\n} {
\pgfmathsetmacro\r{\i*(360/\n)}
\node (n-\i) at (\r:1) {A};
}
\end{tikzpicture}

\end{document}


More complex example:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=3]
\draw(0,0) circle (1);
\pgfmathsetmacro\n{6}
\foreach \i/\k in {0/A,1/B,2/C,3/X,4/Y,5/Z} {
\pgfmathsetmacro\r{\i*(360/\n)}
\fill (\r:1) circle (1pt) coordinate (n-\i);
\node at (\r:1.2) {\k};
}
\draw (n-0) -- (n-3);
\draw (n-0) -- (n-5);
\draw (n-0) -- (n-2);
\end{tikzpicture}

\end{document}

• OK this is useful to me. But how do I get the nodes as actual black circles, rather than the letter A? – Ginkgo Biloba Sep 24 '18 at 16:06
• I have replaced the "A" with "$\circ$" or "$\bullet$" but that's obviously not the proper way. – Ginkgo Biloba Sep 24 '18 at 16:09
• @GinkgoBiloba: Instead of \node ... {A}; try \node [draw=black, inner sep=1pt] .. {};, where the inner sep will control how big the circle is. – Peter Grill Sep 24 '18 at 17:08
• \node [fill=black, circle=1pt](n-\i) at (\r:1) {} seems to work but the nodes are too big – Ginkgo Biloba Sep 24 '18 at 17:40
• + How do I start adding edges between the nodes? – Ginkgo Biloba Sep 24 '18 at 17:45