I was given coordinates x and y and from them I put together the Minimum Spanning Tree, using Kruskal's. Now I need to somehow traverse over them all starting from the lowest index, which in this case would be 0.
I am trying to solve the TSP and the index1/2 are just the numbers of a town and the weight is the distance between them. MST is just an object.
MST{index1=0, index2=2, weight=10}
MST{index1=3, index2=4, weight=17}
MST{index1=1, index2=4, weight=23}
MST{index1=0, index2=1, weight=59}
I am guessing that I should make a binary tree with the root of 0, but I have no idea how to make a tree from these values.
Comments
Post a Comment