3

I need to create an automaton like Uml Activity diagram, I used this link but I do not get it.

I tried to do it with this code :

\begin{tikzpicture}[>=stealth,every node/.style={shape=rectangle,draw,rounded corners},]
    % create the nodes
    \node (c0)[shape=circle, fill=black] {};
    \node (c1) [right =of c0]{label 1};
    \node (c2) [below =of c1]{label 2};
    \node (c3) [below =of c2]{label 3};

    % connect the nodes
    \draw[->] (c0.north) to[out=90,in=90] (c1.north);
    %\draw[->] (c1.south) to[out=180,in=180] (c0.south);
    \draw[->] (c1.west) to[out=180,in=180] (c2.west);
    \draw[->] (c2) to[out=180,in=180] (c3);
    \draw[->] (c3.east) to[out=180,in=180] (c2.east);
    \draw[->] (c3.east) to[out=180,in=180] (c1.east);

\end{tikzpicture}

I also misunderstood how to use this command to [out = X in = Y] to repair the direction of the arrows

Unfortunately, I get this figure

enter image description here

Ans Piter
  • 223
  • What is your question? It will help if you come up with a precise description of your intention. – choeger Dec 02 '16 at 21:17
  • (i) showed picture is not produced by showed code; (ii) \draw (c0) to [out=X,in=Y] (c1); means that line "depart" coordinate c0 at angle X and "arrive" to coordinate c1 at angle Y, i.e. line is not straight but bend. And again, what is your problem? – Zarko Dec 02 '16 at 21:35
  • I misunderstood how to use this command to [out = X in = Y] to repair the direction of the arrows – Ans Piter Dec 02 '16 at 21:39

1 Answers1

6

I guess that you like to obtain

enter image description here

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

\begin{document}
\begin{tikzpicture}[>=stealth,
    every node/.style={shape=rectangle, draw, rounded corners}
                    ]
    % create the nodes
\node (c0) [shape=circle, fill=black] {};
\node (c1) [right = of c0] {label 1};
\node (c2) [below = of c1] {label 2};
\node (c3) [below = of c2] {label 3};
    % connect the nodes
\draw[->] (c0) to[out= 75,in=105] (c1);
\draw[->] (c1) to[out=255,in=285] (c0);
\draw[->] (c1) to[out=185,in=175] (c2);
\draw[->] (c2) to[out=185,in=175] (c3);
\draw[->] (c3) to[out= 10,in=350] (c2);
\draw[->] (c3) to[out=  5,in=355] (c1);
    \end{tikzpicture}
\end{document}

As I mentioned in comment, out=X, in=Y (see the comma, it separate out and in angle) means that line go out of coordinate (node) at angle X and come to coordinate at angle Y. Angle is measured ad center of node. Observe difference between selected angle in your MWE and above MWE: arrows and right side of nodes "depart" node at angles close to 10 degree and "arrive" at 350 degree.

Zarko
  • 296,517