CSE 431/531 Homework 5 Due date: Apr 22, 2016 Lecturer: Shi Li

advertisement
CSE 431/531 Homework 5
Due date: Apr 22, 2016
Lecturer: Shi Li
Your Name:
Your University ID:
Problems
Max. Score
Your Score
1
16
2
12
3
12
Total Score
40
Problem 1 (16 points). Use Kruskal’s algorithm and Prim’s algorithm respectively to solve the
following minimum spanning tree instance.
a
40
8
b
f
13
25
g
29
17
45
c
5
e
20
12
35
d
31
For Kruskal’s algorithm, you need to show how the partition of V changes during the execution
of the algorithm. For Prim’s algorithm, you need to use a as the root vertex (i.e, the first vertex
added to S). You can use the following table to describe the execution of the algorithm. For
vertices in v ∈ S, d(v) and π(v) are irrelevant and thus you can let them be “/”. For a vertex v ∈
/S
with d(v) = ∞, π(v) is also ”/”. The second column indicates the edge included in the minimum
spanning tree; the third column indicates the vertex added to S.
Iteration
edges
vertices
1
2
3
4
5
6
7
/
(a, b)
a
b
a
d
/
/
b
π
/
/
d
8
/
c
π
a
/
d
∞
1
d
π
/
d
∞
e
π
/
d
∞
f
π
/
d
13
g
π
a
d
40
π
a
Problem 2 (12 points). Assume all edges of an undirected graph G = (V, E) have different
weights w. Prove that an edge e ∈ E is in the minimum spanning tree of G if and only if there
0
exists a cut (A ⊆ V, V \ A), such that e = arg mine0 =(u,v)∈E:u∈A,v∈A
/ w(e ).
Problem 3 (12 points). Problem 2 implies that if all edges in G = (V, E) have different weights,
then G has a unique minimum spanning tree. However, the inverse statement is not true: it is
possible that some edges in G have the same weight, but G has a unique minimum spanning tree.
Give a polynomial-time algorithm that decides if a given graph G = (V, E) with weight function
w : E → R has a unique minimum spanning tree or not. You need to explain why your algorithm
is correct.
2
Download