\documentclass[landscape]{slides}
\usepackage{multicol}
\input{preamble}

\input{SLIDES}

%\usepackage[dvips]{graphics}
%\usepackage[all,poly,ps,dvips,color]{xy}
%\UseCrayolaColors

\DeclareMathOperator{\mathin}{in}
\DeclareMathOperator{\mathout}{out}

\newcommand{\vindex}[2]{\left[ #1 \right] _ #2}
\newcommand{\eigen}{\mathbf a}
\newcommand{\elem}{\mathbf e}
\newcommand{\state}{\mathbf x}
\newcommand{\maxdeg}{\Delta}
\newcommand{\maxdegC}{d_{max}}

\newcommand{\din}{d_{\mathin}}
\newcommand{\dout}{d_{\mathout}}
\newcommand{\dmax}{d_{\max}}


\newcommand{\nlabel}[2]{\ar@{} @(#1,#1) |<<{#2}}
\newcommand{\gnlabel}[2]{[#1(.25)] {#2}}
\newcommand{\node}{{\bullet}}
\newcommand{\bypass}{{\circ}}

\begin{document}

\begin{titlepage}
\title{CS 591-06, Lecture 4}

\author {Jared Saia \\
{\red University of New Mexico}}

\date{}
\maketitle

\end{titlepage}

\begin{SLIDE}[Class Outline]
\begin{itemize}
\item Review of defn of ``Augmented Chains''
\item ``Find-Matching'' algorithm for finding matching in
bipartite graph
\item Proof of correctness for ``augmented chains'' algorithm
\item Algorithm for making a graph regular (and exercise)
\item The migration algorithms!
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[Matching Algorithm]

For a bipartite graph $G$ with edge set $E$:

Defn: A \emph{chain} is a sequence of vertices and edges
$v_{1},e_{1},v_{2},e_{2},...,e_{l},v_{l}$ such that the edge $e_{i} =
(v_{i-1},v_{i})$.

Let $M$ be some (possibly non-maximum) matching on $G$.

Defn: A chain $v_{1},e_{1},v_{2},e_{2},\dots, e_{l},v_{l}$ is called
\emph{M-alternating} if the edges $e_{2},e_{4},\dots $ are in $M$.

Defn: A chain $v_{1},e_{1},v_{2},e_{2},\dots, e_{l},v_{l}$ is called
\emph{M-augmenting} if it is M-alternating and the vertices $v_{1}$
and $v_{l}$ are not incident to any edges in $M$.

{\bf Chain Theorem}: A Matching M is maximum for a graph $G$ if and
only if $G$ contains no $M$-augmenting chains.

\end{SLIDE}

\begin{SLIDE}[Algorithms Find-Matching]
Input: A bipartite graph $G= (L,R)$

\alg{Find-Matching}:

\begin{enumerate}

\item Let $M = \phi$
\item While $M$ is not a perfect matching do:

\begin{enumerate}

\item Search for an $M$-augmenting chain in $G$.

\item If a chain was found, let $A =
v_{1},e_{1},v_{2},e_{2},v_{3},e_{3} \dots, e_{l-1}, v_{l-1},
e_{l},v_{l}$ be that chain. Set the new matching $M$ to be $M \cup
\{e_{1},e_{3},\dots,e_{l}\} - \{e_{2},e_{4},\dots ,e_{l-1}\}$
\end{enumerate}
\end{enumerate}

\end{SLIDE}


\begin{SLIDE}[Exercise]
Increase the size of the matching $M$ by finding an $M$-augmenting
chain.  Draw the better matching on the graph to the right (shade in
the edges)

\ifig{aug-chain}

\end{SLIDE}


\begin{SLIDE}[Algorithm Find-Matching]

Input: A bipartite graph $G= (L,R)$

\alg{Find-Matching}:

\begin{enumerate}

\item Let $M = \phi$
\item While there are still unmatched vertices in $L$ do

\begin{enumerate}

\item For each $v$ that is unmatched in $L$ do

\begin{enumerate}
\item Search for an $M$-augmenting chain by doing a breadth first search
from $v$
\item If a chain was found, let $A =
v_{1},e_{1},v_{2},e_{2},v_{3},e_{3} \dots, e_{l-1}, v_{l-1},
e_{l},v_{l}$ be that chain. Set the new matching $M$ to be $M \cup
\{e_{1},e_{3},\dots,e_{l}\} - \{e_{2},e_{4},\dots ,e_{l-1}\}$
\end{enumerate}

\end{enumerate}
\end{enumerate}
\end{SLIDE}

\begin{SLIDE}[Proof of Chain Theorem]

{\bf Chain Theorem}: A Matching $M$ is maximum for a graph $G$ if and
only if $G$ contains no $M$-augmenting chains.

Easy direction: If a matching $M$ is maximum then $G$ contains
no $M$-augmenting chain.

To show this, assume, by way of contradiction, that $M$ is a maximum
matching and that there is an $M$-augmenting chain $C =
v_{1},e_{1},v_{2},e_{2},v_{3},e_{3}, v_{4}, e_{4}, \dots,
e_{l},v_{l}$.  Let $E' = M \cup \{e_{1},e_{3},\dots,e_{l}\} -
\{e_{2},e_{4},\dots ,e_{l-1}\}$.

\end{SLIDE}

\begin{SLIDE}[Easy direction]

We note the following:

\begin{itemize}
\item $|E'| > |M|$ 

\item The edge set $E'$ is a matching on $G$.

\end{itemize}

This implies that $E'$ is a larger matching than $M$ which is a
contradiction.

\end{SLIDE}

\begin{SLIDE}[Hard Direction]

If $G$ contains no $M$-augmenting chain, then the matching $M$ is
maximum.

Proof: Assume there exists some matching $M'$ such that $|M'|>|M|$.

Let $H$ be the subgraph of $G$ which has only those edges which appear
in either $M$ or $M'$ but not both.  $H$ is a graph of degree no more
than $2$ containing cycles and paths, the edges of which alternate
between being in $M$ and $M'$.

All cycles must be of even length (why?).  Thus there must be some
path with more $M'$ edges than $M$ edges.  This path is an
$M$-augmenting chain in $G$.
\end{SLIDE}

\begin{SLIDE}[Picture of $H$]
\ifig{aug}
\end{SLIDE}

\begin{SLIDE}[Tying up loose ends]

We've shown that we can factor a $k$-regular graph into a bunch of
$2$-regular graphs, but what about the general case?

Recall that a demand graph is not necessarily a regular graph.

Q: Is there a way to make a graph regular without increasing the
maximum degree by much?

A: Yes!

{\bf Theorem}: For any graph $G$ with degree $\Delta $, there is a
graph $G'$ with degree $\Delta' = 2 \lceil \Delta/2 \rceil$ such that
$G$ is a subgraph of $G'$.

\end{SLIDE}


\begin{SLIDE}[Making a graph $\Delta'$-regular]
The following algorithm takes a graph with degree $\Delta$ and adds
edges to it to get a graph of degree $\Delta' = 2 \lceil \Delta/2
\rceil$

\alg{Regular}:
\begin{enumerate}
\item While there exists a vertex with degree less than $\Delta' - 1$,
add a self loop to that vertex.

\item While there exist two distinct vertices of degree $\Delta' - 1$,
add an arbitrarily directed edge between them.
\end{enumerate}
\end{SLIDE}

\begin{SLIDE}[Excercise]
Make the following graph $4$ regular as specified in \alg{Regular}

\ifig{regular}

\end{SLIDE}

\begin{SLIDE}[The algorithms]

We can now present the entire algorithms for migration without space
constraints.

This will complete Section 2 of the paper ``On Algorithms for Efficient
Data Migration''

\end{SLIDE}

\begin{SLIDE}[Direct Migration]
Input: A demand graph $G$ with degree $\Delta $ 

Output: A migration plan taking $3\ceil{\Delta /2}$ time steps.

\alg{Direct Migration}:

\begin{enumerate}
\item Make $G$ $2\ceil{\Delta /2}$-regular using \alg{Regular}
\item Factor $G$ into $\ceil{\Delta /2}$ $2$-factors using \alg{2-factor}
\item Take up to three time steps to send the objects associated with
each $2$-factor.
\end{enumerate}
\end{SLIDE}

\begin{SLIDE}[Indirect Migration]
Input: A demand graph $G$ with degree $\Delta$ and $n$ vertices.

Output: A migration plan using $n/3$ bypass nodes and taking
$2\ceil{\Delta /2}$ time steps.

\alg{Indirect Migration}:

\begin{enumerate}
\item Make $G$ $2\ceil{\Delta /2}$ regular using \alg{Regular}
\item Factor $G$ into $\ceil{\Delta /2}$ $2$-factors using \alg{2-factor}
\item Use $n/3$ bypass nodes to take \emph{two} time steps to send the
objects associated with each $2$-factor.
\end{enumerate}
\end{SLIDE}

\begin{SLIDE}[Minute Paper]
\begin{enumerate}
\item What was the most interesting thing you learned in the section
on data migration?
\item What was the most confusing thing in the section on data migration?
\item What would you like to see more of?  less of?
\end{enumerate}
\end{SLIDE}



\end{document}
