2

I'm trying to use tikz to draw algorithm diagrams. Assuming we have nodes A, B and C linked by arrows like so: A-->B-->C

How to make an arrow that goes from the bottom of C to the top of A by going around the whole diagram. This is what I got with the following code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\begin{document}

\tikzstyle{process} = [rectangle, text centered,    
draw=black, fill=orange!30]
\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{tikzpicture}[node distance=1cm]
\node (A) [process] {A}; 
\node (B) [process, below of=A] {B};
\node (C) [process, below of=B] {C};
\draw [arrow] (A) -- (B);
\draw [arrow] (B) -- (C);
\draw [arrow] (C) -- (A);

\end{tikzpicture}
\end{document}

This is what I get:

What I have

And this is what I'd like to get:

enter image description here

  • 1
    Welcome to TeX.SX! You can add a "fake node" and use node1 -| node2 or node1 |- node2 for pathes. – ebosi May 19 '16 at 13:59
4

One possibility

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\begin{document}

\tikzstyle{process} = [rectangle, text centered,    
draw=black, fill=orange!30]
\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{tikzpicture}[node distance=1cm]
\node (A) [process] {A}; 
\node (B) [process, below of=A] {B};
\node (C) [process, below of=B] {C};
\draw [arrow] (A) -- (B);
\draw [arrow] (B) -- (C);
\draw [arrow] (C) |-([shift={(3mm,-3mm)}]C.south east)-- ([shift={(3mm,3mm)}]A.north east)-|(A);

\end{tikzpicture}
\end{document}
|improve this answer|||||

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.