Computer Science 280 Fall 2002 Homework 10 Solutions Part A 1. How many nonisomorphic subgraphs does W 4 have? W 4 is the wheel graph obtained by adding a central vertex and 4 additional "spoke" edges to the cycle graph C 4. We didn't talk about wheel graphs in class, but they are defined on page 448 of the text. When counting subgraphs, keep in mind that a graph is a subgraph of itself and that, by definition, a graph must have at least one vertex. There are a total of 45 subgraphs. A breakdown of the number by the number of vertices is as follows: No of vertices No of edges No of nonisomorphic subgraphs 1 0 1 2 0 1 2 1 1 3 0 1 3 1 1 3 2 1 3 3 1 4 0 1 4 1 1 4 2 2 4 3 3 (triangle, U, Y) 4 4 2 (square, triangle with arm) 4 5 1 (square with diagonal) 5 0 1 5 1 1 5 2 2 5 3 4 (triangle, U, Y, VI) 5 4 6 (triangle with arm, snake, long Y, square, triangle with segment, X) 5 5 6 (triangle with elbow-arm, triangle with 2 arms on one vertex, triangle with arms on separate vertices, square with arm, square with diagonal, pentagon) 5 6 5 (bow-tie, square with diagonal and arm, square with diagonal and center point, square with triangle, square with diagonal and arm-not-touching diagonal) 5 7 2 (2 ways to remove one edge) 5 8 1
2 The distance between two vertices in a graph is the length of the shortest path between them. The radius at v for a graph is the maximum over all distances between v and some other vertex of the graph. The radius of a graph is the minimum over all vertices v of the radius at v. The diameter of a graph is the maximum over all distances between two distinct vertices. Denote radius and diameter of a graph by r and d respectively. a. Find the radius and diameter of K 6. r = d = 1 b. Find the radius and diameter of Q 5. r = d = 5 c. Find the radius and diameter of C 9. r = d = 4 d. Find the radius and diameter of K 5,7. r = d = 2 Part B 3 G is a digraph with 1000 vertices. It is known that G has one weakly connected component of size 700. It is also known that G has one strongly connected component of size 500; there are other strongly connected components but they are of smaller size. We first observe that the strongly connected component is a subgraph of the weakly connected component. The reason is that G has only 1000 vertices in total, and so, this means that the weakly and strongly connected components share common vertices. However, since any strongly connected component is also weakly connected, it then follows that the strongly connected component is a subgraph of the weakly connected component. a. Suppose Breadth First Search started at vertex u visits 650 vertices. Is vertex u in the weakly connected component? Explain. Yes, it is in the weakly connected component. Suppose u is not in the weakly connected component, then there is no path from u to any of the vertices in the weakly connected component. So there should only be at most 300 vertices visited by Breadth First Search
(BFS). But because BFS visited 650 vertices, therefore the initial assumption that u is not in the weakly connected component is false. b. Is vertex u in the strongly connected component? Explain. No, u is not necessarily in the strongly connected component. From (a), we have established that u must be in the weakly connected component. And we know that since BFS visited 650 vertices, all the vertices in the strongly connected component were visited. As it is unknown how the edges in G point, therefore it is inconclusive whether BFS was started within the strongly connected component. c. Suppose a Breadth First Search started at vertex v visits 600 vertices when the search is run normally and also visits 600 vertices when the search is run on the graph in which all directed edges are reversed. Is vertex v in the strongly connected component? Explain. Yes, it is in the strongly connected component. Let S denote the strongly connected component. Let u be a vertex in S. In both runs of BFS, all the vertices of S are visited. This is because each run of BFS visited 600 vertices, which means that it must have visited at least some of the vertices in S. But since there is a path between any two vertices in S, it then means that all the nodes in S are visited. and so there is a path from u to v and from v to u. If v is not in S, then there should not be a path from u to v and from v to u. Therefore, v is in S. d. Prove that for any vertex w in the graph's large weakly connected component, either there is a path from v to w or a path from w to v. From (c), in each run of BFS, there are 100 vertices visited that do not belong to S. By the same reasoning employed in (c), if any of the 100 vertices is common, then that vertex should belong to S. However, none of the 100 vertices are in S, therefore there are all different. In particular, there is no vertex in the weakly connected component that is not visited by BFS, because a total of 700 (= 500 + 100 + 100) different vertices are visited. Since v (from (c)) can be any vertex in the weakly connected component, it means that all the vertices in G can be visited by running both a forward and a backward BFS from v. Equivalently, it means that for any vertex w in the graph s large weakly connected component, either there is a path from v to w or a path from w to v. 4. a. Can 7 line-segments be drawn in the plane so that each intersects exactly 5 others? Prove your answer. No, it cannot be done. Proof: We can transform the situation to a graph and solve it using the Handshaking Theorem. Construct a graph G with 7 vertices such that each edge denotes a line segment. We connect 2 vertices by an undirected edge if and only if the line segments represented by the 2 vertices intersect each other. Since each line segment intersects exactly 5 others,
it means that the degree of each vertex is 5. Therefore, we want to prove that such a graph G with 7 vertices, all of degree 5, cannot be constructed. This means that the sum of the degrees of the vertices of G is 35, which is odd. However, by the Handshaking Theorem, the sum must be even. Therefore, G is impossible. b. Suppose a simple graph has exactly two vertices of odd degree. Prove that there is a path between between the two odd-degree vertices. We shall prove it by contradiction: Suppose a simple graph G has 2 vertices v 1 and v 2 such that both v 1 and v 2 are of odd degree and there is no path between v 1 and v 2. Since there is no path between v 1 and v 2, it therefore means that we can let v 1 be a vertex in G 1 and v 2 be a vertex in G 2 such that G 1 and G 2 are both subgraphs of G and they are connected graphs on their own. Because G has exactly 2 vertices of odd degree, it implies that every other vertex in G is of even degree. Therefore, every vertex in G 1 and G 2, other than v 1 and v 2, is of even degree. This means that the sum of the degrees of the vertices in both G 1 and G 2 is odd. However, by the Handshaking Theorem, the sum of the degrees of the vertices in both G 1 and G 2 must be even. Therefore, there is a contradiction and our initial assumption that there is no path between v 1 and v 2 is false. As such, we prove the claim and that there is indeed a path between the 2 odd-degree vertices in a simple graph with exactly 2 vertices of odd degree. Part C 4 For each of the following descriptions, determine whether the described graph is possible or impossible. Explain your answer; for credit, your explanation must be brief and easy to understand. (Hint: To show a graph is possible, either refer to one of the standard graph types or explain how to construct such a graph.) a. A simple graph with 8 vertices, all of degree 3. Possible. Q 3 is a graph that satisfies the description. For a diagram of Q 3, refer to Figure 6 on page 449 of Discrete Mathematics and Its Applications, 4 th Edition by Kenneth H. Rosen. b. A simple graph with 6 vertices, all of degree 5. Possible. K 6 is a graph that satisfies the description. For a diagram of K 6, refer to Figure 3 on page 448 of Discrete Mathematics and Its Applications, 4 th Edition by Kenneth H. Rosen. c. A simple, planar graph with 5 vertices, all of degree 4. Impossible. Let G be such a graph. Since every vertex is of degree 4, v = 4 and e = 10. By Corollary 1 of Euler s Theorem, if G is a simple, planar graph and v 3, then e 3v 6. However, the inequality is not satisfied in this case. Therefore, G cannot be a simple, planar graph.
d. A simple, planar graph with 8 vertices and 20 edges. Impossible. Let G be such a graph such that v = 8 and e = 20. By Corollary 1 of Euler s Theorem, if G is a simple, planar graph and v 3, then e 3v 6. However, the inequality is not satisfied in this case. Therefore, G cannot be a simple, planar graph. 6 For each of the following descriptions, determine whether the described graph is possible or impossible. Explain your answer; for credit, your explanation must be easy to understand. a. A simple, connected graph with 10 vertices: 4 of degree 3, 6 of degree 1. Possible. An example is as follows: b. A simple, connected graph with 20 vertices: 8 of degree 3, 12 of degree 1. Impossible. Let G be such a graph. By the Handshaking Theorem, we know that e = 18. As given, v = 20. Since an edge connects 2 nodes, therefore there must be at least 19 edges for G to be connected. However, in this case, e < 19, so this graph is impossible. c. A simple, connected graph with 20 vertices: 10 of degree 3, 5 of degree 2, 5 of degree 1. Impossible. By the Handshaking Theorem, the sum of the degrees of the vertices of any simple, connected, undirected graph is even. However, in this case, the sum of degrees is 45, which is odd, so this graph is impossible. a. d. A simple, planar, connected graph with 44 vertices: 43 of degree 3, one of degree 43. Possible. W 43 is a graph that satisfies the description.