Advanced Algorithms Lecture 09.0
Advanced Algorithms Lecture 09.0
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
18.415/6.854 Advanced Algorithms October 15, 2001
Lecture 9
Lecturer: Michel X. Goemans Scribe: Jasrper Lin
Max-Flow
Min Cost Flow
Min Weighted Bipartite Matching
a Shortest Path
Given a directed graph G = (V,E ) , a function I : E + R that specifies the lengths of the
edges, and a fixed vertex s E V, find the shortest simple2 path from s to t , for every vertex
t E V. I f the length of edges are nonnegative numbers, then Dijkstra's Algorithm may be
used. Dijkstra's Algorithm has different running times depending on how the priority queue
+
is implemented. Using a Fibonacci Heap, the running time is O(m n log n), where m = IEl
and n = IVI. In general, if 1 can be negative, the problem is NP-complete. However, it is
common to consider the case when there is no negative length cycles. Then the Bellman-Ford
Algorithm can be used. This algorithm either detects that there is a negative length cycle or
computes, in O(mn), the length of the shortest path between s and t for every vertex t E V.
I A function f (x,y) is anti-symmetric iff f (x,y) = -f (y, x).
2A path is simple if it visit each vertex at most once.
Remark 1 The algorithms mentioned here do not i n general apply directly t o undirected graphs as
one would think. The naive approach would be to turn every edge i n the undirected graph into two
edges going both ways i n the digraph. This approach works if the lengths of the edges are nonnegative
numbers. However, if an undirected graph has an edge with a negative length, doubling it would create
a negative length cycle where one might not have existed i n the first place. A s it turns out, i n this
case, the problem i n undirected graphs is much more dificult than the digraph shortest path problem
and some underlying assumptions that we make about digraphs do not hold for undirected graphs.
There is a n algorithm for this problem using non-bipartite matching algorithm.
the number of operations required is bounded by a polynomial of the number of data items i n
the input, and not the size of the numerical values i n the input.
all arithmetic operations are performed on numbers whose size is polynomial i n input size.
If the running time of an algorithm is polynomial but not strongly polynomial, then we say that it is
weakly polynomial.
Our goal is to search for a strongly polynomial algorithm to solve the min cost circulation problem.
Not all polynomial time algorithms are strongly polynomial. The algorithms for Linear Programming
and some versions of Dijkstra's Algorithm are not strongly polynomial in running time. For example,
+
using different priority queues, both O(n log log L) and O(m n d w ) are possible, where L is the
maximum length in the graph.
Definition 5 Given a graph G = (V,E ) and a circulation f , we define the residual graph o f f to be
Gf = (V,Ef ), where Ef = {(u,W) E Elf(v, w) < u(u, w)), and the capacity function is replaced by
the residual capacity function uf (u,u) = u(u, u) - f (u,u).
The important property of the residual graph is that if g is a circulation in the residual graph G f ,
+
then f g is a valid circulation in G, since f + +
g 5 f u - f = u.
A vertex potential p is a real-valued function defined on the set of vertices (p : V + Kt). Corre-
+
sponding to a potential p, we can define a reduced cost function cp(u,w) = c(u,w) p(u) - p(w).
Lemma I For every directed cycle C, cp(C) = c(C), where the notation cp(C) = Cc cp(u,w).
( l i + l i i i ) Assume there is a circulation f* with c . f * < c . f and a potential p with cp(u,w) >0
for every (u,w) E Ef.By Lemma 2, c, - f* < cp . f . Then
However, (u, w) E Ef implies that f * (v,w) > f (u, w). Therefore, 2 C(v,w)
cP(v,w) .
(f* (u, w) - f (u, w)) 2 0, which is a contradiction.
(i + ii) Suppose f is of min-cost and there exists a cycle C in Gfsuch that c(C) < 0. Form f I, where
+
fl(u, u) = f (u, u) E when (u, v) E C, fl(u, v) = f (u, u) - c when (v, w) E C , f t ( u , u) = f (u, u)
otherwise, and E = minetC cf ( e ) > 0. Therefore, c(f I) = c(f )+2~.c(C)< c(f ) , a contradiction.
(ii -+iii) Will be proved next lecture.
Step 3 can be done i n many diflerent ways. They key is to choose intelligently to reduce the number
of iterations necessary.