MST Algorithm