You would like to know "A minimum spanning tree" - it is a spanning tree such that the total edge weight between nodes is minumum.
Give an efficient algorithm.