I'll add this as an anwer, since it won't fit in a comment. The basic idea is to define some path segments, like loops, bumps, figures eight, etc. With the basic rule that they start and end at the same height. Then we can construct a path between two nodes on the same height, by linking these segments together. If we need to bridge a difference in height, we could add a parameter to the shapes to determine the offset in height. By creating more complicated segments and perhaps randomizing their parameters, we can obtain a relatively random looking path, while still having a guarantee that it will start and end at our nodes. A small example:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing, calc}
\begin{document}
\def\dloop#1#2#3{
\draw[squig] (curr) -- ++(#1,0) arc(-90:270:#2) -- ++(#3,0);
\coordinate (curr) at ($(curr) + (#1,0) + (#3,0)$);
}
\def\dhump#1{
\pgfmathsetmacro{\absone}{abs(#1)}
\draw[squig] (curr) .. controls ($(curr) + (.7*\absone,#1)$) .. ++(1.4*\absone,0);
\coordinate (curr) at ($(curr) + (1.4*\absone,0)$);
}
\def\dnor#1{
\draw[squig] (curr) -- ++(#1,0);
\coordinate (curr) at ($(curr) +(#1,0)$);
}
\begin{tikzpicture}[squig/.style={decorate, decoration={random steps,segment length=2pt,amplitude=.5pt}}]
\coordinate (curr) at (0,0);
\node[anchor=east] at (curr) {start};
\dnor{1}
\dloop{.2}{.7}{0} \dloop{0}{.77}{.5}
\dhump{1}
\dhump{-.5}
\dhump{2}
\dnor{.5}
\dloop{.1}{.5}{0}\dloop{0.05}{.55}{0.08}\dloop{.02}{.48}{.2}
\dnor{1}
\node[anchor=west] at (curr) {end};
\end{tikzpicture}
\end{document}
And the resulting document:
Update: I saw Jake's post in Easy curves in TikZ and that made me think that this could be apllied here to mimic the lines in the xkcd graphic. Sticking with the idea of using path segments the output can be made to look significantly better. The code is as follows:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\def\twirl{(curr) ($(curr)+(.5,.2)$) ($(curr)+(1,.5)$) ($(curr)+(1,1)$) ($(curr)+(0,1.5)$) ($(curr)+(-1,1)$) ($(curr)+(-1.25,0)$) ($(curr)+(-1,-.5)$) ($(curr)+(0,-1)$) ($(curr)+(1,0)$) ($(curr)+(1.25,0)$)}
\def\figeight{(curr) ($(curr)+(1,1)$) ($(curr)+(2,1)$) ($(curr)+(2.5,0)$) ($(curr)+(2,-1)$) ($(curr)+(-1,1)$) ($(curr)+(-2,1)$) ($(curr)+(-2.5,0)$) ($(curr)+(-2,-1)$) ($(curr)+(-1,-1)$) ($(curr)+(1,0)$) ($(curr)+(1.25,0)$)}
\def\nor{(curr) ($(curr)+(1.25,0)$)}
\def\start{(curr) ($(curr)+(.5,0)$) ($(curr)+(1,.25)$) ($(curr)+(1.5,0)$) ($(curr)+(2,0)$)}
\def\nushape{(curr) ($(curr)+(.2,.5)$) ($(curr)+(.5,.75)$) ($(curr)+(.8,.5)$) ($(curr)+(1,0)$) ($(curr)+(1.5,-1)$) ($(curr)+(2.5,0)$) ($(curr)+(2.5,1)$) ($(curr)+(2.25,1.2)$) ($(curr)+(2,.5)$) ($(curr)+(2.5,0)$) ($(curr)+(2.75,0)$)}
\begin{tikzpicture}
\coordinate (curr) at (0,0);
\path [draw, rounded corners] node[anchor=east] {start} plot[smooth,tension=1] coordinates {\start} coordinate (curr)
\foreach \x in {\nushape,\twirl,\nor,\figeight,\twirl,\nor,\figeight,\start}{
-- plot [smooth, tension=.5] coordinates {\x}
coordinate (curr)
} node[anchor=west] {end};
\end{tikzpicture}
\end{document}
The result then looks like this:
If you were to parameterize the height and add some randomness, You should be able to get relatively close to the xkcd graphic.
Best Answer
how about pst-circ. It modifies the way you can compile your latex document.