I need some help with drawing this graph in LaTeX. The learning curve is quite steep!


  • 1
    Do you have the coordinates of the nodes at hand? – TobiBS Jul 26 '20 at 14:24

Like this:

enter image description here

  • for positions of dots are used corners of regular shape from the library shapes.geometric
  • dots and connection lines are drawn in the loops
  • labels of dots are defined with counters in the loop
\documentclass[tikz, border=3mm]{standalone}

dot/.style = {circle, inner sep=1pt, fill,
              node contents={}},
 PG/.style = {% PentaGon
              regular polygon, regular polygon sides=5,
              minimum size=#1cm,
              node contents={}},
every label/.append style = {inner sep=1pt, font=\tiny} 

\node (n1) [PG=6, draw];
\node (n2) [PG=4];
\node (n3) [PG=2];
\foreach \i/\ii [evaluate=\ii as \jj using int(\ii+5),
                 evaluate=\ii as \kk using int(\ii+10)] 
            in {1/1,2/5,3/4,4/3,5/2}
    \node at (n1.corner \i) [dot, label=90+\i*360/5:\ii];
    \node at (n2.corner \i) [dot, label=90+\i*360/5:\jj];
    \node at (n3.corner \i) [dot, label=90+\i*360/5:\kk];
\foreach \j [count=\i from 0] in {1,...,5}
\draw   (n1.corner \j) -- (n3.corner \j) 
        (n1.corner \j) -- (n2.corner \k)
        (n2.corner \j) -- (n3.corner \l)
        (n3.corner \j) -- (n3.corner \l);


Edit: in the first version of answer was direction the labeling of nodes in opposite direction as is shown in OP images. Now this is corrected with replacing original loop

\foreach \i [count=\j from 6,
             count=\k from 11] in {1,...,5}
    \node at (n1.corner \i) [dot, label=90+\i*360/5:\i];
    \node at (n2.corner \i) [dot, label=90+\i*360/5:\j];
    \node at (n3.corner \i) [dot, label=90+\i*360/5:\k];

with code which is now in above MWE.

  • You forgot to give the code for your solution. – AndréC Jul 26 '20 at 16:51
  • I want to say I like your solution more than mine. ;-) – TobiBS Jul 26 '20 at 17:26
  • +1. Very nice solution. – AndréC Jul 26 '20 at 18:20
  • @AndréC, thank you very much. And special thanks to pointed me that I forgot upload MWE in my answer! – Zarko Jul 26 '20 at 18:22
  • 1
    @MrWhite, you are right. Nodes were labeled/numbered in opposite direction as OP show in question. Now this is corrected. – Zarko Jul 27 '20 at 0:24

A simple approach for you to start with, it defines a node style mynodes that can be used later. Then you can draw nodes at various locations, e.g. in a polar coordinate system, where the first value is the angle and the second the distance. Then in the end you can \draw from any node to any node.

Here is my start for you, but as I didn't find a systematic in the edges, you an probably finish it for yourself:


\tikzset{mynodes/.style={inner sep=2pt,fill=black,circle}}
    \node[mynodes](N1) at (90:3){};
    \node[mynodes](N2) at (18:3){};
    \node[mynodes](N3) at (-54:3){};
    \node[mynodes](N4) at (-126:3){};
    \node[mynodes](N5) at (-198:3){};
    \node[mynodes](N6) at (90:2){};
    \node[mynodes](N7) at (18:2){};
    \node[mynodes](N8) at (-54:2){};
    \node[mynodes](N9) at (-126:2){};
    \node[mynodes](N10) at (-198:2){};
    \node[mynodes](N11) at (90:1){};
    \node[mynodes](N12) at (18:1){};
    \node[mynodes](N13) at (-54:1){};
    \node[mynodes](N14) at (-126:1){};
    \node[mynodes](N15) at (-198:1){};
    \draw (N1) -- (N2) -- (N3) -- (N4) -- (N5) -- (N1);

    \draw (N1) -- (N10);
    \draw (N2) -- (N6); 
    \draw (N3) -- (N7); 
    \draw (N4) -- (N8);
    \draw (N5) -- (N9);
    \draw (N4) -- (N9) -- (N14) -- (N12) -- (N7) -- (N2);
    \draw (N3) -- (N8) -- (N13) -- (N15) -- (N10) -- (N5);
    \draw (N1) -- (N6) -- (N11) -- (N9);

enter image description here

Complications could be introduced by using \pgfforeach to define the cyclic nodes, but I avoided that as you mentioned, you are a beginner. For less code this would be useful however.


For compare purpose.

Compile with Ahihi đồ ngốc.(please don't fix it)

or http://asymptote.ualberta.ca/

pair[] P,Q,T;
for (int i=0; i<5;++i){
for (int i=0; i<P.length;++i){ 
  label(scale(0.6)*Label("$"+(string) (i+1) +"$"),P[i],dir(degrees(P[i])));
  label(scale(0.6)*Label("$"+(string) (i+6) +"$"),Q[i],dir(degrees(Q[i])+90));
  label(scale(0.6)*Label("$"+(string) (i+11) +"$"),T[i],dir(degrees(T[i])+90));
path pentagon=operator --(... P)--cycle;

enter image description here

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.