Prim(G, s)
begin
MST ← {s}; Q ← edges(s)
while |MST| < |V| do
(u,v) ← extractMin(Q)
if v ∉ MST then
MST ← MST ∪ {v, (u,v)}
Q ← Q ∪ edges(v)
end