# TikZ: How to make edges jump to show they don't intersect?

I saw this and I like how the lines jump over each other to show they're not connected when they cross over:

Here's the code for it. I tried to apply the same technique, without much luck:

% Block diagram wire junctions
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{verbatim}

\begin{comment}
:Title: Block diagram line junctions
:Slug: line-junctions
:Tags: Block diagrams, Foreach, Transformations, Paths

An example of how to draw line junctions in a block diagram.
A semicircle is used to indicate that two lines are not connected.
This is a good example of how flexible TikZ' paths are.
The intersection between the lines are calculated using the convenient
-| syntax. Since we want the semicircle to have its center where
the lines intersect, we have to shift the intersection coordinate
accordingly.

\end{comment}

\begin{document}

\tikzstyle{block} = [draw,fill=blue!20,minimum size=2em]
% diameter of semicircle used to indicate that two lines are not connected
\tikzstyle{branch}=[fill,shape=circle,minimum size=3pt,inner sep=0pt]

\begin{tikzpicture}[>=latex']

% Draw blocks, inputs and outputs
\foreach \y in {1,2,3,4,5} {
\node at (0,-\y) (input\y) {$i_\y$};
\node[block] at (2,-\y) (block\y) {$f_\y$};
\draw[->] (input\y) -- (block\y);
\draw[->] (block\y.east) -- +(0.5,0);
}
\node[block] at (2,-6) (block6) {$f_6$};
\draw[->] (block6.east) -- +(0.5,0);

% Calculate branch point coordinate
\path (input1) -- coordinate (branch) (block1);

% Define a style for shifting a coordinate upwards
% Note the curly brackets around the coordinate.
% It would be natural to use the yshift or xshift option, but that does
% not seem to work when shifting coordinates.

\draw[->] (branch) node[branch] {}{ % draw branch junction
\foreach \c in {2,3,4,5} {
% Draw semicircle junction to indicate that the lines are
% not connected. The intersection between the lines are
% calculated using the convenient -| syntax. Since we want
% the semicircle to have its center where the lines intersect,
% we have to shift the intersection coordinate using the 's'
% style to account for this.
[shift only] -- ([s]input\c -| branch) arc(90:-90:\radius)
% Note the use of the [shift only] option. It is not necessary,
% but I have used it to ensure that the semicircles have the
% same size regardless of scaling.
}
} |- (block6);
\end{tikzpicture}
\end{document}


This is what I have so far: Sorry, I didn't have time to tidy the code up properly yet, but here it is:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[latin1]{inputenc}
\usepackage[active,tightpage]{preview}
\usepackage{verbatim}
\usepackage{tikz}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows.meta}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagestyle{empty}
% Define Block Styles %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\tikzstyle{decision} = [diamond, draw, fill=blue!20,
%    text width=4.5em, text badly centered, node distance=1.5cm, inner sep=0pt]
\tikzstyle{rdblk} = [rectangle, draw, fill=red!20,
text width=1.5em, text centered, rounded corners, minimum height=2.5em]
\tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=1.9em, text centered, rounded corners, minimum height=2.5em]
\tikzstyle{wideb} = [rectangle, draw, fill=blue!20,
text width=19em, text centered, rounded corners, minimum height=2.6em]
\tikzstyle{wblnk} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=2.5em]
\tikzstyle{line}  = [draw, -latex']
\tikzstyle{cloud} = [draw, circle,fill=red!20, minimum height=2.5em, text centered]
\tikzstyle{grcld} = [draw, circle,fill=green!20, minimum height=2.5em, text centered]
\tikzstyle{blcld} = [draw, circle,fill=blue!20, minimum height=2.5em, text centered]
\tikzstyle{key} = [draw, rectangle,fill=yellow!20, minimum height=2.5em,
text width=1.9em, text centered, rounded corners, minimum height=2.5em]
\tikzstyle{point} = [draw, circle,fill=black!20, minimum height=2.5em, text centered]

%    \node at (1.5,0) [circle,fill,inner sep=1.5pt]{};

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}[-{>[scale=1,
length=4,
width=4]}, >=Stealth, auto, node distance=1.5cm]
% Place Nodes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\node [cloud,                 ] (P)   {$P$};
\node [wideb, below of=P,     ] (IP)  {$\pi_1$};
\node [blcld, below of=IP     ] (f1)  {$f_1$};

