CME 305: Discrete Mathematics and Algorithms Instructor: Professor Amin Saberi ([email protected]) Midterm

h The graph Qh is an undirected with 2 vertices, where each corresponds to a binary string of length h. Two vertices labeled by strings x and y are joined by an if and only if x can be obtained from y by changing a single bit. As usual, the number of nodes is denoted n = 2h.

The hypercube graph Q4.

1. (20 points) Prove that the diameter of Qh is h. Solution. We exhibit a of length at most h between any two nodes u and v. Starting at any node u, we can get to any other node v by ‘correcting’ the bits of u from left to right, one by one to match v. Each correction corresponds to traversing a single edge, and there can be at most h corrections. Furthermore, to get from all zeros to all ones we must make at least h corrections, thus the diameter is exactly h. 2. (20 points) Let G(V,E) be an undirected graph and s and t be two vertices in V . Prove that the number of edge disjoint paths between s and t is equal to the minimum number of edges one has to remove to disconnect s from t. Solution. Suppose we have k edge-disjoint s−t paths. To disconnect s and t, we must cut at least one edge from each of these paths. It remains to show the other direction. Now suppose we can disconnect s and t by removing c edges. We must exhibit c edge-disjoint paths. We know by the Max-Flow Min-Cut theorem that it is possible to send c units of flow from s to t, assuming unit capacities on edges. Now consider the flow network which achieves the maximum flow. If we start at s, by conservation we’re always guaranteed that there will be an outgoing saturated edge. We continue following saturated edges until we reach t. We may re-visit some vertices, but there will be always be a way out (by conservation) until we reach t. Record all the edges used to reach t, and remove any cycles from the path. Then reduce the flow across the path to zero to create a new flow f 0. f 0 will have value c − 1. Thus the result holds by induction. The proof gives us a way to actually find the paths: • Find the maximum flow in G. • Start walking from s. • If you create a , eliminate the flow around the cycle. • If you reach t, output the path you used to reach t.

3. (20 points) Consider a simple random walk starting from an arbitrary vertex in Qh. Show that the cover time of the random walk on Qh, i.e. the expected time that it takes for the random walk to visit all the vertices is at most O(nh3). You can prove a weaker bound for partial credit. Solution. By Matthew’s bound we know cover time is O(H log(n)), where H is the largest hitting time in the graph. We can trivially upperbound the largest hitting by the largest commute time. The largest commute time is given by 2m times the largest effective resistance. In a graph with diameter h, effective resistance between any two nodes is at most h. Thus the largest hitting time is at most 2mh. The number of edges in the hypercube is m = hn/2 since each node has degree h. Putting all these together:

C(G) ≤ 2H log(n) ≤ 4mh log(n) = 2nhh log(n) = 2nhh log(2h) = O(nh3)

2 4. Extra Credit (20 points): Prove that the cover time of Qh is O(nh ). Hint Prove that there are at least h edge-disjoint paths between any pair of vertices s and t in Qh. Solution. Assuming the hint (proved later), we sharpen the proof of the last question to give a better bound on the largest effective resistance. Since there are at least h paths between any pair of vertices, all of which are most length h, the largest effective resistance can be bounded by h/h = 1. This is because those h edge-disjoint paths are like h resistors in parallel each with resistance at most h. So we can bound the effective resistance between any two nodes by 1, giving as before:

C(G) ≤ 2H log(n) ≤ 4m log(n) = 2nh log(n) = 2nh log(2h) = O(nh2)

It remains to show that in a hypercube graph Qh there are at least h edge-disjoint paths between any two nodes. We want to show that there are n internally vertex disjoint paths between any two distinct vertices u and v of Qh. By the symmetry of the hypercube we can assume without loss of generality that u = (0, 0, ..., 0) and v = (0,..., 0, 1,..., 1) for some | {z } | {z } k h−k k ∈ {0, 1, . . . , n − 1}. Now for each i = 1, 2, ..., h define a path Pi as follows: start from the vertex u (which is all zeros), flip the i-th bit to a 1 and then correct wrong bits (bits in which the current vertex and the destination vertex v differ) one by one moving leftwards from position i − 1 to 1 to n and back to i. Observe that the paths Pi are by construction internally vertex disjoint. Thus the vertex-connectivity and the edge-connectivity of Qh are at least h.

2