Notes for Recitation 8

Similar documents
Notes for Recitation 9

Problem Set 2 Solutions

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

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

Solutions to In Class Problems Week 5, Wed.

Lecture 20 : Trees DRAFT

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

Kruskal s MST Algorithm

Lecture 1. 1 Notation

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.

1 Matchings in Graphs

Greedy algorithms is another useful way for solving optimization problems.

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.

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

Solutions to In-Class Problems Week 4, Fri

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

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

Assignment # 4 Selected Solutions

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

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

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

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

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

Logic and Computation Lecture 20 CSU 290 Spring 2009 (Pucella) Thursday, Mar 12, 2009

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.

1 Variations of the Traveling Salesman Problem

CSE 331: Introduction to Algorithm Analysis and Design Graphs

Week 11: Minimum Spanning trees

Theorem 2.9: nearest addition algorithm

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

Problem Set 2 Solutions

Computer Science 280 Fall 2002 Homework 10 Solutions

CIS 121 Data Structures and Algorithms Minimum Spanning Trees

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

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

MAT 145: PROBLEM SET 6

Greedy Algorithms 1. For large values of d, brute force search is not feasible because there are 2 d

2. Lecture notes on non-bipartite matching

1 Matching in Non-Bipartite Graphs

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

CS103 Spring 2018 Mathematical Vocabulary

CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Dan Grossman Fall 2013

These notes present some properties of chordal graphs, a set of undirected graphs that are important for undirected graphical models.

Computer Science 236 Fall Nov. 11, 2010

Math 454 Final Exam, Fall 2005

6.854J / J Advanced Algorithms Fall 2008

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Propositional Logic Formal Syntax and Semantics. Computability and Logic

Lecture 8: The Traveling Salesman Problem

HW Graph Theory SOLUTIONS (hbovik) - Q

Lecture 22 Tuesday, April 10

Warmup Problem. Describe how structural induction differs from our MATH 135 notion of induction. 1/25

HW Graph Theory SOLUTIONS (hbovik)

Basic Graph Theory with Applications to Economics

1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:

2. CONNECTIVITY Connectivity

COL351: Analysis and Design of Algorithms (CSE, IITD, Semester-I ) Name: Entry number:

Discrete Mathematics Lecture 4. Harper Langston New York University

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

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

MATH 409 LECTURE 10 DIJKSTRA S ALGORITHM FOR SHORTEST PATHS

Lecture 4: 3SAT and Latin Squares. 1 Partial Latin Squares Completable in Polynomial Time

Ma/CS 6b Class 5: Graph Connectivity

Lecture 15. Error-free variable length schemes: Shannon-Fano code

Treewidth and graph minors

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

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

Programming Languages Fall 2014

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

Problem Set 4 Solutions

Discrete mathematics

Discrete mathematics , Fall Instructor: prof. János Pach

Discharging and reducible configurations

Lecture 4: September 11, 2003

Chapter 3. Set Theory. 3.1 What is a Set?

Graph Theory Questions from Past Papers

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

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

Math 776 Graph Theory Lecture Note 1 Basic concepts

Finding Strongly Connected Components

Steiner Trees and Forests

Module 7. Independent sets, coverings. and matchings. Contents

6c Lecture 3 & 4: April 8 & 10, 2014

Matching Theory. Figure 1: Is this graph bipartite?

Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, )

Module 11. Directed Graphs. Contents

CSE 215: Foundations of Computer Science Recitation Exercises Set #9 Stony Brook University. Name: ID#: Section #: Score: / 4

1 Undirected Vertex Geography UVG

4 Basics of Trees. Petr Hliněný, FI MU Brno 1 FI: MA010: Trees and Forests

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

Bipartite Roots of Graphs

The Resolution Algorithm

AXIOMS FOR THE INTEGERS

Algorithms for Minimum Spanning Trees

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.

COMP 182: Algorithmic Thinking Prim and Dijkstra: Efficiency and Correctness

Greedy Algorithms. Previous Examples: Huffman coding, Minimum Spanning Tree Algorithms

A Reduction of Conway s Thrackle Conjecture

15 212: Principles of Programming. Some Notes on Induction

Transcription:

