Organized code of heap-based Prim's MST alg