1

enter image description here

\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}

I am trying to draw the following figure in Latex. I have drawn it almost but I am not able to draw those curvy line at the respective vertices as shown in the figure attached. How to draw such curve?

3
  • My code is fine. But I am not able to give those curvy lines in the respective vertices. Please help
    – vqw7Ad
    Nov 16 '19 at 18:41
  • There is the random steps decoration for that purpose.
    – user194703
    Nov 16 '19 at 18:48
  • Please give the code for that IF POSSIBLE. tHANK YOU
    – vqw7Ad
    Nov 16 '19 at 18:50
2

I added the curvy lines to the left part of your picture, the right part is left as an exercise (also because I like the fact that "the right part is left" is not always a nonsensical statement ;-). To this end, I added a style curvy line, which is based on the random steps decoration, and you may adjust the segment length, amplitude and rounded corners to your likings. A single curvy line can be drawn with

\draw[curvy line] (a3) -- ++ (80:1.7);

see the examples in

\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}

enter image description here

BTW, \textit{$U_1$} does not make sense, use $U_1$ instead, and you can use the every label style to make all labels \scriptsize.

If you use

\tikzset{curvy line/.style={decorate,decoration={snake,segment length=8.5mm,
   amplitude=1mm}}}

you get

enter image description here

8
  • ok. I will try. Can I use dotted lines in place of curvy lines. I mean the shape will be like that but the curve in this case composed of some dots or small line segments
    – vqw7Ad
    Nov 16 '19 at 19:58
  • @J.Doe You can do \draw[dashed,curvy line] (a3) -- ++ (80:1.7); or \draw[dotted,curvy line] (a3) -- ++ (80:1.7);.
    – user194703
    Nov 16 '19 at 20:01
  • Ok. Thank you. And if I need some symmetrical lines, can we do that..because curvy lines are not symmetric
    – vqw7Ad
    Nov 16 '19 at 20:05
  • 1
    @J.Doe Sorry, it is becoming a bit cumbersome. These are random steps, so no, they are not symmetric. On the other hand, you asked me "Please give the code for that", i.e. for a code for random steps. If I would have known that they need to be symmetric, I would not have suggested random steps, nor written an answer. If I add a version that produces symmetric curvy lines (not even sure I understand what that means) then I fear there might be the next additional requirement that you didn't specify.
    – user194703
    Nov 16 '19 at 20:09
  • OK. NO PROBLEM.
    – vqw7Ad
    Nov 16 '19 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.