I'm looking for a simple way to draw the following picture using TikZ. Namely, I would like to only specify the coordinates of the cities and then to connect them by edges using a \foreach
loop. This would be easy if there were no directed edges at this picture:
So, more precisely, my question is how to modify the second \foreach
below to get a picture above.
\begin{scope}
\foreach \x/\y/\name/\label/\where in {1.2/1.4/a/{El Paso}/below,
1/3.2/b/Albuquerque/above, 2.5/3/c/Amarillo/below, 3.8/4/d/Wichita/above,
4.3/3.3/e/Tulsa/45, 5.2/2.8/f/{Little Rock}/right, 4.2/2/g/Dallas/left,
4.8/1/h/Houston/right, 3.6/0.6/i/{San Antonio}/below} {
\draw (\x,\y) circle (.4mm);
\node[draw,circle,minimum size=2mm,inner sep=0mm,label=\where:{\footnotesize \label}] (\name) at (\x,\y) {};
}
\foreach \s/\t in {a/b, b/c, c/e, e/d, e/f, f/g, h/g, h/i}
\path[draw] (\s) edge (\t);
\end{scope}
Best Answer
If you create a simple "decoration" which simply draws a stroke from the initial to the final point, you can use the
raise
option for decorated paths to get a parallel path. Applyingshorten >
andshorten <
to this raised path, and putting arrow tips on it, you get the desired result:Here is the code (the style
parallel arrow
takes care of all):Update
I added the numbers in each route. I had some fun parametrizing their position so that they can be all put in a single loop.