Algorithm Design
Algorithm Design
Algorithm Design
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
424<br />
Figure 7.29 An instance of<br />
Coverage Expansion.<br />
Chapter 7 Network Flow<br />
18.<br />
ping(s) always reports a path from s to itself.) Since it’s not practical to go<br />
out and inspect every edge of the network, they’d like to determine the<br />
extent of the failure using this monitoring tool, through judicious use of<br />
the ping command.<br />
So here’s the problem you face: Give an algorithm that issues a<br />
sequence of ping commands to various nodes in the network and then<br />
reports the full set of nodes that are not currently reachable from s. You<br />
could do this by pinging every node in the network, of course, but you’d<br />
like to do it using many fewer pings (given the assumption that only<br />
k edges have been deleted). In issuing this sequence, your algorithm is<br />
allowed to decide which node to pIng next based on the outcome of earlier<br />
ping operations.<br />
Give an algorithm that accomplishes this task using only O(k log n)<br />
pings.<br />
We consider the Bipartite Matching Problem on a bipartite gr,aph G =<br />
(V, E). As usual, we say that V is partitioned into sets X and Y, and each<br />
edge has one end in X and the other in Y.<br />
If M is a matching in G, we say that a node y ~ Y is covered by M if y<br />
is an end of one of the edges in M.<br />
(a) Consider the following problem. We are given G and a matching M In<br />
G. For a given number k, we want to decide if there is a matching M’<br />
inG so that<br />
(i) M’ has k more edges than M does, and<br />
(ii) every node y ~ Y that is covered by M is also covered by M’.<br />
We call this the Coverage Expansion Problem, with input G, M, and k.<br />
and we will say that M’ is a solution to the instance.<br />
Give a polynomial-time algorithm that takes an instance of Coverage<br />
Expansion and either returns a solution M’ or reports (correctly)<br />
that there is no solution. (You should include an analysis of the running<br />
time and a brief proof of why it is correct.)<br />
Note: You may wish to also look at part (b) to help in thinking about<br />
this.<br />
Example. Consider Figure 7.29, and suppose M is the matching consisting<br />
of the edge (xl, Y2). Suppose we are asked the above question<br />
with k = !.<br />
Then the answer to ~s instance of Coverage Expansion is yes.<br />
We can let M’ be the matching consisting (for example) of the two<br />
edges (xl, Y2) and (x2, Y4); M’ has one more edge than M, and y2 is still<br />
covered by M’.<br />
19.<br />
Exercises<br />
(b) Give an example of an instance of Coverage Expansion, specified by<br />
G, M, and k, so that the following situation happens.<br />
The instance has a solution; but in any solution M’, the edges of M do<br />
not form a subset of the edges of M’.<br />
(c) Let G be a bipartite graph, and let M be any matching in G. Consider<br />
the following two quantities.<br />
- K1 is the size of the largest matching M’ so that every node y that<br />
is covered by M is also covered by M’.<br />
- K2 is the size of the largest matching M" in G.<br />
Clearly K1 _< K2, since K 2 is obtained by considering all possible matchings<br />
In G.<br />
Prove that in fact K~ = K~; that is, we can obtain a maximum<br />
matching even if we’re constrained to cover all the nodes covered<br />
by our initial matching M.<br />
You’ve periodically helped the medical consulting firm Doctors Without<br />
Weekends on various hospital scheduling issues, and they’ve just come<br />
to you with a new problem. For each of the next n days, the hospital has<br />
determined the number of doctors they want on hand; thus, on day i,<br />
they have a requirement that exactly Pi doctors be present.<br />
There are k doctors, and each is asked to provide a list of days on<br />
which he or she is wiJJing to work. Thus doctor j provides a set L i of days<br />
on which he or she is willing to work.<br />
The system produced by the consulting firm should take these lists<br />
and try to return to each doctor j a list L; with the following properties.<br />
(A) L; is a subset of Li, so that doctor j only works on days he or she finds<br />
acceptable.<br />
(B) If we consider the whole set of lists L~ ..... L~, it causes exactly pi<br />
doctors to be present on day i, for i = 1, 2 .....n.<br />
(a) Describe a polynomial-time algorithm that implements this system.<br />
Specifically, give a polynomial-time algorithm that takes the numbers<br />
Pl, Pa ..... pn, and the lists L 1 ..... L k, and does one of the following<br />
two things.<br />
- Return lists L~, L~ ..... L~ satisfying properties (A) and (B); or<br />
- Report (correctly) that there is no set of lists L~, L’ a ..... L~ that<br />
satisfies both properties (A) and (B).<br />
(b) The hospital finds that the doctors tend to submit lists that are much<br />
too restrictive, and so it often happens that the system reports (correctly,<br />
but unfortunately) that no acceptable set of lists L~, L~ ..... L~<br />
exists.<br />
425