Como desenhar auto-loop e arestas paralelas no gráfico (trabalhando no beamer)

Como desenhar auto-loop e arestas paralelas no gráfico (trabalhando no beamer)

Minha pergunta é

Como posso desenhar um loop automático e uma borda paralela em meu gráfico? estou trabalhando no beamer

Auto-loop no vértice V_1

Arestas paralelas entre V_2 e V_3

Uma pequena dúvida sobre como centralizar a figura

MWE

\documentclass[12pt,fleqn]{beamer}
\usetheme{AnnArbor}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}
\usecolortheme{beaver}
\usefonttheme{professionalfonts} % using non standard fonts for beamer
\usefonttheme{serif} % default family is serif
\addtobeamertemplate{frametitle}{}{\vspace{-0.4em}} % decrease
\begin{document}
\begin{frame}[t]
\begin{tikzpicture}
    \draw[line width=0.5pt] (0.0,3.0) -- (3.0,3.0);
    \draw[line width=0.5pt] (3.0,3.0) -- (3.0,0.0);
    \draw[line width=0.5pt] (3.0,0.0) -- (0.0,0.0);
    \draw[line width=0.5pt] (0.0,0.0) -- (0.0,3.0);
    \draw [fill=black] (0,3) circle (1.5pt);
    \draw[color=black,above] (0.0,3.10) node {$v_1$};
    \draw [fill=black] (3,3) circle (1.5pt);
    \draw[color=black,above] (3.0,3.10) node {$v_2$};
    \draw [fill=black] (3,0) circle (1.5pt);
    \draw[color=black,below] (3.0,-0.10) node {$v_3$};
    \draw [fill=black] (0,0) circle (1.5pt);
    \draw[color=black,below] (0.0,-0.10) node {$v_4$};
    \end{tikzpicture}
\end{frame}
\end{document}

Responder1

insira a descrição da imagem aqui

Pelo uso da automatabiblioteca (semelhante ao @js bibra em sua resposta: +1), arrows.metapara setas, em vez de setas paralelas são usadas setas dobradas, do preâmbulo são removidos pacotes que são carregados por beamer( xcolor, amsmath), não tem sentido na apresentação ( setspace) ou está com o recurso padrão recente do LaTeX ( [utf]{inputenc}):

\documentclass[12pt,fleqn]{beamer}
\usetheme{AnnArbor}
\usecolortheme{beaver}
\usefonttheme{professionalfonts} % using non standard fonts for beamer
\usefonttheme{serif} % default family is serif
\addtobeamertemplate{frametitle}{}{\vspace{-0.4em}} % decrease
%\usepackage{setspace}
%\usepackage{amsmath}
%\usepackage[utf8]{inputenc}
\usepackage{pgfplots}   % it load tikz and pgf too
\pgfplotsset{compat=1.17}

\usepackage{mathrsfs}
\usetikzlibrary{arrows.meta, automata,
                positioning,
                shadows}
\begin{document}
\begin{frame}
\begin{center}
    \begin{tikzpicture}[
      node distance = 22mm and 22mm,
state/.append style = {circle, draw=orange, fill=orange, 
                       minimum size=1.2em},
every edge/.style = {draw, -Stealth, semithick}
                        ] 
    \begin{scope}[nodes=state]
\node (n1)  {$v_1$};
\node (n2)  [right=of n1]   {$v_2$};
\node (n3)  [below=of n2]   {$v_3$};
\node (n4)  [left =of n3]   {$v_4$};
    \end{scope}
\path   (n3) edge  (n4)
        (n4) edge  (n1)
        (n1) edge [loop above,looseness=15]  (n1)
        (n1) edge  (n2)
        (n2) edge [bend left=15] (n3)
        (n3) edge [bend left=15] (n2)
        ;
    \end{tikzpicture}
\end{center}
\end{frame}
\end{document}

Responder2

Adicione a seguinte linha

\path
(v1) edge [->,loop above] node {} (v1);

pouco antes de \endtikzpicture

insira a descrição da imagem aqui

editar - uma solução alternativa que pode interessar e pode ser editada/modificada

insira a descrição da imagem aqui

\documentclass[12pt,fleqn]{beamer} 
\usetheme{AnnArbor} 
\usepackage{setspace} 
\usepackage{amsmath} 
\usepackage[utf8]{inputenc} 
\usepackage{pgf,tikz,pgfplots} 
\pgfplotsset{compat=1.15} 
\usepackage{mathrsfs} 
%\usetikzlibrary{arrows} 
%\usetikzlibrary{decorations.markings, shapes,positioning,arrows.meta,bending,automata} 
\usetikzlibrary {arrows.meta,automata,positioning,shadows,calc}
\usecolortheme{beaver} 
\usefonttheme{professionalfonts} % using non standard fonts for beamer 
\usefonttheme{serif} % default family is serif 
\addtobeamertemplate{frametitle}{}{\vspace{-0.4em}} % decrease 
\newcommand\DoubleLine[7][4pt]{%
    \path(#2)--(#3)coordinate[at start](h1)coordinate[at end](h2);
    \draw[#4]($(h1)!#1!90:(h2)$)-- node [auto=left] {#5} ($(h2)!#1!-90:(h1)$); 
    \draw[#6]($(h1)!#1!-90:(h2)$)-- node [auto=right] {#7} ($(h2)!#1!90:(h1)$);
}
\begin{document} 
    \begin{frame}[t] 
        \begin{center}
        \begin{tikzpicture}[
            ->,
            >={Stealth[round]},
            shorten >=1pt,
            auto,
            node distance=2.8cm,
            on grid,
            semithick,
        every state/.style={
            fill=red,
            draw=none,
            circular drop shadow,
            text=white
        }
    ]
        \node[state] (A)              {$v_1$};
        \node[state] (B) [right=of A] {$v_2$};
        \node[state] (D) [below=of A] {$v_4$};
        \node[state] (C) [below=of B] {$v_3$};
        
        \path (A) edge  (B) 
        (C)edge(D)
        (D)edge(A)
        (A) edge [loop above]  (A)
        ;
        
        \DoubleLine{B}{C}{<-,very thick,black}{}{->,very thick,red}{}
        \end{tikzpicture}
    \end{center}
    \end{frame} 
\end{document}

a definição das setas duplas é tirada daqui -

Rotulando arestas paralelas em um gráfico

informação relacionada