Source: https://courses.engr.illinois.edu/cs498374/fa2014/notes/25-mst.pdf