Last active
August 29, 2015 14:04
-
-
Save kartikkukreja/7eed924e5fd63438a8b7 to your computer and use it in GitHub Desktop.
Kruskal's MST Algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sort edges in order of increasing cost | |
MST = {} | |
foreach edge (u, v) in order of increasing cost | |
if MST ∪ (u, v) does not create a cycle | |
add (u, v) to MST | |
return MST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment