I have a problem drawing a chord network with TikZ.
This is my code so far:
\begin{tikzpicture}
\xdef\N{16}
\xdef\deltadegree{360/\N}
\draw[thick] (0,0) circle (6);
\foreach \i in {0,...,15} {
% predecessor
\pgfmathparse{mod(\i-1,\N)}
\draw[color=red] (-\i*\deltadegree+90:6) -- (-1*\pgfmathresult*\deltadegree+90:6);
% successor
\pgfmathparse{mod(\i+1,\N)}
\draw (-\i*\deltadegree+90:6) -- (-1*\pgfmathresult*\deltadegree+90:6);
% fingers
\foreach \j in {0,...,4}{
\pgfmathparse{mod(\i+2^\j,\N)}
\draw (-\i*\deltadegree+90:6) -- (-1*\pgfmathresult*\deltadegree+90:6);
}
}
\foreach \i in {0,...,15}
\node[circle,fill=white,draw=black,thick] at (-\i*\deltadegree+90:6) {\i};
\end{tikzpicture}
The problem with this code is, TikZ only draws lines from node 6 to every other node, but i thought it iterates over all nodes, calulates the destination for each finger, and draws that line.
What am I doing wrong?