6.04/8.06J Mathematics for Computer Science October 5, 00 Tom Leighton and Marten van Dijk Notes for Recitation 8 Build-up error Recall a graph is connected iff there is a path between every pair of its vertices. False Claim. If every vertex in a graph has positive degree, then the graph is connected.. Prove that this Claim is indeed false by providing a counterexample. Solution. There are many counterexamples; here is one:. Since the Claim is false, there must be a logical mistake in the following bogus proof. Pinpoint the first logical mistake (unjustified step) in the proof. Proof. We prove the Claim above by induction. Let P (n) be the proposition that if every vertex in an n-vertex graph has positive degree, then the graph is connected. Base cases: (n ). In a graph with vertex, that vertex cannot have positive degree, so P () holds vacuously. P () holds because there is only one graph with two vertices of positive degree, namely, the graph with an edge between the vertices, and this graph is connected. Inductive step: We must show that P (n) implies P (n + ) for all n. Consider an n-vertex graph in which every vertex has positive degree. By the assumption P (n), this graph is connected; that is, there is a path between every pair of vertices. Now we add one more vertex x to obtain an (n + )-vertex graph:

Recitation 8 n vertex graph z X y All that remains is to check that there is a path from x to every other vertex z. Since x has positive degree, there is an edge from x to some other vertex, y. Thus, we can obtain a path from x to z by going from x to y and then following the path from y to z. This proves P (n + ). By the principle of induction, P (n) is true for all n 0, which proves the Claim. Solution. This one is tricky: the proof is actually a good proof of something else. The first error in the proof is only in the final statement of the inductive step: This proves P (n + ). The issue is that to prove P (n + ), every (n + )-vertex positive-degree graph must be shown to be connected. But the proof doesn t show this. Instead, it shows that every (n + )-vertex positive-degree graph that can be built up by adding a vertex of positive degree to an n-vertex connected graph, is connected. The problem is that not every (n + )-vertex positive-degree graph can be built up in this way. The counterexample above illustrates this: there is no way to build that 4-vertex positive-degree graph from a 3-vertex positive-degree graph. More generally, this is an example of buildup error. This error arises from a faulty assumption that every size n + graph with some property can be built up in some particular way from a size n graph with the same property. (This assumption is correct for some properties, but incorrect for others such as the one in the argument above.) One way to avoid an accidental build-up error is to use a shrink down, grow back process in the inductive step: start with a size n+ graph, remove a vertex (or edge), apply the inductive hypothesis P (n) to the smaller graph, and then add back the vertex (or edge) and argue that P (n + ) holds. Let s see what would have happened if we d tried to prove the claim above by this method: Inductive step: We must show that P (n) implies P (n + ) for all n. Consider an (n + )-vertex graph G in which every vertex has degree at least. Remove an arbitrary vertex v, leaving an n-vertex graph G in which every vertex has degree... uh-oh!

Recitation 8 3 The reduced graph G might contain a vertex of degree 0, making the inductive hypothesis P (n) inapplicable! We are stuck and properly so, since the claim is false! The Grow Algorithm Yesterday in lecture, we saw the following algorithm for constructing a minimum-weight spanning tree (MST) from an edge-weighted N-vertex graph G. ALG-GROW:. Label the edges of the graph e, e,..., e t so that wt(e ) wt(e )... wt(e t ).. Let S be the empty set. 3. For i =... t, if S {e i } does not contain a cycle, then extend S with the edge e i. 4. Output S. In summary, ALG-GROW selects edges one at a time, always choosing the minimum weight edge that does not create a cycle with previously selected edges. Notice that as edges are added S may not be connected. When the algorithm terminates, S contains N edges. If it is connected, then it is a spanning tree. Consider, for example, the following edge-weighted graph. 3 3 4 3 7 Now suppose we run ALG-GROW on our graph. We may choose the weight edge on the bottom of the triangle of weight edges in our graph. In the next step, we may choose the weight edge on the top of the graph. Note that this edge still has minimum weight, and does not cause us to form a cycle, so ALG-GROW can choose it. We will then choose one of the remaining weight edges. Note that neither causes us to form a cycle. Continuing the algorithm, we may end up with the same spanning tree shown below.

