1

Here's my issue: I created this graph by the following code:

\begin{tikzpicture} \newdimen\R
   \R=1.3cm
   \draw (0:\R) \foreach \x in {60,120,...,360} {  -- (\x:\R) };
   \foreach \x/\l/\p in
     { 60/{$\overline{3}$}/above,
      120/{$2$}/above,
      180/{$1$}/left,
      240/{$3$}/below,
      300/{$\overline{2}$}/below,
      360/{$\overline{1}$}/right
     }
     \node[inner sep=1pt,circle,draw,fill,label={\p:\l}] at (\x:\R) {}; 
\end{tikzpicture}

enter image description here

Now, I would like to add edges between all of the vertices, but I am stuck at how to do that.

3

enter image description here

\documentclass[tikz, border=20]{standalone}

\begin{document}
    \begin{tikzpicture} \newdimen\R
       \R=1.3cm
       \draw (0:\R) \foreach \x in {60,120,...,360} {  -- (\x:\R) };
       \foreach \x/\l/\p in
         { 60/{$\overline{3}$}/above,
          120/{$2$}/above,
          180/{$1$}/left,
          240/{$3$}/below,
          300/{$\overline{2}$}/below,
          360/{$\overline{1}$}/right
         }
         \node[inner sep=1pt,circle,draw,fill,label={\p:\l}] at (\x:\R) {}; 
         \foreach \x in {60, 120, ..., 360} {
            \draw (\x:\R) -- (\x+120:\R);
            \draw (\x:\R) -- (\x+180:\R);
         }
    \end{tikzpicture}
\end{document}

Just iterate around the circle again but connect every other node and then again but skipping two nodes.

1

Even if you already accepted Willoughby's answer, I let another solution, maybe more versatile and with a better alignment for the figures. complete graph

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
    \begin{tikzpicture}
        \def\r{2}
        \foreach \c [count=\i from 0] in {
            $\overline{1}$,
            $\overline{3}$,
            $2$,
            $1$,
            $3$,
            $\overline{2}$}
            {
            \path (0,0) -- (60*\i:\r) node[circle,inner sep=1mm,fill=black](\i){} --++ (60*\i:10pt) node{\c};
            }
            \foreach \i in {0,...,5}
                \foreach \n in {\i,...,5}
                    \draw (\i.center) -- (\n.center);
    \end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.