Assignment 1 - Answer Key - Indian Statistical Institute
Assignment 1 - Answer Key - Indian Statistical Institute
Assignment 1 - Answer Key - Indian Statistical Institute
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Assignment</strong> 1 - <strong>Answer</strong> <strong>Key</strong><br />
Debasis Mishra ∗<br />
February 19, 2009<br />
Due: February 19, 2009<br />
1. Prove that every cycle of a bipartite graph has even number of edges.<br />
<strong>Answer</strong>: Consider a cycle of the bipartite graph of the following form: (i 1 , i 2 , . . . , i k , i 1 ).<br />
If the partition of vertices of the bipartite graph is B and L, then we know that alternating<br />
vertices belong to B and L. Suppose i 1 ∈ B, then i k ∈ L and every i j ∈ L if j<br />
is even. So k is even. Hence, number of edges is even.<br />
2. Show whether a matching exists or not in the bipartite graphs in Figure 1. In each<br />
case, give explanation for your answer.<br />
1<br />
a<br />
1<br />
a<br />
2<br />
b<br />
2<br />
b<br />
3<br />
c<br />
3<br />
c<br />
4<br />
d<br />
4<br />
d<br />
Figure 1: Two Bipartite Graphs<br />
<strong>Answer</strong>: A matching in the left graph is: (1, a), (2, c), (3, b), (4, d). In the right graph,<br />
2, 3, and 4 demand {a, b}. Hence, 2, 3, and 4 cannot be matched. So, no matching<br />
exists.<br />
∗ Planning Unit, <strong>Indian</strong> <strong>Statistical</strong> <strong>Institute</strong>, 7 Shahid Jit Singh Marg, New Delhi 110016, India, E-mail:<br />
dmishra@isid.ac.in<br />
1
3. Let (N, T ) be a tree of an undirected graph G = (N, E). Show the following:<br />
∑ [ ]<br />
2 − d(i) = 2,<br />
i∈N<br />
where d(i) is the degree of vertex i in tree (N, T ).<br />
<strong>Answer</strong>: We know that ∑ i∈N<br />
d(i) = 2#T . But #T in a tree equals n−1. Substituting,<br />
∑<br />
i∈N d(i) = 2(n − 1). Rearranging, ∑ [ ]<br />
i∈N 2 − d(i) = 2.<br />
4. Show that every tree which has a vertex of degree m ≥ 2 has at least m vertices of<br />
degree 1.<br />
<strong>Answer</strong>: Let i be the vertex of degree m. Let {i 1 , i 2 , . . . , i m } be the set of vertices<br />
with which i shares an edge. Consider m paths of the form: P 1 = (i, i 1 , . . . , j k 1<br />
),<br />
P 2 = (i, i 2 , . . . , j k 2<br />
), . . . , P m = (i, i m , . . . , j km ) such that j k 1<br />
, . . . , j km have degree 1.<br />
Clearly, m such paths exist. Moreover, any pair of such paths have only one vertex<br />
in common, which is i (else, we get a cycle in the tree). Hence, we get m vertices of<br />
degree 1.<br />
5. Suppose G is an undirected weighted connected graph. An edge is called a default<br />
edge if it has the minimum weight over all edges in G. Show that a default edge<br />
belongs to some minimum cost spanning tree of G.<br />
<strong>Answer</strong>: Let {i, j} be a default edge. Consider the cut ({i}, N \ {i}). The edge {i, j}<br />
is a light edge of this cut. Hence, by our result, it must be a safe edge, and hence be<br />
part of some minimum cost spanning tree.<br />
6. Find a minimum cost spanning tree of the graph in Figure 2.<br />
a<br />
2 b 4 c 1<br />
d<br />
5 4<br />
4<br />
6 2<br />
3<br />
3<br />
e<br />
5<br />
f<br />
3<br />
g<br />
2<br />
4<br />
3<br />
5<br />
7<br />
4<br />
2<br />
h<br />
3<br />
i<br />
6 3<br />
j<br />
k<br />
Figure 2: A connected graph with weights<br />
<strong>Answer</strong>: Apply the greedy algorithm discussed in the class.<br />
2
7. Suppose G is a directed weighted complete graph. Let the weights of edges of G<br />
satisfy the following triangle inequality: for any three edges (i, j), (j, k), and (i, k)<br />
we have w(i, j) + w(j, k) ≥ w(i, k). Show that a potential exists in G if and only if<br />
w(i, j) + w(j, i) ≥ 0.<br />
<strong>Answer</strong>: In the presence of triangle inequality, shortest path from i to j is the<br />
edge (i, j). Hence, s(i, j) = w(i, j) for all i, j ∈ N. Now, consider a cycle C =<br />
(i 1 , i 2 , . . . , i k , i 1 ). Suppose for all i, j ∈ N, we have w(i, j) + w(j, i) ≥ 0. But<br />
l(C) ≥ s(i 1 , i k ) + w(i k , i 1 ) = w(i 1 , i k ) + w(i k , i 1 ) ≥ 0. Hence, a potential exists. If<br />
a potential exists, then w(i, j) + w(j, i) is the length of cycle (i, j, i), and hence it<br />
should be non-negative.<br />
8. Find a feasible solution or determine that there are no feasible solutions for the following<br />
system of difference inequalities.<br />
x 1 − x 2 ≤ 4<br />
x 1 − x 5 ≤ 5<br />
x 2 − x 4 ≤ −6<br />
x 3 − x 2 ≤ 1<br />
x 4 − x 1 ≤ 3<br />
x 4 − x 3 ≤ 5<br />
x 4 − x 5 ≤ 10<br />
x 5 − x 3 ≤ −4<br />
x 5 − x 4 ≤ −8.<br />
<strong>Answer</strong>: No solution exists. Check that a negative cycle exists of the form: (1, 4, 2, 3, 5, 1).<br />
9. For the directed graphs in Figure 3, verify if a potential exists. If a potential exists,<br />
then identify at least one potential.<br />
<strong>Answer</strong>: In both graphs, potential exists. Fix vertex a in the first graph, and assign<br />
it potential zero. Find shortest path from a to every other vertex to get the other<br />
potentials. For the second graph, one can fix any vertex, and apply the same shortest<br />
path method.<br />
3
3<br />
b<br />
2<br />
c<br />
−3<br />
−3<br />
−2<br />
4<br />
a<br />
−2<br />
1<br />
d<br />
−2<br />
2<br />
1<br />
−1<br />
1<br />
−1<br />
2<br />
2<br />
e<br />
1<br />
Figure 3: Two directed graphs<br />
−2<br />
4