\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 3}

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

\date{}
\maketitle

\end{titlepage}

\begin{SLIDE}[Class Outline]
\begin{itemize}
\item Review 
\item Proof of Hall's Theorem
\item In-class Exercise
\item Open Problems
\end{itemize}
\end{SLIDE}


\begin{SLIDE}[Factoring a graph]
Let $G$ be a $k$-regular graph where $k$ is an even number.  We factor
$G$ as follows:

\begin{enumerate}

\item Construct an Euler-tour of $G$.

\item Orient the edges according to the direction of the tour.  That is, if
the tour enters $v$ on edge $e_1$ and leaves on edge $e_2$, then $e_1$
is an in-edge to $v$ and $e_2$ is an out-edge. Thus we have
$\din=\dout=k$.

\item Set up a bipartite matching problem, $B_G$, with a
representative of each vertex in the graph on both sides.  Add in all
directed edges going from left to right.  Note that each edge is
represented in the matching problem exactly once.

\item Find a matching (which is guaranteed to exist by Hall's Theorem).
The matched edges induce a 2-factor of the original graph.  Remove these edges
from $B_G$ and repeat this step until there are no edges left.
\end{enumerate}

\end{SLIDE}

\begin{SLIDE}[Hall's Theorem]

Statement of Hall's Marriage Theorem:

Let $G= (L,R)$ be a bipartite graph.  Then:

\begin{itemize}
\item There is a perfect matching for $G$
\end{itemize}

if and only if

\begin{itemize}
\item $\forall L' \subseteq L$, $|L'| \leq |N (L')|$
\end{itemize}

where $|X|$ is the number of vertices in the set $X$ and $N (X)$ is
the set of neighbors of the set $X$.

\end{SLIDE}

\begin{SLIDE}[Corollary]

Last time we proved that for bipartite $G= (L,R)$,:

if

\begin{itemize}
\item $G$ is $k$-regular,
\end{itemize}

then 

\begin{itemize}
\item $\forall L' \subseteq L$, $|L'| \leq |N (L')|$
\end{itemize}

Proof: Consider any set  $L' \subseteq L$, then

\begin{itemize}
\item number of edges between $L'$ and $N (L')$ $ = k*|L'|$  (since $k$
edges from each vertex in $L$)
\item number of edges between $L'$ and $N (L')$ $ \leq k* |N (L')|$
(since $k$ edges from each vertex in $N (L')$)

\item Implies $|L'| \leq |N (L')|$

\end{itemize}

\end{SLIDE}

\begin{SLIDE}[Proof of Hall's Theorem]

We will now prove Hall's Theorem:

Let $G= (L,R)$ be a bipartite graph.  Then

\begin{itemize}
\item There is a perfect matching for $G$
\end{itemize}

if and only if

\begin{itemize}
\item $\forall L' \subseteq L$, $|L'| \leq |N (L')|$
\end{itemize}

where $|X|$ is the number of vertices in the set $X$ and $N (X)$ is
the set of neighbors of the set $X$.
\end{SLIDE}


\begin{SLIDE}[Proof of Hall's Theorem]

Easy direction:

If 

\begin{itemize}
\item there is a perfect matching for $G$,
\end{itemize}

then

\begin{itemize}
\item $\forall L' \subseteq L$, $|L'| \leq |N (L')|$
\end{itemize}

\end{SLIDE}


\begin{SLIDE}[Easy Direction]

if 
\begin{itemize}
\item there is a perfect matching for $G$,
\end{itemize}

then

\begin{itemize}
\item $\forall L' \subseteq L$, $|L'| \leq |N (L')|$
\end{itemize}

Proof:

Assume there is a matching and that there is some set $L'$ such that
$|L'| > |N (L')|$.  We know that every vertex in $L'$ must be matched
in the matching, hence we know that $N (L')$ contains at least $|L'|$
neighbors.  This is a contradiction since we assumed that $|L'| > |N
(L')|$.

\end{SLIDE}

\begin{SLIDE}[Hard Direction]

If

\begin{itemize}
\item $\forall L' \subseteq L$, $|L'| \leq |N (L')|$
\end{itemize}

then

\begin{itemize}
\item there is a perfect matching for $G$,
\end{itemize}

\end{SLIDE}


\begin{SLIDE}[Proof of Hall's]

To show: If for some graph $G= (L,R)$, $\forall L' \subseteq L$, $|L'|
\leq |N (L')|$ then there is a perfect matching for $G$.

We will say that a graph is ``slack'' if it's the case that $\forall
L' \subset L$, $|L'| \leq |N (L')| - 1$

Proof:\\

We will prove this by strong induction on the number of vertices in $L$.

Base case: If there is a single vertex the statement holds trivially. 

\end{SLIDE}

\begin{SLIDE}[Inductive Step]

Inductive Step: 

Case 1: The graph is slack.\\

Let $l$ be some vertex in $L$, we know that $l$ has some neighbor in
$R$, let $r$ be one of those neighbors.  Let $G'$ be the graph $G$
with the vertices $l$ and $r$ removed.  Since $G$ is slack, $G'$
satisfies Hall's condition (any subset of vertices on the left side of
$G'$ has a number of neighbors at least as large as the set).  Thus,
by the inductive hypothesis, there is a perfect matching for $G'$.  If
we add to this matching the edge between $l$ and $r$, we then have a
perfect matching for $G$.

\end{SLIDE}


\begin{SLIDE}[Proof of Hall's]

Case 2: The graph is not slack.\\

In this case, there is some subset, $L'$, of $L$ such that $|L'| = |N
(L')|$ (and $L' \neq L$).  Since $|L'| < |L|$, and Hall's condition
holds for the vertices in this set, we can use the inductive
hypothesis to say there is a perfect matching for the vertices of
$L'$.

Now let $X = L - L'$, and let $Y=R-N (L')$.  We will now show that the
condition for Hall's theorem holds for the graph $(X,Y)$.  Consider
any $X' \subseteq X$.  We will show that the set of neighbors of $X'$
which are in $Y$ is at least as large as the number of vertices in
$X'$.
\end{SLIDE}

\begin{SLIDE}[Proof of Hall's]
\ifig{Hall}
\end{SLIDE}


\begin{SLIDE}[Inductive Hypothesis]

For any bipartite graph $ H = (A,B)$ where $|A|<|L|$,

if
\begin{itemize}
\item $\forall A' \subseteq A, |A'| \leq |N (A')|$
\end{itemize}
then 
\begin{itemize}
\item there is a perfect matching for $H$.
\end{itemize}

\end{SLIDE}


\begin{SLIDE}[Proof of Hall's]
\ifig{Hall2}
\end{SLIDE}


\begin{SLIDE}[Proof of Hall's]

We know that for any $X'$ which is a subset of $X$:
\[
|X' \cup L'| \leq  |N (X' \cup L')|  
\]

and we know that:

\[
N (X' \cup L') = N (L') \cup (N (X') \cap Y)
\]

We also know by assumption (since the graph was not slack) that:

\[
|L'| = |N (L')|
\]

\end{SLIDE}

\begin{SLIDE}[Proof of Hall's]

For any $X' \subseteq X$, the following holds:

\begin{eqnarray}
|X'| + |L'| &	= &	|X' \cup L'| \\
&	\leq &	|N (X' \cup L')| \\
&	= &	||N (L') \cup (N (X') \cap Y) | \\
&	= &	|N (L')| + |(N (X') \cap Y)| \\
&	= &	|L'| + |(N (X') \cap Y)| 
\end{eqnarray}

Cancelling $|L'|$ from the first and last equation then gives that
$|X'| \leq |N (X') \cap Y|$.  So Hall's condition holds for the graph
$(X,Y)$, which means by the i.h. that there is a perfect matching of
$X$ which uses only vertices in $Y$.  Combining this with the perfect
matching of $L'$ which uses vertices in $N (L')$ gives a perfect
matching of all vertices in $L$.
\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 Theorem}: A Matching M is maximum for $G$ if and only if the graph
contains no $M$-augmenting chains.

\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}[Direct Migration]
Input: A demand graph $G$ with degree $\Delta $ \\

Output: A migration plan taking $3/2\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}

\end{document}
