[Tex/LaTex] Creating a graph in LyX

lyx

I am new to LyX and I was trying to build the following graph:

enter image description here

  • I tried to draw it using Paint but failed to do a proper graph. Hope LyX can do a better job then me.

How To draw this graph in LyX?

Best Answer

According to @scottkosty, you should be able to import the following snippet into Lyx.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\newdimen\R % radius
\R=1.5cm 
\newdimen\SmallR % node radius
\SmallR=0.5cm
\newcommand{\A}{360/7}
\begin{tikzpicture}
\node[circle,minimum size=2*\SmallR,draw,thick] (1) at (0,0) {1};
\foreach \X in {2,...,8}
{\node[circle,minimum size=2*\SmallR,draw,thick] (\X) at ({-\X*\A+180}:\R) {\X};}
\foreach \X in {2,...,8}
{\pgfmathtruncatemacro{\Y}{mod(\X-1,7)+2}
\draw[-latex] (\X)--({\Y});
\draw[-latex] (1)--({\Y});}
\end{tikzpicture}
\end{document}

When compiled with pdflatex, it produces

enter image description here

Related Question