2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-28 23:37:57 +02:00
LaTeX-examples/tikz/hopfield-network/hopfield-network.tex

29 lines
1 KiB
TeX
Raw Normal View History

2016-02-12 23:32:01 +01:00
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{tikz}
\tikzstyle{neuron}=[draw,circle,minimum size=20pt,inner sep=0pt, fill=white]
\tikzstyle{stateTransition}=[very thick]
\tikzstyle{learned}=[text=red]
\begin{document}
\newcommand\n{5}
\begin{tikzpicture}[scale=1.3]
\begin{scope}[rotate=17]
%the multiplication with floats is not possible. Thus I split the loop in two.
\foreach \number in {1,...,\n}{
\node[neuron] (N-\number) at ({\number*(360/\n)}:1.5cm) {$x_\number$};
}
\foreach \number in {1,...,\n}{
\foreach \y in {1,...,\n}{
\draw[stateTransition] (N-\number) -- (N-\y);
}
}
\end{scope}
\begin{scope}[rotate=-1]
\draw[learned,stateTransition] (N-1) -- (N-2) node [midway,above=-0.15cm,sloped] {$w_{1,2}$};
\draw[learned,stateTransition] (N-1) -- (N-5) node [midway,above=-0.15cm,sloped] {$w_{1,5}$};
\end{scope}
\end{tikzpicture}
\end{document}