Minimal spanning tree (adjacency matrix) in java

710 Views Asked by At

I have a problem that I am really struggling with. I have a set villages with weighed edges and I need to create a minimum spanning tree to find the shortest way.I have found the shortest path for the villages according to the weight,I really have no idea what to do How can i implement this with adjacency matrix ? i will appreciate any help :)
-10 villages(Nodes)

1

There are 1 best solutions below

2
On

Checkout dijkstra or A+ algorithm to find shortest path with weighted edges. A* additionally uses a metric (heuristice) function which it makes faster to Dijkstra.