1

I need to draw this:

enter image description here

But I'm not really the best when it comes to TikZ. Could anyone be of assistance?

  • 1
    What have you got so far? If you post the code you've got, especially in the form of a complete, small document, people can help with the bit you are having difficulty with. That way, you'll get better with TikZ ;). – cfr Dec 06 '15 at 00:29
  • You might look for nodes and bend edges in the manual (e.g., the example on page 93). – cryingshadow Dec 06 '15 at 00:40

3 Answers3

8

Well, for startin point (as one of many possible solution) can serve the following MWE:

\documentclass[border=3mm,tikz]{standalone}
    \usetikzlibrary{arrows,automata,positioning}

    \begin{document}
\begin{tikzpicture}[
    node distance=12mm,
    >=stealth, auto,
every state/.style={draw=none, inner sep=0pt}
                ]
\node[state] (q14) {$14$};
\node[state] (q12) [above right=of q14] {$12$};
\node[state] (q23) [below right=of q12] {$23$};
\node[state] (q34) [below right=of q14] {$34$};
    \begin{scope}[bend left]%
\path[->]   (q14) edge node {c} (q12)
            (q12) edge node {c} (q23)
            (q23) edge node {c} (q34)
            (q34) edge node {c} (q14);
    \end{scope}
\end{tikzpicture}

\begin{tikzpicture}[
    node distance=12mm,
    >=stealth, auto,
every state/.style={draw=none}
                ]
\node[state] (q12)                  {$14$};
\node[state] (q24) [below=of q12]   {$34$};
    \begin{scope}[bend left]%
\path[->]   (q12.south east) edge node {c} (q24.north east)
            (q24.north west) edge node {c} (q12.south west);
    \end{scope}
\end{tikzpicture}
    \end{document}

enter image description here enter image description here

Zarko
  • 296,517
  • How to make arrow arc circular? – Black Mild Oct 06 '19 at 14:14
  • @BlackMild, can be more specific? Answer show two example. In the first arrows mimic circle (but not drawn as arc/circle segment). Do you consider to ask new question? – Zarko Oct 06 '19 at 14:23
  • This is small one, so I ask here. In the 1st example, you use [bend left] to draw an not-circuar arc from the node 14 to the node 12. Can we make that arc cỉcular in a simple way? – Black Mild Oct 06 '19 at 14:49
  • I have posted a new question.Please have a look at https://tex.stackexchange.com/questions/511183/simple-way-to-make-circular-arrow-arc – Black Mild Oct 06 '19 at 15:46
8

A little 'Smarts' can draw simple cycles easily:

smart cycle

\documentclass{article}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}
\begin{document}
\smartdiagramadd[circular diagram]{
  Thing 1,Thing 2,Thing 3,Thing 4
}{
  above of module1/a,left of module2/b,below of module3/c,right of module4/d
}
\end{document}
cfr
  • 198,882
6

For what it's worth, here's how to do the diagram in Asymptote.

enter image description here

% file: foo.tex
% to compile: pdflatex --shell-escape foo
%
% For MikTeX users: Asymptote requires a separate program that cannot be installed
% by the package manager. You can get the installation file from
% https://sourceforge.net/projects/asymptote/files/2.35/
% (specifically, the file ending in setup.exe).

\documentclass{standalone}
\usepackage{asypictureB}
\begin{asyheader}
settings.outformat = "pdf";
\end{asyheader}
\begin{document}
\begin{asypicture}{name=cycles}
import flowchart;
unitsize(1cm);

block northnode = rectangle("$12$", center=N, drawpen=invisible);
block eastnode = rectangle("$23$", center=E, drawpen=invisible);
block southnode = rectangle("$34$", center=S, drawpen=invisible);
block westnode = rectangle("$14$", center=W, drawpen=invisible);

draw(northnode);
draw(eastnode);
draw(southnode);
draw(westnode);

real anglefudge = 10;  // shift 10 degrees away from straight right, down, etc.

add(new void(picture pic, transform t) {
  draw(pic, northnode.right(t) {dir(0-anglefudge)} .. {dir(-90+anglefudge)} eastnode.top(t),
       L=Label("$c$", align=LeftSide),
       arrow=Arrow(TeXHead));
  draw(pic, eastnode.bottom(t) {dir(-90-anglefudge)} .. {dir(180+anglefudge)} southnode.right(t),
       L=Label("$c$", align=LeftSide),
       arrow=Arrow(TeXHead));
  draw(pic, southnode.left(t) {dir(180-anglefudge)} .. {dir(90+anglefudge)} westnode.bottom(t),
       L=Label("$c$", align=LeftSide),
       arrow=Arrow(TeXHead));
  draw(pic, westnode.top(t) {dir(90-anglefudge)} .. {dir(0+anglefudge)} northnode.left(t),
       L=Label("$c$", align=LeftSide),
       arrow=Arrow(TeXHead));
});

currentpicture = shift(-3, 0) * currentpicture;

block topnode = rectangle("$13$", center=(0,1), drawpen=invisible);
block bottomnode = rectangle("$24$", center=(0,-1), drawpen=invisible);

draw(topnode);
draw(bottomnode);

real angleshift = 20;
real positionshift = 0.2;

add(new void(picture pic, transform t) {
  draw(pic,
      topnode.position(0.5+positionshift,t) {dir(-90+angleshift)}
          .. {dir(-90-angleshift)} bottomnode.position(2.5-positionshift,t),
      L=Label("$c$", align=LeftSide),
      arrow=Arrow(TeXHead));
  draw(pic,
      bottomnode.position(2.5+positionshift,t) {dir(90+angleshift)}
          .. {dir(90-angleshift)} topnode.position(0.5-positionshift,t),
      L=Label("$c$", align=LeftSide),
      arrow=Arrow(TeXHead));
});
\end{asypicture}
\end{document}