Six Degrees of Kanye West

The theory of Six Degrees of Separation posits that everyone in the world is at most 6 degrees of separation away from everyone else. So that could be from things like friendship or family relations between people. Another way of thinking about this is that the network of everyone on Earth is a small world network where the average pair of people are connected by a small path length.

Some even suggest that due to the increase in modes of communication (telephone, internet) the average number of degrees of separation is below 5. This was explored in the context of actors and actresses with Six Degrees of Kevin Bacon. People who have been in a movie with Kevin Bacon have a Bacon number of 1 and people who have been in movies with them have a Bacon number of 2 and so on.

So what about music? A more general answer is already out there. WhoSampled have a brilliant tool to find the connections linking any two artists (link here). I thought I’d remake the Kevin Bacon version but for music and with Kanye West at the centre.

How does it work?

I use the Spotify API to get info about artists and who they have collaborated with. Starting with Kanye, a list of all of his songs is gathered and then the songs which have multiple artists on them are picked out. A database is created and each artist is stored with the song that joins them and their predecessor (Kanye West if their Kanye number is 1).

The pseudo-code is as follows:

Get artist songs
if song has more than one artist:
    add new artist to queue
    update database

This is looped continuously to build up a database of artists which can be used to lookup names.

What I used

In the past when I’ve launched a site I’ve had big problems with performance and caching. I’m using a cheap $5 droplet on DigitalOcean to host the website with nginx as the webserver acting as a reverse-proxy to Flask. It has surprisingly held up really well under the loads it has received. I also used Cloudflare for caching.

Although most days there are only about 50 hits, on the day it was shared to Reddit had about 50–100 active users for about 10 hours straight. It was running ever so slightly slower than would be ideal but it held up just fine. At the end of the trial by fire the website had accumulated over 200,000 hits and didn’t go down during any of that.

MusicKanye WestSix DegreesSeparationProjects


Software Dev. Python/JS.

Read More