My goal is to create a complete bipartite graph with assigning numbers to the vertices. My idea was to use \foreach
, which worked well for creating the vertices, but I couldn't add the numbers. What should I try?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains}
\begin{document}
\begin{tikzpicture}[thick,
snode/.style={draw,fill=black,circle,scale=2},
every node/.style={inner sep=1pt},
]
\begin{scope}[xshift=0cm,yshift=0cm,start chain=going right,node distance=7mm]
\foreach \i in {1,...,5}
\node[snode,on chain] (g\i) {};
\node [above=0.1cm of g\i] (y\i) {1}; %Missing \endcsname, Extra \endcsname
\end{scope}
\begin{scope}[xshift=0cm,yshift=-5cm,start chain=going right,node distance=7mm]
\foreach \i in {1,...,5}
\node[snode,on chain] (h\i) {};
\node [below = 0.1cm of h\i] (z\i) {2}; %problem with \endcsname
\end{scope}
\foreach \i in {1,...,5}
\foreach \j in {1,...,5}
\draw (g\i) -- (h\j);
\end{tikzpicture}
\end{document}