如何使图形的节点通过曲线连接起来,如下所示:
我的工作:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix,positioning,shapes,arrows}
\usetikzlibrary{shapes.geometric, arrows, calc, intersections}
\newcommand{\tikznode}[2]{\relax
\ifmmode%
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
\else
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}
\begin{document}
\begin{figure}[!h]
\centering
\begin{tikzpicture}
\centering
\coordinate (a) at (0,0);
\coordinate (b) at (0,-2);
\coordinate (c) at (2,-1);
\coordinate (d) at (4,-1);
\coordinate (e) at (7,-1);
\coordinate (f) at (9,-1);
\draw (a) node[left]{$v_0$};
\draw (b) node[left]{$v_3$};
\draw (c) node[above]{$v_1$};
\draw (d) node[above]{$v_2$};
\draw (e) node[above]{$v_0$};
\draw (f) node[above]{$v_1$};
\draw [fill=black] (a) circle (2pt);
\draw [fill=black] (b) circle (2pt);
\draw [fill=black] (c) circle (2pt);
\draw [fill=black] (d) circle (2pt);
\draw [fill=black] (e) circle (2pt);
\draw [fill=black] (f) circle (2pt);
\end{tikzpicture}
\end{figure}
\end{document}
产生
请帮忙。
答案1
对于某些路径来说这相当简单to[in=..,out=..]
。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{quotes}
\begin{document}
\begin{figure}[!h]
\centering
\begin{tikzpicture}[dot/.style={inner sep=2pt,fill,circle},auto]
\path[nodes=dot] (0,0) node[label=left:$v_0$] (a) {}
(0,-2) node[label=left:$v_3$] (b) {}
(2,-1) node[label=above:$v_1$] (c) {}
(4,-1) node[label=above:$v_2$] (d){}
(7,-1) node[label=above left:$v_0$] (e){}
(9,-1) node[label=above right:$v_1$] (f){};
\draw (a) to[out=0,in=135,"$e_1$"](c)
to[out=-45,in=-135,"$e_2$"'] (d)
to[out=45,in=90,"$e_3$"]++(1.5,0)
to[out=-90,in=-45] (d)
to[out=135,in=45,"$e_4$"'] (c)
to[out=-135,in=0,"$e_5$"] (b);
\draw (e) to["$e_1$"] (f)
(e) to[out=90,in=90,"$e_3$"] (f)
to[out=-90,in=00] ++ (-0.5,-1.5)
to[out=180,in=00] ++ (-1.5,0)node[below left]{$e_4$}
to[out=180,in=180] (e);
\draw[white,line width=4pt,postaction={draw,black,thin}]
(f) to[out=0,in=90] ++ (1,-0.25) node[right,black]{$e_2$}
to[out=-90,in=-90] (e);
\end{tikzpicture}
\end{figure}
\end{document}
答案2
一般回答:你试过 \usepackage{tkz-berge} 吗?使用 AlterMundus 手册,你应该能够很好地完成它。