\documentclass[a4paper, 12pt, oneside]{article}
\usepackage{pst-all}
\usepackage{tikz}
\begin{document}
\tikzset{every path/.style=thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=1pt,
minimum size=.13cm
}}
\begin{figure}[hbt!]
\begin{center}
\begin{tikzpicture}[scale=.7]
\begin{scope}
\begin{scope}
\node (a1) at (0,0) [acteur,label=below:\scriptsize{1}]{};
\node (a2) at (1.5,0) [acteur,label=below:\scriptsize{2}]{};
\node (a3) at (1.5,1.5) [acteur,label=below right:\scriptsize{3}]{};
\node (a9) at (0,1.5) [acteur,label=below left:\scriptsize{9}]{};
\node (a7) at (.75,3) [acteur,label=right:\scriptsize{7}]{};
\node (a4) at (3,1.5) [acteur,label=right:\scriptsize{4}]{};
\node (a5) at (2.25,3) [acteur,label=above:\scriptsize{5}]{};
\node (a6) at (3.8,3) [acteur,label=right:\scriptsize{6}]{};
\node (a8) at (.75,4.5) [acteur,label=above:\scriptsize{8}]{};
\node (a10) at (-1.5,1.5) [acteur,label=left:\scriptsize{10}]{};
\node (a11) at (-.75,3) [acteur,label=above:\scriptsize{11}]{};
\node (a12) at (-2.2,3) [acteur,label=left:\scriptsize{12}]{};
\node (a13) at (1.7,4.5) [acteur,label=above:\scriptsize{13}]{};
\node (a14) at (2.8,4.5) [acteur,label=right:\scriptsize{14}]{};
\draw (a1) -- (a2);
\draw [dashed] (a2) -- (a3);
\draw (a3) -- (a4);
\draw [dashed](a3) -- (a5);
\draw (a5) -- (a6);
\draw [dashed](a3) -- (a7);
\draw (a7) -- (a8);
\draw (a9) -- (a10);
\draw [dashed] (a9) -- (a11);
\draw (a11) -- (a12);
\draw [dashed] (a1) -- (a9);
\draw [dashed] (a9) -- (a7);
\draw [dashed] (a13) -- (a7);
\draw (a13) -- (a14);
\node at (.75,-1) {\textit{$U_1$}};
\end{scope}
\begin{scope}[xshift=8cm]
\node (a1) at (0,0) [acteur,label=below:\scriptsize{1}]{};
\node (a2) at (1.5,1.5) [acteur,label=below:\scriptsize{2}]{};
\node (a3) at (3,1.5) [acteur,label=below:\scriptsize{3}]{};
\node (a4) at (4.5,0) [acteur,label=below:\scriptsize{4}]{};
\node (a5) at (3,3) [acteur,label=below right:\scriptsize{5}]{};
\node (a6) at (4.5,3) [acteur,label=right:\scriptsize{6}]{};
\node (a7) at (2.25,5) [acteur,label=left:\scriptsize{7}]{};
\node (a8) at (3.5,5) [acteur,label=below:\scriptsize{8}]{};
\node (a9) at (4.75,5) [acteur,label=below:\scriptsize{9}]{};
\node (a10) at (6,5) [acteur,label=below:\scriptsize{10}]{};
\node (a11) at (7.25,5) [acteur,label=below:\scriptsize{11}]{};
\node (a15) at (1.2,6.5) [acteur,label=below:\scriptsize{15}]{};
\node (a16) at (0,6.5) [acteur,label=below:\scriptsize{16}]{};
\node (a17) at (3.3,6.5) [acteur,label=above:\scriptsize{17}]{};
\node (a18) at (4.76,6.5) [acteur,label=below:\scriptsize{18}]{};
\node (a12) at (2.25,6.5) [acteur,label=above:\scriptsize{12}]{};
\node (a13) at (1.5,3) [acteur,label=below left:\scriptsize{13}]{};
\node (a14) at (0,3) [acteur,label=left:\scriptsize{14}]{};
\draw (a1) -- (a2);
\draw [dashed] (a2) -- (a3);
\draw (a3) -- (a4);
\draw [dashed](a3) -- (a5);
\draw (a5) -- (a6);
\draw [dashed](a5) -- (a7);
\draw [dashed] (a17) -- (a8);
\draw (a8) -- (a9);
\draw [dashed](a9) -- (a10);
\draw (a10) -- (a11);
\draw (a7) -- (a12);
\draw [dashed] (a7) -- (a13);
\draw (a13) -- (a14);
\draw [dashed](a2) -- (a13);
\draw [dashed](a7) -- (a15);
\draw (a15) -- (a16);
\draw [dashed](a7) -- (a17);
\draw (a17) -- (a18);
\node at (2.25,-1) {\textit{$U_2$}};
\end{scope}
\end{scope}
\end{tikzpicture}
\caption{The solid edges are the matching edges. The graph $U_1$ lies in $S_1$ while $U_2$ lies in $S_2$. }
\end{center}
\end{figure}
\end{document}
我正在尝试在 Latex 中绘制下图。我差不多画出来了,但我无法在各个顶点处绘制曲线,如附图所示。如何绘制这样的曲线?
答案1
我把曲线添加到图片的左侧,右侧部分留作练习(也因为我喜欢“右侧部分留作”并不总是无意义的说法 ;-)。为此,我添加了基于curvy line
装饰的样式random steps
,您可以根据自己的喜好调整和segment length
。可以使用 绘制一条曲线amplitude
rounded corners
\draw[curvy line] (a3) -- ++ (80:1.7);
参见示例
\documentclass[a4paper, 12pt, oneside]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\tikzset{every path/.style=thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=1pt,
minimum size=.13cm
},
curvy line/.style={decorate,,rounded corners=2pt,decoration={random steps,segment length=3mm,
amplitude=1mm}}}
\begin{figure}[hbt!]
\begin{center}
\begin{tikzpicture}[scale=.7,every label/.append style={font=\scriptsize}]
\begin{scope}
\begin{scope}
\node (a1) at (0,0) [acteur,label=below:{1}]{};
\node (a2) at (1.5,0) [acteur,label=below:{2}]{};
\node (a3) at (1.5,1.5) [acteur,label=below right:{3}]{};
\node (a9) at (0,1.5) [acteur,label=below left:{9}]{};
\node (a7) at (.75,3) [acteur,label=right:{7}]{};
\node (a4) at (3,1.5) [acteur,label=right:{4}]{};
\node (a5) at (2.25,3) [acteur,label=above:{5}]{};
\node (a6) at (3.8,3) [acteur,label=right:{6}]{};
\node (a8) at (.75,4.5) [acteur,label=above:{8}]{};
\node (a10) at (-1.5,1.5) [acteur,label=left:{10}]{};
\node (a11) at (-.75,3) [acteur,label=above:{11}]{};
\node (a12) at (-2.2,3) [acteur,label=left:{12}]{};
\node (a13) at (1.7,4.5) [acteur,label=above:{13}]{};
\node (a14) at (2.8,4.5) [acteur,label=right:{14}]{};
\draw (a1) -- (a2);
\draw [dashed] (a2) -- (a3);
\draw (a3) -- (a4);
\draw [dashed](a3) -- (a5);
\draw (a5) -- (a6);
\draw [dashed](a3) -- (a7);
\draw (a7) -- (a8);
\draw (a9) -- (a10);
\draw [dashed] (a9) -- (a11);
\draw (a11) -- (a12);
\draw [dashed] (a1) -- (a9);
\draw [dashed] (a9) -- (a7);
\draw [dashed] (a13) -- (a7);
\draw (a13) -- (a14);
\node at (.75,-1) {$U_1$};
% curvy lines
\draw[curvy line] (a3) -- ++ (80:1.7);
\draw[curvy line] (a3) -- ++ (-60:1.7);
\draw[curvy line] (a7) -- ++ (30:1.7);
\draw[curvy line] (a7) -- ++ (150:1.7);
\draw[curvy line] (a9) -- ++ (90:1.7);
\draw[curvy line] (a9) -- ++ (-120:1.7);
\end{scope}
\begin{scope}[xshift=8cm]
\node (a1) at (0,0) [acteur,label=below:{1}]{};
\node (a2) at (1.5,1.5) [acteur,label=below:{2}]{};
\node (a3) at (3,1.5) [acteur,label=below:{3}]{};
\node (a4) at (4.5,0) [acteur,label=below:{4}]{};
\node (a5) at (3,3) [acteur,label=below right:{5}]{};
\node (a6) at (4.5,3) [acteur,label=right:{6}]{};
\node (a7) at (2.25,5) [acteur,label=left:{7}]{};
\node (a8) at (3.5,5) [acteur,label=below:{8}]{};
\node (a9) at (4.75,5) [acteur,label=below:{9}]{};
\node (a10) at (6,5) [acteur,label=below:{10}]{};
\node (a11) at (7.25,5) [acteur,label=below:{11}]{};
\node (a15) at (1.2,6.5) [acteur,label=below:{15}]{};
\node (a16) at (0,6.5) [acteur,label=below:{16}]{};
\node (a17) at (3.3,6.5) [acteur,label=above:{17}]{};
\node (a18) at (4.76,6.5) [acteur,label=below:{18}]{};
\node (a12) at (2.25,6.5) [acteur,label=above:{12}]{};
\node (a13) at (1.5,3) [acteur,label=below left:{13}]{};
\node (a14) at (0,3) [acteur,label=left:{14}]{};
\draw (a1) -- (a2);
\draw [dashed] (a2) -- (a3);
\draw (a3) -- (a4);
\draw [dashed](a3) -- (a5);
\draw (a5) -- (a6);
\draw [dashed](a5) -- (a7);
\draw [dashed] (a17) -- (a8);
\draw (a8) -- (a9);
\draw [dashed](a9) -- (a10);
\draw (a10) -- (a11);
\draw (a7) -- (a12);
\draw [dashed] (a7) -- (a13);
\draw (a13) -- (a14);
\draw [dashed](a2) -- (a13);
\draw [dashed](a7) -- (a15);
\draw (a15) -- (a16);
\draw [dashed](a7) -- (a17);
\draw (a17) -- (a18);
\node at (2.25,-1) {$U_2$};
\end{scope}
\end{scope}
\end{tikzpicture}
\caption{The solid edges are the matching edges. The graph $U_1$ lies in $S_1$ while $U_2$ lies in $S_2$. }
\end{center}
\end{figure}
\end{document}
顺便说一句,\textit{$U_1$}
没有意义,$U_1$
而是使用,并且您可以使用every label
样式来制作所有标签\scriptsize
。
如果你使用
\tikzset{curvy line/.style={decorate,decoration={snake,segment length=8.5mm,
amplitude=1mm}}}
你得到