[Tex/LaTex] Avoid arrow crossing over blocks in flow chart

diagramstikz-pgf

I've been creating a flow chart using the template I found here:

http://www.texample.net/tikz/examples/simple-flow-chart/

Please see the code below:

\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20, 
    text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20, 
    text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,
    minimum height=2em]
\begin{document}
\begin{tikzpicture}[node distance = 2cm, auto]
    % Place nodes
         \node [cloud] (a) {a};
        \node [block, right of = a, node distance =5cm] (b) {b};
        \node [decision, below of = b] (c) {c};
        \node [block, below of = c, node distance = 3cm] (d) {d};
        \node [decision, below of = d, node distance = 3.2cm] (e) {e};
        \node [block, right of = e, node distance = 3.2cm] (f) {f};
        \node [decision, below of = e] (g) {g};
        \node [block, left of = g, node distance = 3.2cm] (h) {h};
        \node [decision, below of = g, node distance = 3.5cm] (i) {i};
        \node [block, left of = i, node distance = 3.2cm] (j) {j};
        \node [block, right of = i, node distance = 3.5cm] (k) {k};
     % Draw edges
    \path [line] (a) -- (b);
    \path [line] (b) -- (b);
    \path [line] (b) -- node [near start] {yes} (d);
    \path [line] (d) -- (e);
    \path [line] (e) -- node [near start] {no} (f);
    \path [line] (f) |- (b);
    \path [line] (e) -- node [near start] {yes} (g);
    \path [line] (g) -- node [near start] {no} (h);
    \path [line] (h) |- (e);
    \path [line] (g) -- node [near start] {yes} (i);
    \path [line] (i) -- node [near start] {yes} (j);
    \path [line] (j) -- (h);
    \path [line] (i) -- node [near start] {no} (k);
    \path [line] (k) -| (h);
\end{tikzpicture}
\end{document}

How can I create an arrow from k to h that doesn't intersect any of the other boxes or arrows?

Best Answer

Here's a way: let's go around the node j. We use the left bottom corner (south west), shift a bit to not touch the node. Further we use |- to get vertical and horizontal path parts.

\path[line] (k) |- ([xshift=-0.5cm,yshift=-0.5cm]j.south west) |- (h);

enter image description here