Professional Documents
Culture Documents
1
we have the choice among several such augmenting paths P , we select one
with minimum cost.
This was the whole algorithm. But since the selection rule for augment-
ing paths is a greedy rule, we have to prove that the final result will be
correct. We also need to discuss how we can find a minimum-cost path
efficiently: Due to the presence of negative edge costs, this is not just the
standard shortest-path problem. The correctness proof is rather compli-
cated, but it will also help us to implement the selection step efficiently.
First we need the following equivalence. Let M be any perfect matching.
Then M has minimum cost if and only if GM has no negative cycles (i.e.,
directed cycles with negative total cost).
To prove this equivalence, assume that C is a negative cycle in GM .
Then we can use C to improve the cost of M , just by changing the status
of all edges in C. Conversely, assume M is not minimum. We have to
show that GM contains a negative cycle. Since M is not minimal, there is
a cheaper perfect matching M 0 . Consider the symmetric difference D :=
(M \ M 0 ) (M \ M 0 ). It is not hard to see that D is a set of node-disjoint
directed cycles in GM . The total cost of D is negative, hence some of these
cycles must be negative.
When we increase the size i of M step by step, it would be nice to do
that in such a way that GM never gets negative cycles, because then we are
sure that the final M is minimum. In fact, we can acomplish this property
by introducing prices!
Every node v pays a price p(v) for being matched. We call the prices
compatible if the following is satisfied: p(x) = 0 for all unmatched x X,
p(x) + ce p(y) 0 for all edges e = (x, y), and p(x) + ce p(y) = 0 for
all edges e = (x, y) M . For every edge e = (v, w) in GM we define the
reduced cost by p(v) + ce p(w), where ce is the edge cost in GM . For
edges e = (y, x) this actually means p(y) ce p(x) since the cost of such
edges in GM is ce . Note that, for compatible prices, the reduced costs are
always nonnegative.
Now it is easy to show: If compatible prices exist for M , then GM has no
negative cycles. For the proof, just consider any cycle in GM . The cost of
the cycle equals the sum of costs of its edges. But it also equals the sum of
reduced costs of edges, because the positive and negative price terms at the
nodes cancel out around the cycle. And the reduced costs are nonnegative.
Another consequence of the nonnegative reduced costs is that we can
compute an st path with minimum reduced costs by any standard-shortest
2
path algorithm: In particular, we may use Dijkstras algorithm to find a
minimum reduced-cost path from s to every node y Y , in O(mn log n)
time. The real cost of any s y path is simply the reduced cost plus p(y),
since the price terms of all inner nodes of the path cancel out. Thus we
can find a minimum-cost s t path efficiently, by trying every y Y as
candidate for the second last node.
It remains to show that, by choosing a minimum-cost path P in each step,
we keep the prices compatible. Then the algorithm is correct. (Why?)
Initially, for i = 0, we do have compatible prices: Since M = , we set
p(x) = 0 for x X, and p(y) is the minimum cost of an edge incident with
y Y.
In any later step, let M be a matching with compatible prices p. We
obtain a matching M 0 by augmentation along some minimum-cost st path
P . Now we have to construct compatible prices for M 0 . Let d(v) denote
the distance from s to any node v, where the lengths of edges are their
reduced costs in GM . We claim that p0 (v) := p(v) + d(v) gives compatible
prices. Just check the conditions. We have p0 (x) = 0 for all x X yet
unmatched by M 0 , since we had p(x) = 0 before, and d(x) = 0. Next
consider any e = (x, y) M . Since (y, x) is the only edge in GM entering
x, it follows d(x) = d(y) + p(y) ce p(x), thus p0 (x) + ce p0 (y) = 0 as
desired. Next consider any (x, y) M 0 \ M . Such an edge must be on P ,
hence d(y) = d(x) + p(x) + ce p(y), and p0 (x) + ce p0 (y) = 0 as desired.
Finally consider any (x, y) / M M 0 . Here the triangle inequality yields
d(y) d(x) + p(x) + ce p(y), hence p0 (x) + ce p0 (y) 0 as desired.