演算法›Ch4 圖論演算法
第 8 題/共 111 題
◀ AL 8/111
8. Dijkstra、MST、廣義最短路徑演算法框架
#AL-04-008難DijkstraMST廣義最短路徑演算法框架

Consider the (incomplete) pseudocode snippet SOLVE().

function SOLVE(G=(V,E,w)G=(V,E,w), ss, tt) 1 P=VP = V // Initializes a set with all vertices. 2 Set A[s]=0A[s]=0 and A[x]=∞A[x]=\infty for all x≠sx \ne s. // Initializes an array AA. 3 while P≠∅P \ne \emptyset do 4 x=arg⁡min⁡x∈P{A[x]}x = \arg\min_{x \in P}\{A[x]\} // Chooses a vertex. 5 P=P−{x}P = P - \{x\} // Removes the vertex. 6 for each y∈Py \in P such that (x,y)∈E(x,y) \in E, do 7 (⋆\star) 8 return (⋆⋆\star\star)

You have realized that this code snippet can be used to solve different problems by filling the blanks in different ways. Here are three problems we consider:

  • In the ST-DISTANCE problem, you are given a graph GG with non-negative weights, and two vertices s,t∈Vs,t \in V. The goal is to compute the shortest distance between ss and tt.
  • In the ST-BOTTLENECK problem, you are given a graph GG with non-negative weights, and two vertices s,t∈Vs,t \in V. The goal is to compute the smallest possible weight wgtwgt such that there exists at least one path from ss to tt using only edges whose weights are less than or equal to wgtwgt.
  • In the MST problem, you are given an undirected, weighted, and connected graph GG. The goal is to compute the total weight of a minimum spanning tree.

Select all correct statement(s) below.

📄 台大114
跳轉到第題
▤完整推導請見《WH 資工筆記 · 演算法》Ch4 圖論演算法
本章題號 · 1–20 / 111