\newcounter{lecture} \setcounter{lecture}{6}
\def\thetoday{January 27, 2009}
\def\thetitle{More Network Flow and Applications}

\input{lec_hdr.tex}

Recall from last lecture the \emph{Ford-Fulkerson} algorithm for
max-flow:

\begin{algorithm}[h]
\begin{algorithmic}
\STATE Start with $f(e) = 0$, $\forall e \in E$.\\
\WHILE {there is a path $P$ from $s$ to $t$ in $R(N,f)$}
\STATE send a flow of value $\min_{e \in P} c(e)$ in $R$ along $P$.
\STATE augment $f$ in $N$ using the above flow.
\STATE rebuild the residual network $R(N,f)$.
\ENDWHILE
\STATE Output $f$.
\end{algorithmic}
\caption{Ford-Fulkerson, 1956}
\end{algorithm}

We showed that,
\begin{lemma}
If Ford-Fulkerson terminates, it outputs a maximum flow.
\end{lemma}

We proved this by noting that when Ford-Fulkerson terminates, there
are no s-t paths in the residual network $R$.  If we take all nodes
reachable in $R$ from $s$ and call this node set $A$, this defines an
s-t cut $(A,V / A)$ across which all capacities are saturated.  

\begin{lemma} If all edge capacities of $N$ are integral,
  Ford-Fulkerson terminates.
\end{lemma}
\begin{proof}
At each stage in Ford-Fulkerson, we construct the residual network $R$.  If
there exists an s-t path in $R$, then we increase flow by at least 1
(since capacities are integral).  Since edge capacities are finite,
the algorithm must terminate in finite time.
\end{proof}

Note that although this proves that Ford-Fulkerson terminates in a
\emph{finite} number of steps, its running time may depend on the
maximum value of the capacities, since it is only guaranteed to
increment by one at each step.

Two important corollaries follow from the proof of Ford-Fulkerson:
\begin{cor}[Max-Flow/Min-Cut] The minimum cut value in a network
  is the same as the maximum flow value.
\end{cor}
\begin{cor}[Integral Flow] If all edge capacities in a network are integer, then
  there exists an integral maximum flow.
\label{integ}
\end{cor}

Not only does Ford-Fulkerson prove the existence of a min-cut of value
equal to the max-flow, it gives a mechanism for finding it, as
the cut $(A,V / A)$ referenced in the proof is a min-cut.

The importance of flow integrality becomes apparent in the following
application.

\subsubsection*{Application: Maximum matching in a bipartite graph.}

Recall the maximum matching problem defined in lecture 4.  A maximum
matching $M^* \subseteq E$ is a set of edges satisfying two criteria:
\begin{itemize}
\item No two edges in $M^*$ share an endpoint.
\item $|M^*|$ is the maximum edge set satisfying condition 1.
\end{itemize}

We will represent this as a flow problem.  We create a source node $s$
and add edges from $s$ to each node in $A$, and create a target node
$t$ and add edges from each node in $B$ to $t$.  We put capacity $1$
on each edge.  Then any matching defines a flow in this graph, and any
integral flow defines a matching (consider the saturated edges in between
$A$ and $B$).  Therefore, finding maximum integral flow in this graph 
yields the maximum matching.  By corollary \ref{integ}, we know that 
such a flow exists and that Ford-Fulkerson will find it.

\begin{lemma} Hall's marriage theorem is implied by max-flow/min-cut. 
\end{lemma}

\begin{proof} Define the flow problem as previously with the exception of 
placing a capacity of $c(e) = n + 1$ for each $e \in E$ (all edges except 
those leaving $s$ or entering $t$). Let $cut(R,Q)$ be the min s-t cut 
found by solving the max-flow problem. Define $A_R = A \cap R$, $B_R = 
B \cap R$ and $A_Q = A \cap Q$, $B_Q = B \cap Q$.

First, note that if the max-flow has a value $v(f) = n$, we have found a 
perfect matching as shown previously. Then clearly no subset $S \subset 
A$ has a neighborhood $N(S)$ for which $|N(S)| < |S|$ (otherwise a perfect 
matching would not be possible) in agreement with Hall's marriage theorem.

Now, note that there cannot be any edges between $A_R$ and $B_Q$. If such
an edge $e$ existed, it would have to be in the $cut(R,Q)$ by definition
and would add a value of $c(e) = n + 1$. This contradicts the fact that 
we have min cut since the maximum flow possible out of the source $s$ is 
$n$ by construction. Thus $(1)$ $N(A_R) \subseteq B_R$. Furthermore, we 
can conclude that all flow goes along edges from $s$ to $A_Q$ and from 
$B_R$ to $t$. Thus, since all edges in the min-cut are saturated, $(2)$ 
$v(f) = |A_Q| + |B_R|$. 

Finally, consider a scenario where the max-flow has a value $v(f) < n$.
By $(1)$ we have $|N(A_R)| \leq |B_R|$ and by $(2)$ we have $|B_R|
= v(f) - |A_Q| < n - |A_Q| = |A_R|$. We can now conclude that $|A_R|
> |N(A_R)|$. Thus we have found a subset whose neighborhood is strictly 
larger and by Hall's marriage theorem a perfect matching does not exist.
\end{proof}


\subsubsection*{Application: Counting edge-disjoint paths}
Let $G(V,E)$ be a graph and let $P_1, P_2,\ldots P_k$ be a collection
of paths from $s$ to $t$.  We say that $P_1, P_2,\ldots P_k$ are
\defn{edge disjoint} if they have no edges in common.

Say that we wish to count the maximum number of edge disjoint paths
between $s$ and $t$.  Then we simply set capacities of all edges in
$G$ to be $1$.  As another application of the integral max-flow
corollary, it is easy to see that the value of the max-flow in the
flow network will be the number of edge disjoint paths.

The max-flow/min-cut theorem therefore gives an easy proof of the
relationship between the number of edges we need to remove to
disconnect $s$ and $t$ and the number of edge-disjoint paths known as
\emph{Menger's Theorem}:
\begin{thm}[Menger, 1927] The minimum number of edges necessary to
  disconnect two given vertices $s$ and $t$ is equal to the
  maximum number of edge-disjoint paths from $s$ to $t$.
\end{thm}

We call a graph $G(V,E)$ \emph{k-connected} if it takes the removal of at least
$k$ edges to disconnect $G$.  A corollary of Menger's theorem is then
\begin{cor}
$G$ is $k$-connected if and only if there are at least $k$
edge-disjoint paths between every pair of vertices.
\end{cor}

\end{document}
