We thought it would be fun to replicate the "six degrees of separation" idea using nothing but artists and collaborations. This has already been done with actors in movies (The Bacon Number), but we wanted to try and implement our own algorithm and data structures, as well as interface with the Spotify API in an efficient manner.
What it does
"Six Degress of Kanye West" allows the user to input two artists. The algorithm will search through each artists' collaborators until a link is found between the two. This link is then displayed on the website, and the user can listen to each track.
How we built it
We created our own "library" to get requests from the Spotify API. Once we were able to get an artist's collaborators, we constructed a tree of collaborators that would allow us to trace back to the head node. We implemented two trees, one for each endpoint, and compared the last layers of each with every iteration of our search. Once an intersection was found, we traced each tree back to its head and reported the results.
Challenges we ran into
The data structure we initially created was algorithmically inefficient. We used too many for loops, which slowed down the execution time by a lot. To fix this, we modified our node class to be more lightweight, and we updated our search algorithm to run recursively instead of iteratively.
Accomplishments that we're proud of
What we learned
For our next hackathon, we need to do a better job planning our ideas out. At the start we dove headfirst into the inefficient searching algorithm, and we had to change it about halfway through the event. Even though it ended up working, we could have used that time to improve the user interface or add more features.
What's next for Six Degrees of Kanye West
Even though our search algorithm is efficient, it isn't perfect. We could still make some minor modifications to improve its accuracy. Additionally, we want to utilize other aspects of the Spotify API and create a more encompassing website. We also want to add a page where you can play a game to connect one artist to another.
Log in or sign up for Devpost to join the conversation.