clashmeifyoucan
Joined 7 years ago
Karma
530
Submissions
143
Member since
Jun 24
aadibajpai dot com
View on Hacker NewsJoined 7 years ago
This happens because kruskal's algorithm essentially selects the cheapest edge not already included in our spanning tree that won't cause a cycle. So union-find is able to speed up this potential cycle check which would otherwise be naively quadratic.
I ended up writing a small library that does that locally cross-platform by using the metadata from the app.[3] The approach is probably not as robust as the API, but much faster and works well.
[1] https://github.com/SwagLyrics/SwagLyrics-For-Spotify