Prims Algorithm and Kruskal Algorithm

816 Views Asked by At
  • Can the Prims and Kruskal algorithms yield the same value?
  • Can every graph can use Prims and Kruskal algorithms?
1

There are 1 best solutions below

2
On

Yes, Prims and Kruskal algorithms will both yield the same minimum total weight of the minimum spanning tree (MST), but may provide different, optimal MST's.

Every undirected graph can use Prims and Kruskal, but there are slight differences in the algorithms that sometimes make Prims (dense graphs) or Kruskal (sparse graph) the better choice.

See this other post for more details of the differences.