Algorithms_Part9

# Algorithms_Part9 - S. Dasgupta, C.H. Papadimitriou, and...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani 161 Exercises 5.1. Consider the following graph. A B C D E F G H 1 2 2 1 6 5 6 3 3 5 4 5 7 (a) What is the cost of its minimum spanning tree? (b) How many minimum spanning trees does it have? (c) Suppose Kruskal’s algorithm is run on this graph. In what order are the edges added to the MST? For each edge in this sequence, give a cut that justifies its addition. 5.2. Suppose we want to find the minimum spanning tree of the following graph. A B C D E F G H 1 2 4 1 2 6 8 5 6 4 1 1 3 (a) Run Prim’s algorithm; whenever there is a choice of nodes, always use alphabetic ordering (e.g., start from node A ). Draw a table showing the intermediate values of the cost array. (b) Run Kruskal’s algorithm on the same graph. Show how the disjoint-sets data structure looks at every intermediate stage (including the structure of the directed trees), assuming path compression is used. 5.3. Design a linear-time algorithm for the following task. Input: A connected, undirected graph G . Question: Is there an edge you can remove from G while still leaving G connected? Can you reduce the running time of your algorithm to O ( | V | ) ? 5.4. Show that if an undirected graph with n vertices has k connected components, then it has at least n- k edges. 5.5. Consider an undirected graph G = ( V, E ) with nonnegative edge weights w e ≥ . Suppose that you have computed a minimum spanning tree of G , and that you have also computed shortest paths to all nodes from a particular node s ∈ V . Now suppose each edge weight is increased by 1 : the new weights are w e = w e + 1 . (a) Does the minimum spanning tree change? Give an example where it changes or prove it cannot change. (b) Do the shortest paths change? Give an example where they change or prove they cannot change. 162 Algorithms 5.6. Let G = ( V, E ) be an undirected graph. Prove that if all its edge weights are distinct, then it has a unique minimum spanning tree. 5.7. Show how to find the maximum spanning tree of a graph, that is, the spanning tree of largest total weight. 5.8. Suppose you are given a weighted graph G = ( V, E ) with a distinguished vertex s and where all edge weights are positive and distinct. Is it possible for a tree of shortest paths from s and a minimum spanning tree in G to not share any edges? If so, give an example. If not, give a reason. 5.9. The following statements may or may not be correct. In each case, either prove it (if it is cor- rect) or give a counterexample (if it isn’t correct). Always assume that the graph G = ( V, E ) is undirected. Do not assume that edge weights are distinct unless this is specifically stated. (a) If graph G has more than | V | - 1 edges, and there is a unique heaviest edge, then this edge cannot be part of a minimum spanning tree....
View Full Document

## This document was uploaded on 08/10/2011.

### Page1 / 20

Algorithms_Part9 - S. Dasgupta, C.H. Papadimitriou, and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online