Δομές ΔεδομένωνΤμήμα Πληροφορικής ΑΠΘ43 Prim's Algorithm MST-Prim(G, w, r) Q = V[G]; for each u  Q key[u] =  ; key[r] = 0; p[r] = NULL; while (Q not empty) u = ExtractMin(Q); for each v  Adj[u] if (v  Q and w(u,v) < key[v]) p[v] = u; key[v] = w(u,v); 102  0815 3  14 10 3 64 5 2 9 15 8 u
{}