2

I used TikZ package to create the flow chart as in the figure on the left (the code I used is below). I would like to add to the curved edges flow diagram and loops so that it was as in the right figure.

Thank you in advance.

enter image description here

My codes.

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,
decorations.pathreplacing,decorations.pathmorphing,shapes,
matrix,shapes.symbols}
\usepackage{array}
\usepackage{amsmath}
\usepackage{amsxtra}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{center}
\tikzstyle{decision} = [diamond, draw, fill=blue!20,text width=6.5em, text badly centered, node distance=5cm, inner sep=0pt]
\tikzstyle{block}    = [rectangle,fill=blue!20, text width=8em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line}     = [draw, -latex']
\tikzstyle{arco}     = [draw,->]
\tikzstyle{cloud}    = [draw, circle,fill=red!20, node distance=4cm,minimum height=4em]
\tikzstyle{pil}      = [->,thick,shorten <=2pt, shorten >=2pt]
\begin{tikzpicture}[node distance = 2cm, auto]
    % Place nodes
    \node [block] 
            (12) 
        {1nialize model};
    \node [block, left of=12, node distance=6cm]
            (11) {\\ Probability spaces \\ $(\mathbb{R},\mathcal{B}(\mathbb{R}),\mathbb{P})$\\ };
    \node [cloud, right of=12] 
            (13)
            {coments};
    \node [block, below of=12] 
            (22) 
            {verify candidate models};
    \node [block, below of=22]
        (32) {rum candidate models};
    \node [block, left of=32, node distance=6cm] 
            (31) {update model};
    \node [decision, below of=32]
            (decide) {is best candidate better?};
    \node [block, below of=decide, node distance=6cm] 
            (stop) {stop};
    % Draw edges
    \path [line]          (12)     -- (22);
    \path [line]          (13)   -- (22);
    \path [line]          (22) -- (32);
    \path [line]          (32) -- (decide);
    \path [line]          (decide)   -| node [near start] {yes} (31);
    \path [line]          (31)   |- (22);
    \path [line]          (decide)   -- node {no}(stop);
    \path [line]          (11)   -- (12);
    \path [arco]          (13)   -- (12);
    \path [arco]          (13)   |- (32);
    \path [arco]          (13)   -- (stop);
\end{tikzpicture}
\end{center}
\end{document}
2
  • 1
    Look up the to paths: options out and in as well as loop right. – Qrrbrbirlbel May 29 '16 at 1:21
  • 1
    Just bend left or bend right to paths would be enough for some of that. – cfr May 29 '16 at 2:05
3

I just added

\draw [very thick,->] (13) to [out=-90,in=0] (32);
\draw [very thick,->] (13) to [out=-90,in=45] (decide.east);
\draw [very thick,->] (13) to [out=-90,in=60] (stop.east);
\draw [very thick,->] (13) edge[loop right] (13);

to your code

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,
  decorations.pathreplacing,decorations.pathmorphing,shapes,
matrix,shapes.symbols}
\usepackage{array}
\usepackage{amsmath}
\usepackage{amsxtra}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{center}
  \tikzstyle{decision} = [diamond, draw, fill=blue!20,text width=6.5em, text badly centered, node distance=5cm, inner sep=0pt]
  \tikzstyle{block}    = [rectangle,fill=blue!20, text width=8em, text centered, rounded corners, minimum height=4em]
  \tikzstyle{line}     = [draw, -latex']
  \tikzstyle{arco}     = [draw,->]
  \tikzstyle{cloud}    = [draw, circle,fill=red!20, node distance=4cm,minimum height=4em]
  \tikzstyle{pil}      = [->,thick,shorten <=2pt, shorten >=2pt]
  \begin{tikzpicture}[node distance = 2cm, auto]
        % Place nodes
        \node [block] (12) {1nialize model};
        \node [block, left of=12, node distance=6cm] (11) {\\ Probability spaces \\ $(\mathbb{R},\mathcal{B}(\mathbb{R}),\mathbb{P})$\\ };
        \node [cloud, right of=12] (13) {coments};
        \node [block, below of=12] (22) {verify candidate models};
        \node [block, below of=22] (32) {rum candidate models};
        \node [block, left of=32, node distance=6cm] (31) {update model};
        \node [decision, below of=32] (decide) {is best candidate better?};
        \node [block, below of=decide, node distance=6cm] (stop) {stop};
        % Draw edges
        \path [line]          (12)     -- (22);
        \path [line]          (13)   -- (22);
        \path [line]          (22) -- (32);
        \path [line]          (32) -- (decide);
        \path [line]          (decide)   -| node [near start] {yes} (31);
        \path [line]          (31)   |- (22);
        \path [line]          (decide)   -- node {no}(stop);
        \path [line]          (11)   -- (12);
        \path [arco]          (13)   -- (12);
        \path [arco]          (13)   |- (32);
        %\draw [red] (13) .. controls (13 |- 32) .. (32);
        \draw [very thick,->] (13) to [out=-90,in=0] (32);
        \draw [very thick,->] (13) to [out=-90,in=45] (decide.east);
        \draw [very thick,->] (13) to [out=-90,in=60] (stop.east);
        \draw [very thick,->] (13) edge[loop right] (13);
        \path [arco]          (13)   -- (stop);
  \end{tikzpicture}
\end{center}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.