Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132948 views
License: OTHER
1
% A complete graph
2
% Author: Quintin Jean-Noël
3
% <http://moais.imag.fr/membres/jean-noel.quintin/>
4
\documentclass[varwidth=true, border=2pt]{standalone}
5
\usepackage[nomessages]{fp}% http://ctan.org/pkg/fp
6
\usepackage{tikz}
7
\usetikzlibrary[topaths]
8
9
10
\begin{document}
11
\newcommand\n{5}
12
\begin{tikzpicture}
13
%the multiplication with floats is not possible. Thus I split the loop in two.
14
\foreach \number in {1,...,\n}{
15
\node[vertex] (N-\number) at ({\number*(360/\n)}:5.4cm) {};
16
}
17
18
\foreach \number in {1,...,\n}{
19
\foreach \y in {1,...,\n}{
20
\draw (N-\number) -- (N-\y);
21
}
22
}
23
24
\node[vertex,red] (N-3) at ({3*(360/\n)}:5.4cm) {};
25
\node[vertex,red] (N-5) at ({5*(360/\n)}:5.4cm) {};
26
\draw[green, ultra thick] (N-3) -- (N-5);
27
\end{tikzpicture}
28
\end{document}
29
30