The following is the diagram for Prim's algorithm after the second iteration (i.e, node B has been removed from the priority queue and added to the MST).

The d values inside the nodes in the above diagram seem to come from adding the d value of node B to the corresponding edge weights (like in Dijkstra's algorithm)
d[D] = d[B] + 1 = 2 + 1 = 3
d[E] = d[B] + 4 = 2 + 4 = 6
which is wrong. Instead, the d values of nodes C, D and E should be just the edge weights from B.
d[C] = weight(B, E) = 1 // Was earlier 3
d[D] = weight(B, D) = 1 // Was earlier ∞
d[E] = weight(B, E) = 4 // Was earlier ∞
@bnmnetp
The following is the diagram for Prim's algorithm after the second iteration (i.e, node
Bhas been removed from the priority queue and added to the MST).The
dvalues inside the nodes in the above diagram seem to come from adding thedvalue of nodeBto the corresponding edge weights (like in Dijkstra's algorithm)which is wrong. Instead, the
dvalues of nodesC,DandEshould be just the edge weights fromB.@bnmnetp