\node [cloud, above of=IP     ] (Pp)   {$P$};
\node [     , left  of=P      ] (L)   {};
\node [     , right of=P      ] (R)   {};
\node [cloud, below of=L      ] (BL)  {$L_0$};
\node [cloud, below of=R      ] (BR)  {$R_0$};
\node [     , below of=BL     ] (BL2) {};
\node [point, below of=BR     ] (BR2) {};
\node [     , below of=BL2    ] (BL3) {};
\node [point, below of=BR2    ] (BR3) {};
\node [     , below of=BL3    ] (BL4) {};
\node [point, below of=BR3    ] (BR4) {};
\node [     , below of=BL4    ] (BL5) {};
\node [point, below of=BR4    ] (BR5) {};
\node [     , below of=BL5    ] (BL6) {};
\node [point, below of=BR5    ] (BR6) {};
\node [     , below of=BL6    ] (BL7) {};
% \node [cloud, below of=BR6    ] (BR7) {};
\node [key  , right of=BR2    ] (K1)  {$K_1$};
\node [key  , below of=K1     ] (K2)  {$K_2$};
\node [key  , below of=K2     ] (K15) {$K_{15}$};
\node [key  , below of=K15    ] (K16) {$K_{16}$};
\node [blcld, below of=IP     ] (f1)  {$f$};
\node [grcld, left  of=f1,   node distance=1.5cm] (xor1) {$\oplus$};
\node [grcld, below of=xor1, node distance=1.5cm] (xor2) {$\oplus$};
\node [grcld, below of=xor2, node distance=1.5cm] (xor3) {$\oplus$};
\node [grcld, below of=xor3, node distance=1.5cm] (xor4) {$\oplus$};
\node [blcld, below of=f1,    ] (f2)   {$f$};
\node [blcld, below of=f2,    ] (f15)  {$f$};
\node [blcld, below of=f15,   ] (f16)  {$f$};

\node [wideb, below  of=f16,   node distance=1.5cm] (FP)   {$\pi_1^{-1}$};
\node [     , below  of=FP       ] (BFP)    {};
\node [cloud, below  of=FP      ] (C)    {$C$};
\node [cloud, left  of=FP      ] (FPL)  {$R$};
\node [cloud, right of=FP      ] (FPR)  {$R$};
\node [wideb, below  of=f16,   node distance=1.5cm] (FP)   {$\pi_1^{-1}$};
\node [cloud, left   of=FP      ] (NOTL)   {$\overline L$};
\node [cloud, right   of=FP      ] (NOTR)   {$\overline R$};
% Draw Edges %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\path [line] (Pp)         -- (IP);
% \path [line] (Pp)         -- node {\tiny 28-bit}(BL);
% \path [line] (Pp)         -- node {\tiny 28-bit}(BR);
% \path [line] (L)         -- (BL);
% \path [line] (R)         -- (BR);
\path [line] (BL)        -- (xor1);
\path [line] (BR2.south)       -- (xor2.north);
% \path [line] (K1)        -- (f1);
\path(K1) edge [ bend right=40] node [left] {} (f1);
\path(K2) edge [ bend right=40] node [left] {} (f2);
\path(K15) edge [ bend right=40] node [left] {} (f15);
\path(K16) edge [ bend right=40] node [left] {} (f16);

\path [line] (f1)        -- (xor1);
\path [line] (f2)        -- (xor2);
\path [line] (f15)        -- (xor3);
\path [line] (f16)        -- (xor4);
%   \path [line] (xor1)      -| node [near start] {$\oplus$} (xor1);
%   \path [line] (f2)        -- node {no}(FP);
%   \path [line,dashed] (L)  -- (P);
%   \path [line,dashed] (R)  -- (P);
\path [line,      ] (BR) -- (BR2);
\path [line,      ] (BR2) -- (f1);
\path [line, dotted] (BR3.south)      -- (xor3.north);
\path [line] (BR4.south)      -- (xor4.north);
\path [line] (BR5)      -- (FPR);
\path [line] (BR3)      -- (f2);
%   \path [line] (BR3)      -- (FPR);
\path [line] (xor1.south)      -- (BR3.north);
\path [line, dotted] (xor2.south)      -- (BR4.north);
\path [line] (xor3.south)      -- (BR5.north);
\path [line] (xor4)      -- (FPL);
\path [line] (BR4)        -- (f15);
\path [line] (BR5)        -- (f16);
% \path [line] (FPL)      -- (NOTL);
% \path [line] (FPR)      -- (NOTR);
\path [line] (NOTL.south)      -- (C);
\path [line] (NOTR.south)      -- (C);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
%%%%%%%


