Building MST algorithms