Here's a more systematic approach to move from special case to generalization:
- understanding building blocks
- draw one specific case
- generalize
- outlook
Understanding building blocks

5 thingies need to be provided:
- a rectangle (with coordinates)
- gray circles
- white circles with content
- small white circle
Draw one specific case
Let's pick the lower middle one (green), as it provides all needed. Here's the code, with some residual hick-ups, and 3 parameters to pass marked:
\documentclass[10pt,border=0mm,tikz]{standalone}
\begin{document}
% ~~~ creating 1 specific drawing ~~~~~~
\tikzset{
smallc/.style= {draw, circle, fill=white,minimum size=5pt},
grayc/.style= {draw, circle, fill=gray, minimum size=15pt},
whitec/.style= {grayc, fill=white},
}
\begin{tikzpicture}
% ~~~ rectangle ~~~~~~~~~
\draw (0,0) -- (2,0) -- (2,2) -- (0,2) -- cycle;
% ~~~ doing a little more: flood with small circles ~~~
\foreach \i in {0,1,2}{
\node[smallc] at (\i,0) {};
\node[smallc] at (\i,2) {};
}
\foreach \i in {0,2}{
\node[smallc] at (\i,1) {};
}
% ~~~ drawing the gray nodes (over white small circles) ~~~~~~~~~
\foreach \i/\j in {0/2, 1/2, 2/1} % <<< 1
\node[grayc] at (\i,\j) {};
% ~~~ drawing the white nodes (over white small circles) ~~~~~~~~~
\foreach \i/\j/\c in {2/2/$0$, 0/1/$*1$} % <<< 2
\node[whitec] at (\i,\j) {\c};
% ~~~ label ~~~~~~~~~~
\node at (1,-.5) {$*k$}; % <<< 3
\end{tikzpicture}
\end{document}

Generalize
To do:
\newcommand\variant[3]
- provide 2 test cases
For the newcommand you simply move your code AND replace by \variant{}{}{} in the body. Filling in at least two variants of those lists should show differences.
To put two \variant calls side by side, I used a scope environment, which is shifted AND scaled AND transform shaped. See Chapter "17.7 Transformations" in the manual.
From the various options to reconcile the different circle sizes when content is entered, I opted for simply enlarging them all (gray and white).
% ~~~ REFACTORING ~~~~~~~~~~~~~~~~~~~~~~~~~~~
% 1. moving tikz-code into macro \variant
% 2. using scope environment to test two AND generalize
% 3. generalizing styles AND enlarging circles
\documentclass[10pt,border=0mm,tikz]{standalone}
\tikzset{
crc/.style= {draw, circle},
smallc/.style= {crc, fill=white,minimum size=5pt},
grayc/.style= {crc, fill=gray, minimum size=20pt},
whitec/.style= {grayc, fill=white},
}
\newcommand\variant[3]{
% ~~~ rectangle ~~~~~~~~~
\draw (0,0) -- (2,0) -- (2,2) -- (0,2) -- cycle;
% ~~~ doing a little more: flood with small circles ~~~
\foreach \i in {0,1,2}{
\node[smallc] at (\i,0) {};
\node[smallc] at (\i,2) {};
}
\foreach \i in {0,2}{
\node[smallc] at (\i,1) {};
}
% ~~~ drawing the gray nodes (over white small circles) ~~~~~~~~~
\foreach \i/\j in {#1} % <<< 1 generalized
\node[grayc] at (\i,\j) {};
% ~~~ drawing the white nodes (over white small circles) ~~~~~~~~~
\foreach \i/\j/\c in {#2} % <<< 2 generalized
\node[whitec] at (\i,\j) {\c};
% ~~~ label ~~~~~~~~~~
\node at (1,-.5) {#3}; % <<< 3 generalized
}
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}
% ~~~ creating 1 specific drawing ~~~~~~
\begin{tikzpicture}
\variant{0/2, 1/2, 2/1}
{2/2/$0$, 0/1/$*1$}
{$*k$}
\begin{scope}[xshift=3cm,scale=.5, transform shape] % to test two
\variant{0/2, 2/1}
{2/2/$0$, 2/0/$*k$}
{$0$}
\end{scope}
\end{tikzpicture}
\end{document}

BTW, you could already outsource \tikzset and \variant into an external file, and \input or \usepackage it. This makes your main code more readable, and opens the path to creating an own library on this subject, if needed.
Outlook
You can already replicate your 6 drawings by now, using a few more scopes.
However, a more versatile next step could be to encapsulate \variant in a \pic element, which accepts said 3 parameters. Though it's not difficult to do, it obscures code, especially for Tikz-novices.
However, if you did, you could simply place a number of \pic statements wherever you like.
Why using standalone, and how to go from there, have a look e.g. here.
P.S.
Here's the simplified code in main.tex:
% ~~~ REFACTORING ~~~~~~~~~~~~~~~~~~~~~~~~~~~
% 1. moving tikz-code into macro \variant
% 2. using scope environment to test two AND generalize
% 3. generalizing styles AND enlarging circles
% 4. moved preamble into variant.sty
\documentclass[10pt,border=0mm,tikz]{standalone}
\usepackage{variant}
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}
% ~~~ creating 1 specific drawing ~~~~~~
\begin{tikzpicture}
\variant{0/2, 1/2, 2/1}
{2/2/$0$, 0/1/$*1$}
{$*k$}
\begin{scope}[xshift=3cm,scale=.5, transform shape] % to test two
\variant{0/2, 2/1}
{2/2/$0$, 2/0/$*k$}
{$0$}
\end{scope}
\end{tikzpicture}
\end{document}
which compiles once you provide variant.sty in the same folder/directory:
\tikzset{
crc/.style= {draw, circle},
smallc/.style= {crc, fill=white,minimum size=5pt},
grayc/.style= {crc, fill=gray, minimum size=20pt},
whitec/.style= {grayc, fill=white},
}
\newcommand\variant[3]{
% ~~~ rectangle ~~~~~~~~~
\draw (0,0) -- (2,0) -- (2,2) -- (0,2) -- cycle;
% ~~~ doing a little more: flood with small circles ~~~
\foreach \i in {0,1,2}{
\node[smallc] at (\i,0) {};
\node[smallc] at (\i,2) {};
}
\foreach \i in {0,2}{
\node[smallc] at (\i,1) {};
}
% ~~~ drawing the gray nodes (over white small circles) ~~~~~~~~~
\foreach \i/\j in {#1} % <<< 1 generalized
\node[grayc] at (\i,\j) {};
% ~~~ drawing the white nodes (over white small circles) ~~~~~~~~~
\foreach \i/\j/\c in {#2} % <<< 2 generalized
\node[whitec] at (\i,\j) {\c};
% ~~~ label ~~~~~~~~~~
\node at (1,-.5) {#3}; % <<< 3 generalized
}
\tikzstyleis deprecated, use\tikzsetinstead. You could make your drawing a\picor just a regular custom command with arguments to change the relevant parts of the drawing.