Docsity

Algorithm Design and Analysis: Minimum Spanning Trees - Prof. Zhaojun Bai, Assignments of Computer Science

Toggle sidebar
bg1
ECS122A: Algorithm Design and Analysis Due: 4:00pm, June 2, 2009
Homework Assignment #6
1. Let G= (V, E ) be a connected, undirected graph with distinct edge weights. Show that Ghas a
unique minimum spanning tree.
2. Show the result of running Kruskal’s algorithm for finding the minimum spanning tree on the
following graph.
b
h
c d
f
e
a
g
i
4
8 7
9
11
87
2
1
64
2
14
10
3. Show the result of running Prim’s algorithm for finding the minimum spanning tree on the graph
shown in Problem 2, using eas the root.
4. Prove or disprove: Prim’s MST algorithm will work correctly even if weights may be negative.
5. (a) Run the Bellman-Ford algorithm on the following directed graph, using vertex yas the source.
Relax edges in lexicographic order in each pass, and show the dand πvalues after each pass.
(b) Change the weight of edge (y, v) to 4 and run the algorithm again, using zas the source.
u v
xy
z
6
8
72
9
-4
-3
5
-2
7
1
pf2

Partial preview of the text

Download Algorithm Design and Analysis: Minimum Spanning Trees - Prof. Zhaojun Bai and more Assignments Computer Science in PDF only on Docsity!

ECS122A: Algorithm Design and Analysis Due: 4:00pm, June 2, 2009 Homework Assignment #

  1. Let G = (V, E) be a connected, undirected graph with distinct edge weights. Show that G has a unique minimum spanning tree.
  2. Show the result of running Kruskal’s algorithm for finding the minimum spanning tree on the following graph.

b

h

c d

f

a e

g

i

  1. Show the result of running Prim’s algorithm for finding the minimum spanning tree on the graph shown in Problem 2, using e as the root.
  2. Prove or disprove: Prim’s MST algorithm will work correctly even if weights may be negative.
  3. (a) Run the Bellman-Ford algorithm on the following directed graph, using vertex y as the source. Relax edges in lexicographic order in each pass, and show the d and π values after each pass. (b) Change the weight of edge (y, v) to 4 and run the algorithm again, using z as the source.

u v

x (^) y

z

  1. Run Dijkstra’s algorithm on the following directed graph, (a) first using vertex s as the source, and (b) then using vertex y as the source.

u v

x (^) y

3

6

2 1

5

3

4 2 7

6

s

  1. Give a simple example of a directed graph with negative-weight edges for which Dijkstra’s algo- rithm produces incorrect answers.
  2. We are given a directed graph G = (V, E) on which each edge (u, v) ∈ E has an associated value r(u, v), which is a real number in the range 0 ≤ r(u, v) ≤ 1 that represents the reliability of a communication channel from vertex u to vertex v. We interpret r(u, v) as the probability that the channel from u to v will not fail, and we assume that these probabilities are independent. Given an efficient algorithm to find the most reliable path between two given vertices.