Here is a proposal. I am definitely not saying that it is better than the other proposals. There is a part that works arguably very nicely: one can spare some regions around some paths from being drawn, or, more precisely one can clip them away. The paths of these regions can be used for intersections. The not so nice feature is that the intersections are not too accurate, so one needs to tune a bit to draw the "bridges".

\documentclass{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[latin1]{inputenc}
\usepackage[active,tightpage]{preview}
\usepackage{verbatim}
\usepackage{tikz}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.pathreplacing,calc,intersections}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagestyle{empty}
% Define Block Styles %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\tikzstyle{decision} = [diamond, draw, fill=blue!20,
%    text width=4.5em, text badly centered, node distance=1.5cm, inner sep=0pt]
\tikzset{rdblk/.style={rectangle, draw, fill=red!20,
text width=1.5em, text centered, rounded corners, minimum height=2.5em},
block/.style={rectangle, draw, fill=blue!20,
text width=1.9em, text centered, rounded corners, minimum height=2.5em},
wideb/.style={rectangle, draw, fill=blue!20,
text width=19em, text centered, rounded corners, minimum height=2.6em},
wblnk/.style={rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=2.5em},
line/.style={draw, -latex'},
cloud/.style={draw, circle,fill=red!20, minimum height=2.5em, text centered},
grcld/.style={draw, circle,fill=green!20, minimum height=2.5em, text centered},
blcld/.style={draw, circle,fill=blue!20, minimum height=2.5em, text centered},
key/.style={draw, rectangle,fill=yellow!20, minimum height=2.5em,
text width=1.9em, text centered, rounded corners, minimum height=2.5em},
point/.style={draw, circle,fill=black!20, minimum height=2.5em, text centered},
single line bounding box/.style={postaction={decorate,decoration={show path construction,
lineto code={
\path[name path=#1]
($(\tikzinputsegmentfirst)!\pgfkeysvalueof{/tikz/slbb/dist}!90:(\tikzinputsegmentlast)$)
coordinate (bb#1-1)
-- ($(\tikzinputsegmentlast)!\pgfkeysvalueof{/tikz/slbb/dist}!-90:(\tikzinputsegmentfirst)$)
coordinate (bb#1-2)
-- ($(\tikzinputsegmentlast)!\pgfkeysvalueof{/tikz/slbb/dist}!90:(\tikzinputsegmentfirst)$)
coordinate (bb#1-3)
-- ($(\tikzinputsegmentfirst)!\pgfkeysvalueof{/tikz/slbb/dist}!-90:(\tikzinputsegmentlast)$)
coordinate (bb#1-4)
-- cycle;
}}}},
reconstruct bounding box/.style={insert path={
(bb#1-1) -- (bb#1-2) -- (bb#1-3) -- (bb#1-4) -- cycle}},
bullet/.style={circle,fill,inner sep=0.5pt,node contents={}},
slbb/.cd,dist/.initial=1.5pt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}[-{>[scale=1,
length=4,
width=4]}, >=Stealth, auto, node distance=1.5cm]
% Place Nodes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\node [cloud,                 ] (P)   {$P$};
\node [wideb, below of=P,     ] (IP)  {$\pi_1$};
\node [blcld, below of=IP     ] (f1)  {$f_1$};

\node [cloud, above of=IP     ] (Pp)   {$P$};
\node [     , left  of=P      ] (L)   {};
\node [     , right of=P      ] (R)   {};
\node [cloud, below of=L      ] (BL)  {$L_0$};
\node [cloud, below of=R      ] (BR)  {$R_0$};
\node [     , below of=BL     ] (BL2) {};
\node [point, below of=BR     ] (BR2) {};
\node [     , below of=BL2    ] (BL3) {};
\node [point, below of=BR2    ] (BR3) {};
\node [     , below of=BL3    ] (BL4) {};
\node [point, below of=BR3    ] (BR4) {};
\node [     , below of=BL4    ] (BL5) {};
\node [point, below of=BR4    ] (BR5) {};
\node [     , below of=BL5    ] (BL6) {};
\node [point, below of=BR5    ] (BR6) {};
\node [     , below of=BL6    ] (BL7) {};
% \node [cloud, below of=BR6    ] (BR7) {};
\node [key  , right of=BR2    ] (K1)  {$K_1$};
\node [key  , below of=K1     ] (K2)  {$K_2$};
\node [key  , below of=K2     ] (K15) {$K_{15}$};
\node [key  , below of=K15    ] (K16) {$K_{16}$};
\node [blcld, below of=IP     ] (f1)  {$f$};
\node [grcld, left  of=f1,   node distance=1.5cm] (xor1) {$\oplus$};
\node [grcld, below of=xor1, node distance=1.5cm] (xor2) {$\oplus$};
\node [grcld, below of=xor2, node distance=1.5cm] (xor3) {$\oplus$};
\node [grcld, below of=xor3, node distance=1.5cm] (xor4) {$\oplus$};
\node [blcld, below of=f1,    ] (f2)   {$f$};
\node [blcld, below of=f2,    ] (f15)  {$f$};
\node [blcld, below of=f15,   ] (f16)  {$f$};

\node [wideb, below  of=f16,   node distance=1.5cm] (FP)   {$\pi_1^{-1}$};
\node [     , below  of=FP       ] (BFP)    {};
\node [cloud, below  of=FP      ] (C)    {$C$};
\node [cloud, left  of=FP      ] (FPL)  {$R$};
\node [cloud, right of=FP      ] (FPR)  {$R$};
\node [wideb, below  of=f16,   node distance=1.5cm] (FP)   {$\pi_1^{-1}$};
\node [cloud, left   of=FP      ] (NOTL)   {$\overline L$};
\node [cloud, right   of=FP      ] (NOTR)   {$\overline R$};
% Draw Edges %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\path [line] (Pp)         -- (IP);
% \path [line] (Pp)         -- node {\tiny 28-bit}(BL);
% \path [line] (Pp)         -- node {\tiny 28-bit}(BR);
% \path [line] (L)         -- (BL);
% \path [line] (R)         -- (BR);
\path [line] (BL)        -- (xor1);
\path [line] (BR2.south)       -- (xor2.north);
% \path [line] (K1)        -- (f1);

\path [line] (f1)        -- (xor1);
\path [line] (f2)        -- (xor2);
\path [line] (f15)        -- (xor3);
\path [line] (f16)        -- (xor4);
%   \path [line] (xor1)      -| node [near start] {$\oplus$} (xor1);
%   \path [line] (f2)        -- node {no}(FP);
%   \path [line,dashed] (L)  -- (P);
%   \path [line,dashed] (R)  -- (P);
\path [line,slbb/dist=3pt,single line bounding box=A] (BR) -- (BR2);
\path [line,      ] (BR2) -- (f1);
\path [line, dotted] (BR3.south)      -- (xor3.north);
\path [line] (BR4.south)      -- (xor4.north);
\path [line] (BR5)      -- (FPR);
\path [line] (BR3)      -- (f2);
%   \path [line] (BR3)      -- (FPR);
\path [line,single line bounding box=B] (xor1.south)      -- (BR3.north);
\path [line, dotted,single line bounding box=C] (xor2.south)      -- (BR4.north);
\path [line,single line bounding box=D] (xor3.south)      -- (BR5.north);
\path [line] (xor4)      -- (FPL);
\path [line] (BR4)        -- (f15);
\path [line] (BR5)        -- (f16);
% \path [line] (FPL)      -- (NOTL);
% \path [line] (FPR)      -- (NOTR);
\path [line] (NOTL.south)      -- (C);
\path [line] (NOTR.south)      -- (C);
\begin{scope}
\path[clip,reconstruct bounding box/.list={A,B,C,D}]
(current bounding box.south west) -|
(current bounding box.north east) -| cycle;
\path[name path global=avoid,reconstruct bounding box/.list={A,B,C,D}];
\draw[name path global=p1](K1) to[ bend right=40] (f1);
\draw[name path global=p2](K2) to[ bend right=40] (f2);
\draw[name path global=p3](K15) to[ bend right=40] (f15);
\draw[name path global=p4](K16) to[ bend right=40] (f16);
\end{scope}
\foreach \X [count=\Y] in {A,B,C,D}
{\draw[name intersections={of={p\Y} and \X},-]
\ifnum\Y=1
(intersection-1) to[bend right=75] (intersection-2)
\else
([xshift=-0.4pt]intersection-1) to[bend right=75] ([xshift=-0.4pt]intersection-2)
\fi
;}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document} I am sure that LoopSpace will be able to provide you with a much better solution.