Problem Set 2 Solutions

Similar documents
Notes for Recitation 8

CSE 331: Introduction to Algorithm Analysis and Design Graphs

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

K 4 C 5. Figure 4.5: Some well known family of graphs

Graph Definitions. In a directed graph the edges have directions (ordered pairs). A weighted graph includes a weight function.

Assignment # 4 Selected Solutions

6.854J / J Advanced Algorithms Fall 2008

Problem Set 8 Solutions

22 Elementary Graph Algorithms. There are two standard ways to represent a

Problem Set 1 Solutions

Math 15 - Spring Homework 2.6 Solutions 1. (2.6 # 20) The following graph has 45 vertices. In Sagemath, we can define it like so:

1 Variations of the Traveling Salesman Problem

Kruskal s MST Algorithm

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

Problem Set 7 Solutions

CPS 102: Discrete Mathematics. Quiz 3 Date: Wednesday November 30, Instructor: Bruce Maggs NAME: Prob # Score. Total 60

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

Definition: A graph G = (V, E) is called a tree if G is connected and acyclic. The following theorem captures many important facts about trees.

Ma/CS 6b Class 26: Art Galleries and Politicians

We ve done. Introduction to the greedy method Activity selection problem How to prove that a greedy algorithm works Fractional Knapsack Huffman coding

Solutions for the Exam 6 January 2014

22 Elementary Graph Algorithms. There are two standard ways to represent a

Number Theory and Graph Theory

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

The k-center problem Approximation Algorithms 2009 Petros Potikas

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

Professor: Padraic Bartlett. Lecture 9: Trees and Art Galleries. Week 10 UCSB 2015

Computer Science 280 Fall 2002 Homework 10 Solutions

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 8 Lecturer: David Wagner February 20, Notes 8 for CS 170

CS369G: Algorithmic Techniques for Big Data Spring

CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018

Chapter 23. Minimum Spanning Trees

8 Matroid Intersection

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 9 Notes. Class URL:

Problem Set 4 Solutions

Ma/CS 6b Class 5: Graph Connectivity

11.9 Connectivity Connected Components. mcs 2015/5/18 1:43 page 419 #427

CIS 121 Data Structures and Algorithms Minimum Spanning Trees

Solutions to In-Class Problems Week 4, Fri

Outline. Computer Science 331. Analysis of Prim's Algorithm

Section 3.1: Nonseparable Graphs Cut vertex of a connected graph G: A vertex x G such that G x is not connected. Theorem 3.1, p. 57: Every connected

Notes 4 : Approximating Maximum Parsimony

Lecture 22 Tuesday, April 10

Algorithms Activity 6: Applications of BFS

Problem Set 3 Solutions

Lecture 4: Trees and Art Galleries

Problem Set 2 Solutions

Lecture 19 Thursday, March 29. Examples of isomorphic, and non-isomorphic graphs will be given in class.

Theorem 2.9: nearest addition algorithm

2. Lecture notes on non-bipartite matching

Questions Total Points Score

Greedy Algorithms and Matroids. Andreas Klappenecker

Lecture 3: Graphs and flows

Greedy Algorithms and Matroids. Andreas Klappenecker

In this lecture, we ll look at applications of duality to three problems:

Solving problems on graph algorithms

Parallel Breadth First Search

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

CS 561, Lecture 9. Jared Saia University of New Mexico

Minimum spanning trees

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Finding Strongly Connected Components

Distributed Algorithms 6.046J, Spring, Nancy Lynch

All-to-All Communication

Advanced algorithms. topological ordering, minimum spanning tree, Union-Find problem. Jiří Vyskočil, Radek Mařík 2012

Basic Graph Theory with Applications to Economics

Dist(Vertex u, Vertex v, Graph preprocessed) return u.dist v.dist

2. CONNECTIVITY Connectivity

Lecture 10: Strongly Connected Components, Biconnected Graphs

Steiner Trees and Forests

Greedy algorithms is another useful way for solving optimization problems.

Network flows and Menger s theorem

Solutions to relevant spring 2000 exam problems

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li

Problem set 2. Problem 1. Problem 2. Problem 3. CS261, Winter Instructor: Ashish Goel.

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.

MAT 145: PROBLEM SET 6

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

These are not polished as solutions, but ought to give a correct idea of solutions that work. Note that most problems have multiple good solutions.

6. Lecture notes on matroid intersection

COMP260 Spring 2014 Notes: February 4th

Exam 3 Practice Problems

CSE202 Greedy algorithms. Fan Chung Graham

CS261: Problem Set #2

Notes for Recitation 9

Trees. Arash Rafiey. 20 October, 2015

Inf 2B: Graphs II - Applications of DFS

Induction Review. Graphs. EECS 310: Discrete Math Lecture 5 Graph Theory, Matching. Common Graphs. a set of edges or collection of two-elt subsets

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree

Problem Set 6 Solutions

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree

Matching Theory. Figure 1: Is this graph bipartite?

Algorithms and Data Structures: Minimum Spanning Trees (Kruskal) ADS: lecture 16 slide 1

Graph Algorithms Using Depth First Search

2 A Template for Minimum Spanning Tree Algorithms

val(y, I) α (9.0.2) α (9.0.3)

Graph theory - solutions to problem set 1

We have already seen the transportation problem and the assignment problem. Let us take the transportation problem, first.

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

Transcription:

Design and Analysis of Algorithms February, 01 Massachusetts Institute of Technology 6.046J/18.410J Profs. Dana Moshkovitz and Bruce Tidor Handout 8 Problem Set Solutions This problem set is due at 9:00pm on Wednesday, February, 01. Problem -1. Unique Minimum Spanning Trees In Lecture, we saw the claim that any weighted undirected graph with distinct edge weights has exactly one minimum spanning tree. In this problem, your goal will be to show that this claim is true by proving a more general theorem. Let G = (V, E) be a connected, weighted undirected graph whose edges weight may or may not be distinct. Given a cut (S, V S) of S, recall that an edge (u, v) E is said to cross the cut if exactly one of u and v is in S. An edge (u, v) is a light edge crossing the cut (S, V S) if its weight is the smallest of any edge crossing (S, V S). There can be more than one light edge crossing a single cut in the case of ties. An edge (u, v) is a unique light edge if there are no ties. (a) Show that if an edge (u, v) is the unique light edge crossing some cut of the connected, weighted undirected graph G, then (u, v) must be included in all minimum spanning trees of G. Solution: Suppose for contradiction that there is some MST T that does not contain the light edge (u, v) crossing a cut C. Because T is a connected tree, there is some path in T connecting the vertices u and v, and therefore adding the edge (u, v) to T forms a cycle. Following this cycle, there must be at least one other edge in the cycle crossing the cut C. Removing this edge, and leaving (u, v), we now have a tree with a lower total weight than the original T. Because T was assumed to be an MST, this is a contradiction. Therefore, any unique light edge of a cut must be part of every MST. (b) Suppose that we have a connected, weighted undirected graph G = (V, E) such that every cut of G has a unique light edge crossing the cut. Show that G has exactly one minimum spanning tree. Solution: From problem -1(a), we know that for every cut of G, the unique light edge crossing the cut must be part of every MST of G. Consider the set T of edges, containing the unique light edge crossing each cut C of G. By the previous part, we know that T is a subset of every MST. Now we can show that T must be equal to every MST. Because there is exactly one edge of T crossing every cut of G, the graph (V, T ) must have exactly one connected component: if there were two unconnected components V 1 and V V 1, then the cut

Handout 8: Problem Set Solutions (V 1,V V 1 ) would not be crossed by any edge of T, which contradicts the definition of T. In addition, T cannot contain any cycles: the heaviest edge on a cycle in T cannot be the unique lightest edge in any cut. Then T itself must be a spanning tree of G. Because T is a subset of all minimum spanning trees of G, it must be the unique MST of G, as any additional edge added to T would form a cycle, making it no longer be a tree. In a graph with no duplicate edge weights, there cannot be any ties for the light edge crossing a cut. As a result, any graph with distinct edge weights will satisfy the requirements for the theorem in part (b), and will therefore have exactly one minimum spanning tree. Problem -. Shortest Paths and Minimum Spanning Trees In this problem, you will examine the relationship between minimum spanning trees and shortest path trees. As a reminder, given a weighted undirected graph G = (V, E) with edge weights w, the shortest path tree rooted at s V is a subgraph G = (V,E ) of G such that: 1. The vertex set V V is the set of nodes in G reachable from s.. The graph G is a tree, with E = V 1.. For any u V, the distance from s to u in G is the same as the distance from s to u in G. Note that as with minimum spanning trees, there is more than one shortest path tree per graph. In addition to the variation introduced by the choice of root, it s possible to get different shortest path trees even for the same root vertex. (a) Given any connected undirected graph G with positive edge weights w, does there always exist a shortest path tree S such that S is a minimum spanning tree of G? Prove your answer. Solution: Here is a counterexample: In the above graph, the outside edges each have a weight of, and the diagonal inner edges each have a weight of. The minimum spanning trees of this element are any three of the weight- edges, as highlighted in red below:

Handout 8: Problem Set Solutions The shortest path tree from each node contains just the edges containing that node, as shown below for the node highlighted in red: (b) Does there exist some connected undirected graph G with positive edge weights w such that G has a shortest path tree S and a minimum spanning tree T that do not share any edges? Prove your answer. Solution: Assuming that G has more than one vertex, there is no such graph. Given any source vertex s, consider the light edges leaving s, defined as the edges (s, v) of minimum weight (where v is some neighbor of s). Lemma 1 Every MST of G must contain at least one of these light edges. PROOF. Suppose there is some MST T containing none of the light edges leaving s. Consider any light edge (s, u). There is some path from s to u in T, and therefore adding (s, u) to T forms a cycle. There must be some other edge (s, v) in the cycle such that w(s, u) < w(s, v), as we have assumed that there are no light edges leaving s contained in T. Removing (s, v) from T and replacing it with (s, u) forms a spanning tree of smaller total weight than T, contradicting our assumption that T is an MST. Lemma All of the light edges leaving s must be contained in all shortest path trees rooted at s. PROOF. If (s, u) is a light edge leaving s, then because G has positive edge weights, the single edge(s, u) must be the unique shortest path from s tou. Any other path from s to u must go through some edge (s, v), and by definition we know that w(s, v) w(s, u); therefore, all other paths from s to u must have strictly greater weight than the single edge (s, u).

4 Handout 8: Problem Set Solutions These two lemmas together show that, for any source node s, all shortest path trees from s must share some edge with all MSTs of G, so there is no shortest path tree S and MST T that share no edges.

MIT OpenCourseWare http://ocw.mit.edu 6.046J / 18.410J Design and Analysis of Algorithms Spring 01 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.