Recitation 8 3 4 7 In this recitation, we will analyze ALG-GROW. 3 Analysis of ALG-GROW In this problem you may assume the following lemma from the problem set: Lemma. Suppose that T = (V, E) is a simple, connected graph. Then T is a tree iff E = V. In this exercise you will prove the following theorem. Theorem. For any connected, weighted graph G, ALG-GROW produces an MST of G. (a) Prove the following lemma. Lemma. Let T = (V, E) be a tree and let e be an edge not in E. Then, G = (V, E {e}) contains a cycle. (Hint: Suppose G does not contain a cycle. Is G a tree?) Solution. Proof. (by contradiction) Suppose G does not contain a cycle. By the definition of a tree, T is connected. Notice that T is a subgraph of G. Because any two nodes in G are connected by a path in T, G is a connected graph. So G is connected and acyclic and therefore a tree by definition. Both G and T are trees and have the same number of nodes. Therefore, they have the same number of edges (by Lemma ). This is a contradiction because G has one more edge than T. (b) Prove the following lemma. Lemma 3. Let T = (V, E) be a spanning tree of G and let e be an edge not in E. Then there exists an edge e = e in E such that T = (V, E {e } {e}) is a spanning tree of G.

Recitation 8 5 (Hint: Adding e to E introduces a cycle in (V, E {e}).) Solution. Proof. By Lemma, we know that the set of edges E {e} contains a cycle. If this cycle does not contain the edge e, then this cycle is a subset of E. Since E is the set of edges of a tree, this cannot occur. So, this cycle contains e. If e is another edge distinct from e in this cycle, then the graph T that results after removing e from E {e} is still connected. The number of edges in T is equal to the number of edges in T, which is equal to V by Lemma. Since T is connected, T is a tree by Lemma. Since T is a subgraph of G with vertices V, it spans G. (c) Prove the following lemma. Lemma 4. Let T = (V, E) be a spanning tree of G, let e be an edge not in E and let S E such that S {e} does not contain a cycle. Then there exists an edge e = e in E S such that T = (V, E {e } {e}) is a spanning tree of G. (Hint: Modify your proof to part (b). Of all possible edges e = e that can be removed to construct T, at least one is not in S.) Solution. Proof. We need to change the proof in part (b) slightly. The proof of part (b) holds for any edge e = e in the cycle. We need to show that we can select an edge e = e that is in the cycle but not in S. We will prove this by contradiction. Suppose that all the edges not equal to e that are in the cycle are in S. Then, S e is a cycle. This contradicts the assumption of the lemma. (d) Prove the following lemma. Lemma 5. Define S m to be the set consisting of the first m edges selected by ALG GROW from a connected graph G. Let P (m) be the predicate that if m V then S m E for some MST T = (V, E) of G. Then m. P (m). (Hint: Use induction. There are two cases: m + > V and m + V. In the second case, there are two subcases.) Solution. Proof. (By induction.) Let P (m) be the predicate as defined above. Base Case: S 0 contains 0 edges and is equal to the empty set, which is a subset of any set of edges E. Inductive Step: Assume P (m) in order to prove P (m + ). If m V then m+ > V and P (m+) holds vacuously. Otherwise, if m < V then let e denote the (m + )th edge selected by ALG-GROW. By the inductive hypothesis, there exists an MST T = (V, E) such that S m E. There are now two cases. In the first case, e E which case S m {e} E, and thus P (m + ) holds.

Recitation 8 6 In the second case, e / E, as illustrated by the following diagram. Now we need to find a different MST that contains S m {e}. e S = e E* = S U { } e = (m+)st edge What happens when we add e to T? By the description of ALG-GROW, S m {e} does not contain a cycle. Therefore, by Lemma 4, there exists an edge e = e in E S m such that T = (V, E {e } {e}) is a spanning tree for G. In order to prove that T is a MST, we need to show that wt(e) wt(e ). We will prove this by contradiction. Suppose that wt(e ) < wt(e). Since e E, which is the set of edges of the MST T, and S m E, the set of edges S m {e }, does not contain a cycle. Therefore e would have already been added to S m in a previous iteration of ALG-GROW as one of the first m edges. However, e is in E S m. This is a contradiction. (e) Prove the theorem. (Hint: Lemma 5 says there exists an MST T = (V, E) for G such that S E. Use contradiction to rule out the case in which S is a proper subset of E.) Solution. Proof. (by contradiction) Let S be the set of edges produced by ALG GROW. By Lemma 5, there exists an MST T = (V, E) for G such that S E. If S = E, then ALG-GROW outputs the edges of the MST T. We will show that the other case, S = E, leads to a contradiction. Suppose S = E. Then there exists an edge e E S. This implies that S {e} E. Since E is the set of edges of a tree, S {e} does not contain a cycle. Therefore, e would be added to S by ALG-GROW. So e S, and this contradicts e E S.

MIT OpenCourseWare http://ocw.mit.edu 6.04J / 8.06J Mathematics for Computer Science Fall 00 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.