Modified internal implementation of Prim Max Spanning Tree