2

I want to draw a diagram in TikZ which looks as follows:

enter image description here

I am not sure of what type of diagram it would classify as (not commutative?), my first thought was something similar to the example on page 7 of the tikz-cd manual:

enter image description here

but it doesn't feel like the most appropriate method. Any pointers?

CarLaTeX
  • 62,716
  • You can use controls as in my answer for your previous question https://tex.stackexchange.com/questions/617538/make-tikz-arrow-curvier/617543#617543 – Black Mild Oct 02 '21 at 18:50
  • 1
    Take a look at the cover of Part II of the pgfmanual (page 102 in the current version). You're searching for the different loops, see section "74.4 Loops" of the manual. – Skillmon Oct 02 '21 at 19:06
  • You should alway post a MWE showing what you have tried https://tex.meta.stackexchange.com/questions/228/ive-just-been-asked-to-write-a-minimal-working-example-mwe-what-is-that – hpekristiansen Oct 03 '21 at 08:00

2 Answers2

3
\documentclass[tikz, border=1 cm]{standalone}
\begin{document}
\begin{tikzpicture}[->, shorten <=0.2 cm, shorten >=0.3 cm]
\coordinate (A) at (0,0);
\coordinate (B) at (2,4);
\coordinate (C) at (4,0);
\fill (A) circle[radius=0.1 cm];
\fill (B) circle[radius=0.1 cm];
\fill (C) circle[radius=0.1 cm];
\draw (A) to[out=80,in=50,min distance=5cm] (A);
\draw (C) to[out=130,in=100,min distance=5cm] (C);
\draw (A) to[bend left] (C);
\draw (C) to[bend left] (A);
\draw (A) to[out=130,in=230,min distance=1.5cm] (A);
\draw (C) to[out=50,in=-50,min distance=1.5cm] (C);
\end{tikzpicture}
\end{document}

Diagram with three nodes and looped arrows

Edit:

Just to show one of the curves with explicit control points:

\documentclass[tikz, border=1 cm]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\tikzset{%
  show curve controls/.style={
    postaction={
      decoration={
        show path construction,
        curveto code={
          \draw [blue, >=\empty, shorten <=0 cm, shorten >=00 cm] 
            (\tikzinputsegmentfirst) -- (\tikzinputsegmentsupporta)
            (\tikzinputsegmentlast) -- (\tikzinputsegmentsupportb);
          \fill [red, opacity=0.5] 
            (\tikzinputsegmentsupporta) circle [radius=.5ex]
            (\tikzinputsegmentsupportb) circle [radius=.5ex];
            \coordinate (ConA) at (\tikzinputsegmentsupporta);
            \coordinate (ConB) at (\tikzinputsegmentsupportb);
        }
      },
      decorate
}}}
\begin{document}
\begin{tikzpicture}[->, shorten <=0.2 cm, shorten >=0.3 cm]
\coordinate (A) at (0,0);
\coordinate (B) at (2,4);
\coordinate (C) at (4,0);
\fill (A) circle[radius=0.1 cm];
\fill (B) circle[radius=0.1 cm];
\fill (C) circle[radius=0.1 cm];
\draw[thick, show curve controls] (A) to[out=80,in=50,min distance=5cm] (A); %Original curve
\draw[red] (A) .. controls +(ConA) and +(ConB) .. (A); %The same curve with control points
\end{tikzpicture}
\end{document}

One curve with control points

The same control point can also be calculated:

\draw (A) .. controls ({5*cos(80)},{5*sin(80)}) and ({5*cos(50)},{5*sin(50)}) .. (A);

A better way to draw the complete diagram would be to use calc to calculate the control points symmetrically in the desired direction. -I did not do this to keep the code simple and readable.

1

With tikz-cd:

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[
    column sep=6pt, 
    every matrix/.append style={name=mycd},  
    execute at end picture={
        \draw [->] plot [smooth, tension=3] coordinates { (mycd-2-1.80) (mycd-1-2.-135) (mycd-2-1.50)};
        \draw [->] plot [smooth, tension=3] coordinates { (mycd-2-3.130) (mycd-1-2.-45) (mycd-2-3.100)};
        }
    ] 
& A & \\[10pt]
B \ar[rr, bend right]\ar[loop left, <-] & & C \ar[ll, bend right]\ar[loop right]
\end{tikzcd}
\end{document}

enter image description here

And in case your node are all black points:

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[column sep=6pt, 
    every matrix/.append style={
        name=mycd, 
        nodes={circle, fill=black, outer sep= 2pt, inner sep=3pt}
        },  
    execute at end picture={
        \draw [->] plot [smooth, tension=3] coordinates { (mycd-2-1.80) (mycd-1-2.-135) (mycd-2-1.50)};
        \draw [->] plot [smooth, tension=3] coordinates { (mycd-2-3.130) (mycd-1-2.-45) (mycd-2-3.100)};
       }
    ] 
& {} & \\[10pt]
{} \ar[rr, bend right]\ar[loop left, <-] & & {} \ar[ll, bend right]\ar[loop right]
\end{tikzcd}
\end{document}

enter image description here

CarLaTeX
  • 62,716