How to draw a path to form a regular pentagon?
You can use the geometric shapes given by the shapes.geometric library
\usetikzlibrary{shapes.geometric}
\begin{tikzpicture}[mystyle/.style={draw,shape=circle,fill=blue}]
\def\ngon{5}
\node[regular polygon,regular polygon sides=\ngon,minimum size=3cm] (p) {};
\foreach\x in {1,...,\ngon}{\node[mystyle] (p\x) at (p.corner \x){};}
\foreach\x in {1,...,\numexpr\ngon-1\relax}{
\foreach\y in {\x,...,\ngon}{
\draw (p\x) -- (p\y);
}
}
\end{tikzpicture}
For ngon being 9
One short tikz code without use of a library.
\documentclass[border=7mm]{standalone}
\usepackage{tikz}
\begin{document}
\foreach \n in {3,...,7}
\tikz\foreach \i in {1,...,\n}
\fill (\i*360/\n:1) coordinate (n\i) circle(2 pt)
\ifnum \i>1 foreach \j in {\i,...,1}{(n\i) edge (n\j)} \fi;
\end{document}
Maybe you like the following (based on (Thruston comment) rude solution (still need some manual calculation):
\documentclass[border=3mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}[every node/.style={draw,shape=circle,fill=blue,text=white}]
\foreach \i [count=\ii from 0] in {90,150,...,390}
\path (\i:32mm) node (p\ii) {\ii};
\foreach \x in {0,...,5}
\foreach \y in {\x,...,5}
\draw (p\y) -- (p\x);
\end{tikzpicture}
\end{document}
For change number of nodes you need to determine start angle and manually determine next and final angle of node position.
Number in nodes are only informative, you can erase it.
Upgrade: An improved version, which itself calculate all necessary data from given number of nodes and angle of the first node position:
\documentclass[border=3mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}[
every node/.style={draw,shape=circle,fill=blue,text=white}]
%%%% variable data data
\def\numpoly{8}%number of nodes
\def\startangle{30}%direction of the first node
\def\pradious{33mm}
%------- calculations of the positions angles
\pgfmathparse{int(\startangle+360/\numpoly)}%
\let\nextangle=\pgfmathresult
\pgfmathparse{int(\startangle-360/\numpoly+360)}%
\let\endtangle=\pgfmathresult
%--- nodes
\foreach \i [count=\ii from 1] in {\startangle,\nextangle,...,\endtangle}
\path (\i:\pradious) node (p\ii) {\ii};
%--- interconnections
\foreach \x in {1,...,\numpoly}
\foreach \y in {\x,...,\numpoly}
\draw (p\y) -- (p\x);
\end{tikzpicture}
\end{document}
With selection node numbers = 8 and the first node as in direction 30 degrees, code we obtain: