ChApTeR 10
■
MATChINgs, CuTs, ANd Flows
215
one of the paths, because
you could have canceled it, thereby reaching
T. In other words, all edges across from
S to
T belong to your disjoint paths, and because none of the edges in the other direction do, the forward edges must all
belong to a path of their own, meaning that you have
k disjoint paths and a separator of size
k.
This may be a bit involved, but the intuition is that if we can’t find an augmenting path, there must be a
bottleneck somewhere, and we must have filled it.
No matter what we do, we can’t get more paths through this
bottleneck, so the algorithm must have found the answer. (This result is a version of Menger’s theorem, and it is
a special case of
the max-flow min-cut theorem, which you’ll see in a bit.)
What’s the running time of all this, then? Each iteration consists of a relatively straightforward traversal from
s,
which has a running time of
O(
m), for
m edges. Each round gives us another disjoint path, and there are clearly at most
O(
m), meaning that the running time is
O(
m
2
). Exercise 10-3 asks you to show that this is a tight bound in the worst case.
Note
■
Menger’s theorem is another example of duality: The maximum number of edge-disjoint paths from
s to
t is
equal to the minimum cut between
s and
t. This is a special case of the max-flow min-cut theorem, discussed later.
Maximum Flow
This is the central problem of the chapter. It forms a generalization of both the bipartite matching and the disjoint
paths, and it is the mirror image of the minimum cut problem (next section). The only difference from the disjoint
path case is that instead of setting the
capacity for each edge to one, we let it be an arbitrary positive number. If the
capacity is a positive integer, you could think of it as the number of paths that can pass through it. More generally, the
metaphor here is some form of substance flowing through the network, from the source to the sink, and the capacity
represents the limit for how many units can flow through a given edge. (You can think of this as a generalization of
the engagement rings that were passed back and forth in the matching.)
In general, the flow itself is an assignment
of a number of flow units to each unit (that is, a function or mapping from edges to numbers), while the
size or
magnitude of the flow is the total amount pushed through the network. (This can be found by finding the net flow out
of the source, for example.) Note that although flow networks are commonly defined as directed, you could find the
maximum flow in an undirected network as well (Exercise 10-4).
Let’s see how we can solve this more general case. A naïve approach would be to simply split edges, just like
the naïve extension of BFS in Chapter 9 (Figure 9-3). Now, though, we want to split them
lengthwise, as shown in
Figure
10-3
. Just like BFS with serial dummy nodes gives you a good idea of how Dijkstra’s algorithm works, our
augmenting path algorithm with parallel dummy nodes is very close to how the full Ford-Fulkerson
algorithm for
finding maximum flow works. As in the Dijkstra case, though, the actual algorithm can take care of greater chunks of
flow in one go, meaning that the dummy node approach (which lets us saturate only one unit of capacity at a time) is
hopelessly inefficient.
Do'stlaringiz bilan baham: