0

I am trying to draw the following in LaTeX:

enter image description here

I am able to draw the graph but unable to draw the dotted region.

I am using tikz-network.

Help is much appreciated.


The code: \begin{tikzpicture}

    \Vertex[size=.1,color=red]{A}
    \Vertex[y=2,size=.1,color=black]{B}
    \Vertex[x=2,y=0,size=.1,color=red]{C} 
    \Vertex[x=2,y=2,size=.1,color=black]{D}
    \Vertex[x=2,y=-2,size=.1,color=black]{E}
    \Vertex[x=4,y=0,size=.1,color=black]{F} 
    \Vertex[x=4,y=-2,size=.1,color=black]{G}
    
    \Vertex[x=3,y=2,size=.1,color=black]{D1}
    \Vertex[x=4,y=1,size=.1,color=black]{F1}

    \Vertex[x=-2,y=-.7,size=.1,color=black]{D2}
    \Vertex[x=-2,y=.7,size=.1,color=black]{F2}  
    
    \Vertex[x=-1,y=-2,size=.1,color=black]{D3}
    \Vertex[x=1,y=-2,size=.1,color=black]{E3}   
    
    \Edge[lw=2pt](A)(B)
    \Edge[lw=2pt](A)(C)
    \Edge[lw=2pt](A)(D)
    \Edge[lw=2pt](B)(C)
    \Edge[lw=2pt](B)(D)
    \Edge[lw=2pt](C)(D)
    
    \Edge[lw=2pt](C)(E)
    \Edge[lw=2pt](C)(F)
    \Edge[lw=2pt](C)(G)
    \Edge[lw=2pt](E)(F)
    \Edge[lw=2pt](E)(G)
    \Edge[lw=2pt](F)(G)
    
    \Edge[lw=2pt](C)(D1)
    \Edge[lw=2pt](C)(F1)
    \Edge[lw=2pt](D1)(F1)
    
    \Edge[lw=2pt](A)(D2)
    \Edge[lw=2pt](A)(F2)
    \Edge[lw=2pt](D2)(F2)
    
    \Edge[lw=2pt](A)(D3)
    \Edge[lw=2pt](A)(E3)
\end{tikzpicture}
5
  • Please show minimal compilable code for the graph. Commented Aug 29, 2022 at 2:45
  • @hpekristiansen i have added the code.
    – User8976
    Commented Aug 29, 2022 at 2:58
  • Please make your code compilable Commented Aug 29, 2022 at 3:05
  • @hpekristiansen I have made it compilable.
    – User8976
    Commented Aug 29, 2022 at 3:29
  • It is still not compilable. Please see: tex.meta.stackexchange.com/questions/228/… for future reference. Commented Aug 29, 2022 at 3:31

1 Answer 1

1
\documentclass[tikz,  border=1cm]{standalone}
\usepackage{tikz-network}
\usetikzlibrary{hobby}
\begin{document} 
\begin{tikzpicture}

\Vertex[size=.1, color=red]{A}
\Vertex[y=2, size=.1, color=black]{B} 
\Vertex[x=2, y=0, size=.1, color=red]{C} 
\Vertex[x=2, y=2, size=.1, color=black]{D} 
\Vertex[x=2, y=-2, size=.1, color=black]{E} 
\Vertex[x=4, y=0, size=.1, color=black]{F} 
\Vertex[x=4, y=-2, size=.1, color=black]{G}
\Vertex[x=3, y=2, size=.1, color=black]{D1}
\Vertex[x=4, y=1, size=.1, color=black]{F1}
\Vertex[x=-2, y=-.7, size=.1, color=black]{D2}
\Vertex[x=-2, y=.7, size=.1, color=black]{F2}  
\Vertex[x=-1, y=-2, size=.1, color=black]{D3}
\Vertex[x=1, y=-2, size=.1, color=black]{E3}   

\Edge[lw=2pt](A)(B)
\Edge[lw=2pt](A)(C)
\Edge[lw=2pt](A)(D)
\Edge[lw=2pt](B)(C)
\Edge[lw=2pt](B)(D)
\Edge[lw=2pt](C)(D)
\Edge[lw=2pt](C)(E)
\Edge[lw=2pt](C)(F)
\Edge[lw=2pt](C)(G)
\Edge[lw=2pt](E)(F)
\Edge[lw=2pt](E)(G)
\Edge[lw=2pt](F)(G)
\Edge[lw=2pt](C)(D1)
\Edge[lw=2pt](C)(F1)
\Edge[lw=2pt](D1)(F1)
\Edge[lw=2pt](A)(D2)
\Edge[lw=2pt](A)(F2)
\Edge[lw=2pt](D2)(F2)
\Edge[lw=2pt](A)(D3)
\Edge[lw=2pt](A)(E3)

\draw[red, thick, dashed, use Hobby shortcut, closed]  (C)..(2.3,2.5)..(0,2.8)..(-3,0)..(1,-2.5);
\end{tikzpicture}
\end{document}

Network diagram with red dashed loop

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .