Source: https://ece.uwaterloo.ca/~cmoreno/ece250/2012-03-21--minimum-spanning-trees.pdf