I am trying to recreate the following image in latex. 
Where I want to vary the number of white and black balls. As indicated in the title, I am also trying to draw a line between balls of same colour and a dashed line of balls with opposite color. I have tried to do this in the MWE below. However I am unsure how to get latex to know whether to draw a dashed or single line between two balls. Any ideas?
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
% create the node
\pgfmathsetmacro\white{3}
\pgfmathsetmacro\black{2}
\pgfmathsetmacro\n{\white+\black}
\node[draw=none,minimum size=2cm,regular polygon,regular polygon sides=\n] (a) {};
% draw a black dot in each vertex
\foreach \x in {1,2,...,\n}
\fill (a.corner \x) circle[radius=2.2pt];
% draw a black dot in each vertex
\foreach \x in {1,2,...,\white}
\fill[color=white] (a.corner \x) circle[radius=2pt];
\end{tikzpicture}
\end{document}
