
CS473ug Head Banging Session #6 3/07/06 - 3/09/06
1. Updating a maximum flow
Suppose you are given a directed graph G= (V, E ), with a positive integer capacity ceon each edge
e, a designated source s∈V, and a designated sink t∈V. You are also given a maximum s−tflow
in G, defined by a flow value feon each edge e. The flow {fe}is acyclic: There is no cycle in Gon
which all edges carry positive flow.
No suppose we pick a specific edge e∗∈Eand reduce its capacity by 1 unit. Show how to find a
maximum flow in the resulting capacitated graph in time O(m+n), where mis the number of edges
in Gand nis the number of nodes.
2. Cooking Schedule
You live in a cooperative apartment with nother people. The co-op needs to schedule cooks for the
next ndays, so that each person cooks one day and each day there is one cook. In addition, each
member of the co-op has a list of days they are available to cook (and is unavailable to cook on the
other days).
Because of your supperior CS473 skills, the co-op selects you to come up with a schedule for cooking,
so that everyone cooks on a day they are available.
(a) Describe a bipartite graph Gso that Ghas a perfect matching if and only if there is a feasible
schedule for the co-op.
(b) A friend of yours tried to help you out by coming up with a cooking schedule. Unfortunately,
when you look at the schedule he created, you notice a big problem. n−2 of the people are
scheduled for different nights on which they are available: no problem there. But the remaining
two people are assigned to cook on the same night (and no one is assigned to the last night).
You want to fix your friend’s mistake, but without having to recompute everything from scratch.
Show that it’s possible, using his “almost correct” schedule to decide in O(n2) time whether there
exists a feasible schedule.
3. Tracking a Hacker
A computer network (with each edge weight 1) is designed to carry traffic from a source sto a
destination t. Recently, a computer hacker destroyed some of the edges in the graph. Normally, the
maximum s−tflow in Gis k. Unfortunately, there is currently no path from sto t. Fortunately, the
sysadmins know that the hacker destroyed at most kedges of the graph.
The sysadmins are trying to diagnose which of the nodes of the graph are no longer reachable. They
would like to avoid testing each node. They are using a monitoring tool with the following behavior.
If you use the command ping(v), for a given node v, it will tell you whether there is currently a path
from sto v(so ping(t) will return False but ping(s) will return True).
Give an algorithm that accomplishes this task using only O(klog n) pings.
1