0
所以我得到這個僞代碼爲Prims算法,普里姆算法節點優先級
INPUT: GRAPH G = (V,E)
OUTPUT: Minimum spanning tree of G
Select arbitrary vertex s that exists within V
Construct an empty tree mst
Construct an empty priority queue Q that contain nodes ordered by their 「distance」 from mst
Insert s into Q with priority 0
while there exists a vertex v such that v exists in V and v does not exist in mst do
let v = Q.findMin()
Q.removeMin()
for vertex u that exists in neighbors(v) do
if v does not exist in mst then
if weight(u, v) < Q.getPriority(u) then
//TODO: What goes here?
end if
end if
end for
end while
return mst
什麼的// TODO去