1

How to draw a self loop at v_3 and parallel edge between v_4 and v_3 with \usepackage{tkz-graph} (If tkz-graph is not the best for plotting graphs, please mention the best way for plotting graphs)

Also, how to name the edges as e_1, e_2, ..., e_6?

\documentclass[border=10pt]{standalone}
\usepackage{tkz-graph}
\usetikzlibrary{calc} 
\GraphInit[vstyle=normal]
        
\begin{document}
 \begin{tikzpicture}
     \SetGraphUnit{2}
     \begin{scope}[rotate=-135]
            \Vertices{circle}{$v_1$,$v_2$,$v_3$,$v_4$}
     \end{scope}
     \Edges($v_1$,$v_2$,$v_4$,$v_3$,$v_1$)
     \Loop[dist=2cm,dir=EA,style={thick}]($v_3$) 
     \Edge[style={bend left}]($v_1$)($v_2$)
 \end{tikzpicture}
\end{document}

1 Answer 1

2

The \Loop .. \Edge lines do not compile ...

Here's a way to do it, though I'm not sure what you want to achieve:

result

\documentclass[border=10pt]{standalone}
\usepackage{tkz-graph}
\usetikzlibrary{calc} 
\GraphInit[vstyle=normal]
        
\begin{document}

 \begin{tikzpicture}
    % ~~~ internal fonts in circles, see 4.3 \SetVertexMath ~~~
    %     so the vertex' name is v_1, AND it's text is $v_1$
    %     we only need the names here
    \SetVertexMath      
    
    % ~~~ putting the vertices, see 2.1 \Vertex ~~~~
    \Vertex[x=0,y=0]{v_1}
    \Vertex[x=3,y=0]{v_2}
    \Vertex[x=0,y=3]{v_4}
    \Vertex[x=3,y=3]{v_3}
    
    % ~~~ multiple edge-connections, see 5.3 Multiple arêtes \Edges ~~~~~~~
    \Edges(v_4,v_1,v_2,v_4,v_3,v_1)
    
    \Edge[label=hi world](v_3)(v_2)     
    
    % ~~~ some loops, see5.2.1 Exemple avec \Loop ~~~~
    \Loop(v_4)                      % using defaults
    \Loop[dist=1cm, dir=EA](v_3)    % narrow, EAst=right side
    \Loop[dist=17mm, dir=SOWE,label=loop-1,style=left](v_1)
        
 \end{tikzpicture}

\end{document}

P.S.: let's modify the v1-loop a bit more:

    \Loop[dist=17mm, dir=SOWE,label={loop-1},style={red,dashed,left,<->},labelstyle=teal](v_1)

result2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .