# Draw a tikz complete 12 nodes directed graph

I need to draw a graph based on music theory using Tikz. As said in the titled, it's a 12 node, complete, directed graph. Nodes must be labeled according to musical notes and edges must be labeled according to musical intervals. I have a hand drawing example of what I need:

On the image I've only draw some edges because it would get pretty messy drawing every single edge. But it should be complete, as said before.

I hope it's possible to label every edge like that. I also hope my question is clear enough. Thanks!

You are correct when you say that it gets quite messy. The way I've drawn it with straight lines after tritones lines start to double up so instead I suggest drawing two separate graphs for major seconds to tritones and then tritones to major sevenths.

So the first, major seconds to tritones, graph would give

Which is given by

\documentclass[tikz, border=20]{standalone}

\pgfdeclarelayer{foreground}  % nodes placed in foreground
\pgfsetlayers{main,foreground}

\pgfmathsetmacro{\R}{7}

\contourlength{1.2pt}
\begin{document}
\begin{tikzpicture}
\tikzset{note/.style={draw, circle, minimum size=1.75cm}}
\tikzset{edge/.style={->, >=latex}}

\node[note] (C) at (0:\R) {C};
\node[note] (Db) at (-30:\R) {C\#/Db};
\node[note] (D) at (-60:\R) {D};
\node[note] (Eb) at (-90:\R) {D\#/Eb};
\node[note] (E) at (-120:\R) {E};
\node[note] (F) at (-150:\R) {F};
\node[note] (Gb) at (-180:\R) {F\#/Gb};
\node[note] (G) at (-210:\R) {G};
\node[note] (Ab) at (-240:\R) {G\#/Ab};
\node[note] (A) at (-270:\R) {A};
\node[note] (Bb) at (-300:\R) {A\#/Bb};
\node[note] (B) at (-330:\R) {B};

% Minor seconds
\foreach \i/\j in {C/Db, Db/D, D/Eb, Eb/E, E/F, F/Gb, Gb/G, G/Ab, Ab/A, A/Bb, Bb/B, B/C} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{2m}};
\end{pgfonlayer}
}

% Major seconds
\foreach \i/\j in {C/D, Db/Eb, D/E, Eb/F, E/Gb, F/G, Gb/Ab, G/A, Ab/Bb, A/B, Bb/C, B/Db} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{2M}};
\end{pgfonlayer}
}

% Minor thirds
\foreach \i/\j in {C/Eb, Db/E, D/F, Eb/Gb, E/G, F/Ab, Gb/A, G/Bb, Ab/B, A/C, Bb/Db, B/D} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{3m}};
\end{pgfonlayer}
}

% Major thirds
\foreach \i/\j in {C/E, Db/F, D/Gb, Eb/G, E/Ab, F/A, Gb/Bb, G/B, Ab/C, A/Db, Bb/D, B/Eb} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{3M}};
\end{pgfonlayer}
}

% Perfect Fourths
\foreach \i/\j in {C/F, Db/Gb, D/G, Eb/Ab, E/A, F/Bb, Gb/B, G/C, Ab/Db, A/D, Bb/Eb, B/E} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{4}};
\end{pgfonlayer}
}

% Tritones
\foreach \i/\j in {C/Gb, Db/G, D/Ab, Eb/A, E/Bb, F/B, Gb/C, G/Db, Ab/D, A/Eb, Bb/E, B/Eb} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{T}};
\end{pgfonlayer}
}
\end{tikzpicture}
\end{document}


The graph for tritones to major sevenths is then which is given by the following using the same preamble

\begin{tikzpicture}
\tikzset{note/.style={draw, circle, minimum size=1.75cm}}
\tikzset{edge/.style={<-, >=latex}}

\node[note] (C) at (0:\R) {C};
\node[note] (Db) at (-30:\R) {C\#/Db};
\node[note] (D) at (-60:\R) {D};
\node[note] (Eb) at (-90:\R) {D\#/Eb};
\node[note] (E) at (-120:\R) {E};
\node[note] (F) at (-150:\R) {F};
\node[note] (Gb) at (-180:\R) {F\#/Gb};
\node[note] (G) at (-210:\R) {G};
\node[note] (Ab) at (-240:\R) {G\#/Ab};
\node[note] (A) at (-270:\R) {A};
\node[note] (Bb) at (-300:\R) {A\#/Bb};
\node[note] (B) at (-330:\R) {B};

% Major sevenths
\foreach \i/\j in {C/Db, Db/D, D/Eb, Eb/E, E/F, F/Gb, Gb/G, G/Ab, Ab/A, A/Bb, Bb/B, B/C} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{7M}};
\end{pgfonlayer}
}

% Minor sevenths
\foreach \i/\j in {C/D, Db/Eb, D/E, Eb/F, E/Gb, F/G, Gb/Ab, G/A, Ab/Bb, A/B, Bb/C, B/Db} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{7m}};
\end{pgfonlayer}
}

% Major sixths
\foreach \i/\j in {C/Eb, Db/E, D/F, Eb/Gb, E/G, F/Ab, Gb/A, G/Bb, Ab/B, A/C, Bb/Db, B/D} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{6M}};
\end{pgfonlayer}
}

% Minor Sixths
\foreach \i/\j in {C/E, Db/F, D/Gb, Eb/G, E/Ab, F/A, Gb/Bb, G/B, Ab/C, A/Db, Bb/D, B/Eb} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{6m}};
\end{pgfonlayer}
}

% Perfect Fifths
\foreach \i/\j in {C/F, Db/Gb, D/G, Eb/Ab, E/A, F/Bb, Gb/B, G/C, Ab/Db, A/D, Bb/Eb, B/E} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{5}};
\end{pgfonlayer}
}

% Tritones
\foreach \i/\j in {C/Gb, Db/G, D/Ab, Eb/A, E/Bb, F/B, Gb/C, G/Db, Ab/D, A/Eb, Bb/E, B/Eb} {
\draw[edge] (\i) -- (\j);
\begin{pgfonlayer}{foreground}
\path (\i) -- (\j) node[midway] {\contour{white}{T}};
\end{pgfonlayer}
}
\end{tikzpicture}


Personally however I think that this is still quite messy, I don't know what your using this for but personally I would go with a colour coding scheme. You could also use dashed/dotted lines etc. for black and white printing/colour blind friendly versions. The following graph gives the forward direction of the arrow and then in brackets (parentheses for you Americans) the backwards direction:

This is given by

\begin{tikzpicture}
\tikzset{note/.style={draw, circle, minimum size=1.75cm}}
\tikzset{edge/.style={->, >=latex}}

\node[note] (C) at (0:\R) {C};
\node[note] (Db) at (-30:\R) {C\#/Db};
\node[note] (D) at (-60:\R) {D};
\node[note] (Eb) at (-90:\R) {D\#/Eb};
\node[note] (E) at (-120:\R) {E};
\node[note] (F) at (-150:\R) {F};
\node[note] (Gb) at (-180:\R) {F\#/Gb};
\node[note] (G) at (-210:\R) {G};
\node[note] (Ab) at (-240:\R) {G\#/Ab};
\node[note] (A) at (-270:\R) {A};
\node[note] (Bb) at (-300:\R) {A\#/Bb};
\node[note] (B) at (-330:\R) {B};

% Minor seconds
\foreach \i/\j in {C/Db, Db/D, D/Eb, Eb/E, E/F, F/Gb, Gb/G, G/Ab, Ab/A, A/Bb, Bb/B, B/C} {
\draw[edge, red] (\i) -- (\j);
}

% Major seconds
\foreach \i/\j in {C/D, Db/Eb, D/E, Eb/F, E/Gb, F/G, Gb/Ab, G/A, Ab/Bb, A/B, Bb/C, B/Db} {
\draw[edge, orange] (\i) -- (\j);
}

% Minor thirds
\foreach \i/\j in {C/Eb, Db/E, D/F, Eb/Gb, E/G, F/Ab, Gb/A, G/Bb, Ab/B, A/C, Bb/Db, B/D} {
\draw[edge, yellow] (\i) -- (\j);
}

% Major thirds
\foreach \i/\j in {C/E, Db/F, D/Gb, Eb/G, E/Ab, F/A, Gb/Bb, G/B, Ab/C, A/Db, Bb/D, B/Eb} {
\draw[edge, green] (\i) -- (\j);
}

% Perfect Fourths
\foreach \i/\j in {C/F, Db/Gb, D/G, Eb/Ab, E/A, F/Bb, Gb/B, G/C, Ab/Db, A/D, Bb/Eb, B/E} {
\draw[edge, blue] (\i) -- (\j);
}

% Tritones
\foreach \i/\j in {C/Gb, Db/G, D/Ab, Eb/A, E/Bb, F/B, Gb/C, G/Db, Ab/D, A/Eb, Bb/E, B/Eb} {
\draw[edge, red!50!blue] (\i) -- (\j);
}
\foreach \y/\col/\lab in {1/red/Minor Second (Major Seventh), 2/orange/Major Second (Minor Seventh), 3/yellow/Minor Third (Major Sixth), 4/green/Major Third (Minor Sixth), 5/blue/Perfect Fourth (Perfect Fifth), 6/red!50!blue/Tritone} {
\draw[ultra thick, color=\col] (-3, -\R-1-\y) -- (-2, -\R-1-\y) node[right, black] {\lab};
}
\end{tikzpicture}

• Thanks Willoughby! That's exactly what I was looking for. Loved your preoccupation with color blind people! – Edu Fantini Apr 16 at 13:38