Minimum Spanning Tree using Prim's algorithm