[OS X TeX] Complete Graphs on n vertices
Luís Fernando Sequeira
lfsequeira at gmail.com
Sun Nov 27 10:37:15 EST 2022
As promised, here is a version of the code to draw a complete graph, using tikz.
In this complete example, it draws K28, but it works with any number of nodes.
I added an optional parameter so you can easily change the size of the drawing.
I find it quite nice, too :-)
Regards
Luís Sequeira
----------
%!TEX TS-program = xelatex
\documentclass{article}
\pagestyle{empty}
\usepackage{tikz}
\newcommand{\K}[2][5]{
\begin{tikzpicture}
\newcommand{\ang}{360/#2}
\foreach \i in {1,...,#2}
\foreach \j in {1,...,#2}
\draw (\ang*\i:#1) -- (\ang*\j:#1);
\end{tikzpicture}
}
\begin{document}
\begin{center}
\K[3]{23}
\end{center}
\end{document}
----------
More information about the MacOSX-TeX
mailing list