CPS 102: Discrete Mathematics Instructor: Bruce Maggs Quiz 3 Date: Wednesday November 30, 2011 NAME: Prob # Score Max Score 1 10 2 10 3 10 4 10 5 10 6 10 Total 60 1
Problem 1 [10 points] Find a minimum-cost spanning tree for the following graph. Apply Kruskal s Algorithm, The graph has edges of following weights in the increasing order 1,2,3,5,6,8,9,10,12,13,15,16,18 Include edge 1 Include edge 2 Include edge 3 Include edge 5 Include edge 6 Cant include edge 8 because it forms a cycle 2
Include edge 9 Cant include edge 10, it forms a cycle Cant include edge 12 Include edge 13 Hence the minimum spanning tree would have edge with following weights 1,2,3,5,6,9 and 13 3
Problem 2 [10 points] Recall that in an n-node tree, e = n 1, where e is the number of edges in the tree. Also, in any graph, the sum of the degrees of the nodes is 2e. Let n i denote the number of nodes in the tree with degree i, so that n = n 1 +n 2 + +n n 1. (Assume that n > 1, so that n 0 = 0.) Write a formula expressing n 1 as a function of n 2,n 3,...,n n 1. (Hint: Start by writing an equation involving the sum of the degrees of the nodes.) n 1 +2n 2 +3n 3 +...+(n 1)n n 1 = 2e = 2(n 1) = 2(n 1 +n 2 +...+n n 1 1) now subtracting the right hand side from both sides, we have n 1 +n 3 +2n 4 +3n 5 +...+(n 3)n n 1 +2 = 0 so that n 1 = n 3 +2n 4 +3n 5 +...+(n 3)n n 1 +2 4
Problem 3 [10 points] An edge coloring of an undirected graph is an assignment of colors to the edges of a graph so that no two edges incident on the same vertex have the same color. I.e., if vertex u is connected to vertices v 1 and v 2, then the edges {u,v 1 } and {u,v 2 } must have different colors. Suppose that δ is the maximum degree of any node in an undirected graph. Show that the edges can be colored using at most 2δ 1 colors. Color the edges one-by-one. When it is time to color an edge {u,v}, you will always be left with a color among 2δ 1 colors which is different from colors on other edges incident on u or v. Proof of this is below. Each node has a maximum degree of δ. Hence, the maximum number of colors used by edges incident on u excluding edge {u,v} is δ 1 Similarly, The maximum number of colors used by edges incident on v excluding edge {u,v} is δ 1 Maximum colors used by edges which are neighbors of {u,v} is δ 1 + δ 1 = 2 δ 2 Hence, there is one color left among 2 δ 1 colors which can be used to color {u,v} This property holds for every edge {u,v}, hence the graph will not require more than 2 δ 1 colors. 5
Problem 4 [10 points] Prove by strong induction that the nodes of any tree can be colored using at most two colors so that no two adjacent nodes have the same color. (Hint: given an n-node tree, start by removing a single edge to partition the tree into two smaller trees. Then apply the inductive hypothesis.) Proof By Induction: Base Case: A tree with one node can be trivially colored with one color. The Base case is valid Inductive Step: Assume that the theorem is true for all trees with less than k nodes. Consider a tree with k nodes. Divide it into a forest of two sub-trees by removing an edge. These two sub-trees have less than k nodes and hence 2-colorable by inductive assumption. Now look at the two vertices, one from each sub-tree which were incident with the edge we just removed. 1. Case 1: If they both have different colors, putting back the edge will not violate coloring and hence we get back the k node tree which is two colorable 2. Case 2: If they both have same colors, swap colors of nodes in one of the sub-trees, such that the two vertices in consideration have different colors. Now, by case 1, we again get back the original k node tree which is 2-colorable We have covered all cases and shown that a k node tree is two colorable whenever trees with less than k nodes are two colorable. Hence by induction, the theorem has been proved 6
Problem 5 [10 points] An independent set of vertices in an undirected graph is a set of vertices no two of which are adjacent. Show that every n-node tree has an independent set containing at least n/2 vertices. (Hint: every tree can be colored using only two colors, as you showed in the previous problem.) Following up from the previous problem, we know that a tree is 2-colorable. The set of all nodes which have the same color form an independent set. If they did not form an independent set, then atleast two nodes in the set have to be adjacent. This is a contradiction, because two adjacent nodes cannot have same color. Hence, the set of nodes having same color are independent. A tree of n nodes is 2-colorable. Hence it can be divided into two sets, each of which have the same color. By pigeonhole principle, one of these two sets should have atleast n/2 nodes 7
Problem 6 [10 points] Please write True or False next to each of the following statements. No explanation is necessary. 1. Suppose we define a cycle graph as a connected undirected graph in which every vertex has degree two. Then the vertices in a cycle can be colored using two colors so that no two adjacent vertices are assigned the same color. 2. Suppose every edge in an undirected graph has a unique weight. Then there must be a minimum-cost spanning tree that includes the edge with minimum weight. 3. Suppose every edge in an undirected graph has a unique weight. Then there must be a minimum-cost spanning tree that does not include the edge with maximum weight. 4. A bipartite graph is a graph in which the vertices can be partitioned into two sets V 1 and V 2 such that each edge connects a vertex in V 1 to a vertex in V 2. True or false: a tree is a bipartite graph. 5. A Hamiltonian cycle in a graph is a cycle that starts at some vertex v, visits every other vertex exactly once, and ends at v. True or false: every graph contains a Hamiltonian cycle. 1. false: a cycle of length 3 requires 3 colors 2. true: kruskal s algorithm always includes the edge of minimum weight 3. false: if the graph is a tree, then ALL edges must be included 4. true; let V 1 be nodes colored red, let V 2 be nodes colored blue 5. false; a tree is acyclic 8