Bucle con diamante (TikZ)

Bucle con diamante (TikZ)

¿Cómo hacer que el bucle desde la esquina oeste del diamante hasta la esquina este del diamante sea como en la figura?

Cifra

ingrese la descripción de la imagen aquí

Código

       \documentclass[border=5mm]{standalone}
       \usepackage{tikz}
       \usetikzlibrary{shapes.geometric}
       \usepackage{amssymb}
       \begin{document}

        \begin{tikzpicture}[->, >=stealth, auto, semithick,
                 node distance=3cm,shorten >=2pt,shorten <=2pt,
                 mynode/.style={fill=white,draw,
                 diamond,thick,inner sep=5pt}]
        \node[mynode] (A) {$1$};
        \node[mynode] (B)[right of=A]  {$2$};
        \node[mynode] (C)[right of=B]  {$3$};
        \node[mynode] (D)[right of=C]  {$4$};

        \path[black](A.east) edge[bend left] node{S} (B.west)
                    (B.west) edge[bend left] node{U} (A.east)
                    (B.east) edge node{E} (C.west) 
                    (C.east) edge node{S} (D.west)
                    (B) edge[loop above] node{P} (B)
                    (B) edge[loop below] node{C} (B)
                    (C) edge[loop above] node{N} (C);
       \end{tikzpicture}
       \end{document}

Producción

ingrese la descripción de la imagen aquí

Respuesta1

Aquí hay un método, usando tres \draws separados.

producción

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usepackage{amssymb}
\begin{document}

\begin{tikzpicture}[->, >=stealth, auto, semithick,
          node distance=3cm,shorten >=2pt,shorten <=2pt,
          mynode/.style={fill=white,draw,
          diamond,thick,inner sep=5pt}]
 \node[mynode] (A) {$1$};
 \node[mynode] (B)[right of=A]  {$2$};
 \node[mynode] (C)[right of=B]  {$3$};
 \node[mynode] (D)[right of=C]  {$4$};

 \path[black](A.east) edge[bend left] node{S} (B.west)
             (B.west) edge[bend left] node{U} (A.east)
             (B.east) edge node{E} (C.west) 
             (C.east) edge node{S} (D.west);
 \draw       (B.west) to[out=110,in=70,looseness=3] node{P} (B.east);
 \draw       (B.west) to[out=-110,in=-70,looseness=3] node[swap]{C} (B.east);
 \draw       (C.west) to[out=110,in=70,looseness=3] node{N} (C.east);
\end{tikzpicture}
\end{document}

Respuesta2

Una alternativa con el uso de bibliotecas arrows.meta, bendingy quotesy arcen lugar de loop:

\documentclass[tikz, border=5mm]{standalone}
\usetikzlibrary{arrows.meta, bending, quotes, shapes.geometric}

\begin{document}
    \begin{tikzpicture}[-{Stealth[bend]}, auto, semithick,
     node distance=3cm,
     shorten >=2pt, shorten <=2pt,
     mynode/.style={diamond,draw, thick, minimum size=8mm, inner sep=0pt}
                       ]
\node[mynode] (A) {$1$};
\node[mynode] (B)[right of=A]  {$2$};
\node[mynode] (C)[right of=B]  {$3$};
\node[mynode] (D)[right of=C]  {$4$};

\path[black](A.east) edge[bend left, "S"]   (B.west)
            (B.west) edge[bend left, "U"]   (A.east)
            (B.east) edge["E"]              (C.west)
            (C.east) edge["S"]              (D.west);
\draw       ([yshift= 2pt] B.west) arc (235:-55:0.7) node[midway,below] {P};
\draw       ([yshift=-2pt] B.west) arc (-235:55:0.7) node[midway,above] {C};
\draw       (C.west) arc (235:-55:0.7) node[midway,below] {N};
    \end{tikzpicture}
\end{document}

ingrese la descripción de la imagen aquí

En la determinación del arcradio y end anglese consideraron las siguientes relaciones:

ingrese la descripción de la imagen aquí

arccon Py Cse desplazan verticalmente en consecuencia durante 2 puntos para que no se superpongan con las líneas de doblez entre los nodos 1 y 2.

información relacionada