Some irregular curves and their surrounding shadows are all needed to draw a graph in graph theory. I'm not very good at drawing this with Tikz, but I want to do my best to draw the following graph.
I used some code from Drawing Königsberg landscape showing the bridges and it seems that no good and concise. But I didn't draw it well enough, and the code wasn't clean enough.
\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing, calc}
\definecolor{babypink}{rgb}{0.96, 0.76, 0.76}
\tikzset{%
contour/.style={dashed,%
very thick,%
decoration={%
random steps,%
segment length=4pt,%
amplitude=0.5pt%
},%
rounded corners=1pt,%
decorate%
}%
}
\begin{document}
\begin{tikzpicture}[x=10cm, y=9.19cm]
\filldraw[babypink] ($(0, 1) + (0.241, -0.622)$) -- ($(0, 1) + (0.235,
-0.587)$)
--
($(0, 1) + (0.240, -0.540)$) -- ($(0, 1) + (0.249, -0.524)$) --
($(0, 1) + (0.252, -0.498)$) -- ($(0, 1) + (0.266, -0.482)$) --
($(0, 1) + (0.271, -0.462)$) -- ($(0, 1) + (0.288, -0.454)$) --
($(0, 1) + (0.300, -0.434)$) -- ($(0, 1) + (0.308, -0.418)$) --
($(0, 1) + (0.320, -0.412)$) -- ($(0, 1) + (0.328, -0.404)$) --
($(0, 1) + (0.399, -0.399)$) -- ($(0, 1) + (0.453, -0.393)$) --
($(0, 1) + (0.518, -0.386)$) -- ($(0, 1) + (0.549, -0.388)$) --
($(0, 1) + (0.609, -0.404)$) -- ($(0, 1) + (0.624, -0.410)$) --
($(0, 1) + (0.644, -0.438)$) -- ($(0, 1) + (0.663, -0.486)$) --
($(0, 1) + (0.670, -0.519)$) -- ($(0, 1) + (0.668, -0.546)$) --
($(0, 1) + (0.658, -0.590)$) -- ($(0, 1) + (0.648, -0.612)$) --
($(0, 1) + (0.636, -0.648)$) -- ($(0, 1) + (0.633, -0.666)$) --
($(0, 1) + (0.617, -0.677)$) -- ($(0, 1) + (0.596, -0.700)$) --
($(0, 1) + (0.535, -0.708)$) -- ($(0, 1) + (0.500, -0.709)$) --
($(0, 1) + (0.457, -0.717)$) -- ($(0, 1) + (0.412, -0.708)$) --
($(0, 1) + (0.372, -0.702)$) -- ($(0, 1) + (0.336, -0.695)$) --
($(0, 1) + (0.291, -0.679)$) -- ($(0, 1) + (0.268, -0.652)$) --
cycle;
\draw[contour] ($(0, 1) + (0.241, -0.622)$) -- ($(0, 1) + (0.235, -0.587)$) --
($(0, 1) + (0.240, -0.540)$) -- ($(0, 1) + (0.249, -0.524)$) --
($(0, 1) + (0.252, -0.498)$) -- ($(0, 1) + (0.266, -0.482)$) --
($(0, 1) + (0.271, -0.462)$) -- ($(0, 1) + (0.288, -0.454)$) --
($(0, 1) + (0.300, -0.434)$) -- ($(0, 1) + (0.308, -0.418)$) --
($(0, 1) + (0.320, -0.412)$) -- ($(0, 1) + (0.328, -0.404)$) --
($(0, 1) + (0.399, -0.399)$) -- ($(0, 1) + (0.453, -0.393)$) --
($(0, 1) + (0.518, -0.386)$) -- ($(0, 1) + (0.549, -0.388)$) --
($(0, 1) + (0.609, -0.404)$) -- ($(0, 1) + (0.624, -0.410)$) --
($(0, 1) + (0.644, -0.438)$) -- ($(0, 1) + (0.663, -0.486)$) --
($(0, 1) + (0.670, -0.519)$) -- ($(0, 1) + (0.668, -0.546)$) --
($(0, 1) + (0.658, -0.590)$) -- ($(0, 1) + (0.648, -0.612)$) --
($(0, 1) + (0.636, -0.648)$) -- ($(0, 1) + (0.633, -0.666)$) --
($(0, 1) + (0.617, -0.677)$) -- ($(0, 1) + (0.596, -0.700)$) --
($(0, 1) + (0.535, -0.708)$) -- ($(0, 1) + (0.500, -0.709)$) --
($(0, 1) + (0.457, -0.717)$) -- ($(0, 1) + (0.412, -0.708)$) --
($(0, 1) + (0.372, -0.702)$) -- ($(0, 1) + (0.336, -0.695)$) --
($(0, 1) + (0.291, -0.679)$) -- ($(0, 1) + (0.268, -0.652)$) --
($(0, 1) + (0.241, -0.622)$);
\node[draw,circle] (u) at ($(0, 1) + (0.5, -0.388)$)[label={$u$}]{};
\node[draw,circle] (u2) at ($(0, 1) + (0.658,
-0.582)$)[label=right:{$u_2$}]{};
\node[draw,circle] (v) at ($(0, 1) + (0.5, -0.71)$)[label=below:{$v$}]{};
\node[draw,circle] (u1) at ($(0, 1) + (0.23, -0.582)$)[label=left:{$u_1$}]{};
\draw [in=-165, out=165, looseness=5.00](u) to (v);
\node[] at (0.5,0.5) {$f$};
\end{tikzpicture}
\end{document}
Holding a learning attitude, I‘d like to learn more concise tikz code which can draw the graph I want. For those irregular curves in the original graph, I don't know if there is any software that can assist in generating them.
Best Answer
That's a very painful way of drawing something like that. Unfortunately, the
random steps
command is not very easy to use in this context so maybe drawing this step by step withrounded corners
could be a solution:This is obviously strongly customizable.