I need to position the label No
closer to the box check if flag set
. What option should I use.
\documentclass{sig-alternate}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{process} = [rectangle, minimum width=2cm, minimum height=1cm, text centered, text width=2cm, draw=black]
\tikzstyle{connector} = [circle, minimum width=1cm, minimum height=0.5cm, text centered, text width=1cm, draw=black]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{document}
\begin{tikzpicture}
\node (p0) [] {foo(K)};
\node (p1) [process, below of=p0, text width=3cm] {search for key K};
\node (p2) [process, below of=p1, yshift=-1cm, text width=3.5cm] {Create key K for insertion};
\node (p3) [process, below of=p2, yshift=-1cm, text width=3.5cm] {Attempt to insert};
\node (retF) [process, right of=p1, xshift=3cm, text width=1cm, minimum width=1cm] {return false};
\node (p4) [process, below of=p3, yshift=-1cm, text width=3cm] {check if flag set};
\node (retT) [process, right of=p3, xshift=3cm, text width=1cm, minimum width=1cm] {return true};
\node (h1) [connector, below of=p4, yshift=-1cm] {bar()};
\draw [arrow] (p1) -- node[anchor=west] {K not found} (p2);
\draw [arrow] (p1) -- node[anchor=south] {K found} (retF);
\draw [arrow] (p2) -- node {} (p3);
\draw [arrow] (p3) -- node[anchor=east] {failed} (p4);
\draw [arrow] (p3) -- node[anchor=south] {successful} (retT);
\draw [arrow] (p4) -- node[anchor=west] {Yes} (h1);
\draw [arrow] (p4.west) -- ++(-1,0) |- node[anchor=south] {No} (p1.west);
\draw [arrow] (h1.west) -- ++(-2.5,0) |- node[anchor=south] {} (p1.west);
\end{tikzpicture}
\end{document}