I need to draw all these simple labelled graphs on four vertices. Anyway, can I do this in a quick manner with a loop? And put them in an array? I have already drawn all unlabelled simple graphs on four vertices. Therefore I am hoping that I can just run a loop that labels the edges six different ways for each graph except the complete one and the empty one. Any ideas would be very helpful.
These are the graphs that I have drawn so far. I want to make a loop that permutes the labeling of the edges.
Code
\documentclass[tikz,convert=false]{standalone}
\begin{document}
\begin{tikzpicture}[scale=.5,auto=left,every node/.style={circle,fill=black!20}]
\node (n1) at (0,0) {1};
\node (n2) at (0,2) {2};
\node (n3) at (2,2) {3};
\node (n4) at (2,0) {4};
\foreach \from/\to in {n2/n3}
\draw (\from) -- (\to);
\end{tikzpicture}
\end{document}
Output
I want to make a loop draw the same picture relabeling the vertices, six times.
Best Answer
You can do that with two loops: one running from 1 to n-1, the other from the current value of the first to n. Here an example for six:
Code
Output
Output with labels
Bonus homework: adapted for 36 nodes