I am trying to implement Prim's algorithm using min-heap. I do not want to randomly choose the source/starting node, but want to sort the edges in non-decreasing order of weight to find the root node. I would like to have guidance as to how to go about it.
Asked
Active
Viewed 298 times
0
-
"I do not want to randomly choose the source/starting node". Why? It does not matter what vertex would be first. – DAle Oct 25 '17 at 14:37
-
And the sorting edges is the most time-consuming operation in Kruskal algorithm. You don't need Prim's algorithm in this case (also there is no need to sort edges to find edge with minimal weight) – DAle Oct 25 '17 at 14:39