# The perplexing path direction of TikZ This is a follow up to the question Replicating a simple diagram in Knuth's book using TikZ where I was fortunate to receive various useful and enriching answers for which I am grateful. The question corresponds to a diagram drawn using TikZ which I later needed to modify and faced a seemingly-simple problem about the arrow/path direction as shown in the attached image. I just applied plain intuition to draw that arrow from "Increase d" to "Divide by d", however, the direction is apparently incorrect!

\documentclass{article}
\usepackage{tikz} % For drawing circles around numbers
\usetikzlibrary{shapes,arrows,positioning}

\begin{document}
\tikzset{
decision/.style = {draw, text width=6.0em, text badly centered, node distance=3cm, minimum height=2.0em},
block/.style = {rectangle, draw,text width=6.0em, text centered, rounded corners=2ex, minimum height=2.0em},
line/.style = {draw, -latex'},
cloud/.style = {draw, ellipse, node distance=3cm, minimum height=2em}
}

\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\coordinate (a) at (0,0);
\node [decision,below = 0.6cm of a, minimum height=2.5em] (init) {Initialize $(d = 2)$};
\node [block, below = 0.8cm of init] (trivial) {$N = 1$?};
\node [decision, above right = .15cm and 0.8cm of trivial] (divide) {Divide by $d$};
\node [decision, below  = 0.8cm of divide] (factorFound) {Factor found};
\node [block, below right = .15cm and 0.8cm of divide, node distance=3cm] (zeroRem){Zero remainder?};
\node [decision, above = 1.25cm of zeroRem] (increase) {Increase $d$};
\node [block, right = 0.8cm of zeroRem, node distance=3cm] (lowQuot){Low quotient?};
\node [decision, below = 0.8cm of lowQuot] (prime) {$N$ is prime};
% Draw edges
\path [line] (a) -- (init);
\path [line] (init) -- (trivial);
\path [line] (trivial.10) -- node[midway,above=.5ex] {No}(divide.190);
\path [line] (divide.-10) -- (zeroRem.175);
\path [line] (zeroRem) -- node {No}(lowQuot);
\path [line] (zeroRem.185) -- node {Yes}(factorFound.10);
\path [line] (factorFound.170) -- (trivial.-10);
\path [line] (lowQuot) -- node {Yes}(prime);
\path [line,rounded corners=5ex] (lowQuot) -- ++(0, 1.96cm) node[right, near start] {No} -- (increase.east);
\path [line,rounded corners=5ex] (increase) -| (divide.north); % here is the problem!
\path [line] (trivial.south) -- node {Yes} +(0,-0.8cm);
\path [line] (prime.south) -- +(0,-0.6cm);
\end{tikzpicture}
\caption{Trial division flowchart as mentioned in \cite{Knuth 2004}.}
\label{Figure:TrialDivFlowChart}
\end{figure}
\end{document}

• The corner radius is too big – percusse Nov 17 '13 at 21:06
• That was exactly the solution! Reduced the radius to 4ex and the problem is solved! Many thanks. – Abdullah Heyari Nov 17 '13 at 21:12