\documentclass[11pt]{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{graphicx}
\usepackage{epstopdf}

\DeclareMathOperator*{\E}{\mathbb{E}}
\let\Pr\relax
\DeclareMathOperator*{\Pr}{\mathbb{P}}

\newcommand{\eps}{\epsilon}
\newcommand{\inprod}[1]{\left\langle #1 \right\rangle}
\newcommand{\R}{\mathbb{R}}

\newcommand{\handout}[5]{
	\noindent
	\begin{center}
		\framebox{
			\vbox{
				\hbox to 5.78in { {\bf CS 388R: Randomized Algorithms } \hfill #2 }
				\vspace{4mm}
				\hbox to 5.78in { {\Large \hfill #5  \hfill} }
				\vspace{2mm}
				\hbox to 5.78in { {\em #3 \hfill #4} }
			}
		}
	\end{center}
	\vspace*{4mm}
}

\newcommand{\lecture}[4]{\handout{#1}{#2}{#3}{Scribe: #4}{Lecture #1}}

\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{observation}[theorem]{Observation}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{assumption}[theorem]{Assumption}

% 1-inch margins, from fullpage.sty by H.Partl, Version 2, Dec. 15, 1988.
\topmargin 0pt
\advance \topmargin by -\headheight
\advance \topmargin by -\headsep
\textheight 8.9in
\oddsidemargin 0pt
\evensidemargin \oddsidemargin
\marginparwidth 0.5in
\textwidth 6.5in

\parindent 0in
\parskip 1.5ex

\begin{document}
	
	\lecture{12 --- Oct. 12, 2015}{Fall 2014}{Prof.\ Eric Price}{Qi Lei, Jiong Zhang}
	
	\section{Overview}
	
	In the last lecture we discussed Perfect Hashing and Bloom Filters.
	
	In this lecture we removed from hashing to routing, and we are going to use randomization to prove routing.
	
	\section{Introduction}
	Suppose we have some network, and can communicate to each other.\\ 
	For an arbitrary graph, what a reasonable model for a conversation to happen here?\\ 
	Suppose we have 
	\begin{itemize}
		\item	synchronous messages, and 
		\item each edge can transmit one message per time step
		\item	Sending k messages over a link takes k time.		
	\end{itemize}
	What is a proper problem to analyze?
	\begin{itemize}
		\item	If one node wants to communicate with other node, one just broadcasts to everyone.
		\item	What makes it hard is if multiple nodes want to send messages. However, if every node want to communicate with one same node, the bottleneck would happen there so it's not interesting either. 
	\end{itemize}
	That's why we want to discuss permutation routing:	 
	\section{Permutation Routing}
	Each node $i$ wants to send a message to $\Pi(i)\in [N]$, $\Pi(i)$ is a permutation.\\
	Question: how long does it take to route all messages?\\
	Ideally: oblivious routing:\\
	\begin{eqnarray*}
		&\text{Path for } i\rightarrow \Pi(i), ~~~~P \text{ is independent of } \Pi(-i) &\\
		& P_i=(e_1,\cdots,e_l)&\\
		& e_j \text{ is an edge: } l \text{ is length} &\\
	\end{eqnarray*}
	\subsection{Hypercube Graph}
	$N=2^n$: each vertex is indexed by $n$ bit string.\\
	edge $i$ to $j$ exists if $i$ and $j$ have exactly one bit difference.\\
	Diameter $n\Longrightarrow$ ideally $O(n)$ time to route.
	
	\begin{eqnarray*}
		\mathbb{E}[\text{distance between }i\text{ and }\Pi(i)]&=&\frac{n}{2}\\
		\mathbb{E}[\text{total number of messages passed}]&\geq &\frac{Nn}{2}
	\end{eqnarray*}
	\begin{figure}[!t]
		\centering
		\includegraphics[width=0.5\linewidth]{hypercubes.eps}
		\caption{"hypercubes" for $n=0,1,2,3$}
	\end{figure}
	{\centering
		can hope for $N$ messages/round\\
		so hope for $O(n)$ rounds.\\
	}
	Bit fixing routing(an naive thing to do):\\
	fix bits left to right\\
	\begin{eqnarray*}
		&\Pi( 0 1 0 1 1 0 1)= & 1 1 0 1 1 1 0\\
		\downarrow & 1 1 0 1 1 0 1~&\\
		\downarrow & 1 1 0 1 1 1 1~&\\
		\downarrow & 1 1 0 1 1 1 0~&
	\end{eqnarray*}
	However, $\exists$ permutations such that bit fixing takes $\Omega(\sqrt{N})$ time steps.
	\begin{eqnarray*}
		\overbrace{X}^{\lfloor n/2\rfloor} & 0& \overbrace{0 0\cdots 0}^{\lfloor n/2\rfloor}\\
		0 0 \cdots 0 & 1& ~~ X
	\end{eqnarray*}
	So after weight($X$) times of bit fixing, where weight$(X)=\sum_{i=1}^nX_i$, all the messages come to the same position 
	\begin{eqnarray*}
		\overbrace{00 \cdots 0}^{\lfloor n/2\rfloor} & 0& \overbrace{0 0\cdots 0}^{\lfloor n/2\rfloor},\text{  next step for every node goes to}\\ 
		00\cdots 0 & 1& 00\cdots 0, \text{and final destination is}\\
		0 0 \cdots 0 & 1& \underbrace{X}_{\lfloor n/2\rfloor}
	\end{eqnarray*}
	So for all $X$, the messengers will cross the same edge $e$ from $00\cdots 0$ to $\overbrace{00\cdots 0}^{\lfloor n/2\rfloor} 1 \overbrace{00\cdots 0}^{\lfloor n/2\rfloor}$. 
	There are $2^{\lfloor n/2\rfloor}$ paths cross $e$, causing $\sqrt{N}$ time of queueing.\\
	Claim: for all deterministic oblivious algorithms, $\exists \Pi$ s.t. it takes $\Omega(\sqrt{\frac{N}{n}})$ times.\\
	
	\subsection{Randomized routing algorithm: $O(n)$ time}
	\begin{theorem}
		Part I: average case: bit fixing takes time $O(n)$ with $1-\frac{1}{N^c}$ prob for random $\Pi\in [N]^N$.	
	\end{theorem}
	\begin{theorem}
		Part II: $\forall n$, one can get $O(n)$ with probability $1-\frac{1}{N^c}$ for some routing algorithm.
	\end{theorem}
	
	{\sl Proof of Part I:}\\
	Suppose permutation $\Pi\in[N]^N$ uniformly at random.\\
	Define $L(e)$: load of edge $e$, i.e. $\#$ path using $e$.
	\begin{eqnarray*}
		&\because &\mathbb{E}[L(e)] \text{ are equal for different } e.\\
		&\text{and }&\mathbb{E}[\text{total length of all paths}]=\frac{Nn}{2}\\
		&\therefore& \mathbb{E}[L(e)]=\frac{\mathbb{E}[\text{total length}]}{\# \text{ edges}}=\frac{Nn/2}{Nn}=\frac{1}{2}.
	\end{eqnarray*}
	\begin{itemize}
		\item Concentration bound for load $L(e)$:\\
		Time for a path $p=e_1,e_2,\cdots,e_l\leq \sum_{i=1}^lL(e_i)$.
		$\mathbb{E}[T(i)]\leq \frac{n}{2}$.\\
		$\mathbb{E}[L(e)]=\frac{1}{2}$.\\
		$L(e)=\sum_{i\in [N]}H_{ie}$, where $H_{ie}$ stands for event $e\in P_i$. $H_{ie}$ are independent, bounded in $[0,1]$.
		\begin{enumerate}
			\item Chernoff:\\
			$Pr[L(e)>\frac{1}{2}+t]<e^{-\frac{2t^2}{N}}$\\
			This is a terrible bound as $t$ at least need to be comparable to $\sqrt{N}$ for a small probability. This is because Chernoff bound is not tight enough for event with small probability.\\
			\item  Bernstein:
			\begin{lemma}
				Let $X=\sum_iX_i, X_i\in[0,1]$, independent. $Pr[X\geq t]\leq 2^{-t}, \forall t\geq 2e\mathbb{E}[X]$.
				\label{lemma:Bern}
			\end{lemma}
			{\sl Proof of Lemma \ref{lemma:Bern}:}
			\begin{eqnarray*}
				& & \mathbb{E}[X_i]=p_i,  Var(X_i)=\mathbb{E}[X_i^2]-\mathbb{E}[X_i]^2\leq \mathbb{E}[X_i\cdot 1]-p_i^2=p_i(1-p_i)\leq p_i, \\
				&\Longrightarrow& X_i \text{ is }(\theta(p_i),\theta(1)) \text{ subgamma (in terms of } (\sigma^2,B)).\\
				&\Longrightarrow& X \text{ is }(\theta(\sum_ip_i),\theta(1))=(\theta(\mathbb{E}[X]),\theta(1)) \text{ subgamma.}\\
				& & Pr[X\geq \mu+t]\leq \max\{e^{-\frac{t^2}{\theta(\mathbb{E}[X])}},e^{-\theta(t)}\}, \mu=\mathbb{E}[X]\\
				& &\therefore \text{for }t>c\mu, Pr[X\geq t]\leq e^{-\theta(t)}
			\end{eqnarray*}
		\end{enumerate}
	\end{itemize}
	
	{\sl Continuing Proof of Part I:}
	\begin{eqnarray*}
		& & Pr[L(e)\geq t]\leq 2^{-t}, \forall t\geq e,\\
		&\Longrightarrow& Pr[L(e)\geq 3n]\leq \frac{1}{N^3}\\
		&\Longrightarrow& Pr[\max L(e)\geq 3n]\leq \frac{n}{N^2}<\frac{1}{N} \\
	\end{eqnarray*}
	Also, noticed that $l\leq n$, we have $\sum_{i=1}^lL(e_i)\leq3n^2$ with probability at least $1-\frac{n}{N^3}$, thus \\
	\begin{eqnarray*}
		& & Pr[\text{total time}\leq 3n^2]\geq 1-\frac{n}{N^2}\\ 
	\end{eqnarray*}
	which we are not satisfied with. So try another way. Instead of bound load, we bound colliding packets instead. Define\\
	\begin{eqnarray*}
		& & S_i=\{j|P_j\cup P_i\neq \emptyset\}\\ 
	\end{eqnarray*}
	\begin{lemma}
		Let $T_i$ be the time of path i,we have $T_i\leq n+|S_i|$.\\
		\label{lemma:Ti}
	\end{lemma}
	This lemma claims for path i,each intersecting path delays it for at most one time step.\\
	Given $\Pi$ random, for fixed $P_i$ we know that 
	$Pr[P_i\cap P_j\neq \emptyset] \text{ is independent of } Pr[P_i\cap P_k\neq \emptyset]$. Also\\
	\begin{eqnarray*}
		\mathbb{E}[|S_i|] &\leq& \mathbb{E}[\# (P_j, e\in P_j \text{ s.t. }e\in P_i)]\\
		&\leq&\mathbb{E}[\sum_{i=1}^l L'(e_i)]\\
		&=&\frac{l}{2}\leq\frac{n}{2}\\
	\end{eqnarray*}
	Note that this $L'(e)$ denotes the $\#$ of path that go through $e$ except for $P_i$.\\
	Therefore $\forall e, \mathbb{E}[L'(e)]\leq \frac{1}{2}$.\\
	Bounding $|S_i|$:\\
	\begin{eqnarray*}
		Pr[|S_i|\geq t] &\leq& 2^{-t}, \forall t\geq en.\\
		\Longrightarrow Pr[|S_i|\geq 4n] &\leq& \frac{1}{N^4}\\
	\end{eqnarray*}
	By Lemma. \ref{lemma:Ti} we have \\
	\begin{eqnarray*}
		Pr[T_i\leq 5n] &\geq& 1-\frac{1}{N^4}\\
		\Longrightarrow Pr[\max T_i\leq 5n] &\geq& 1-\frac{1}{N^3}\\
	\end{eqnarray*}
	\hfill $\Box$ of part I.
	
	{\sl Proof of Part II:}\\
	The problem here is we don't get random $\Pi$ anymore, we will retrieve the randomness by randomly picking a mid-state. Note that the routing process is reversible.
	\begin{itemize}
		\item	Given $\Pi$ adversarial, for each node i choose $\sigma(i) \in[N]$ i.i.d;\\
		\item   Send $i \to \sigma(i)$, wait until 5n rounds are complete;\\
		\item   Send $\sigma(i) \to \Pi(i)$, wait until another 5n rounds are complete;\\
	\end{itemize}
	Thus the whole process success with prob $\geq 1-\frac{2}{N^3}$.\\
	
	\begin{thebibliography}{42}
		\bibitem[MR]{MR}
		Rajeev~Motwani, Prabhakar~Raghavan
		\newblock Randomized Algorithms.
		\newblock {\em Cambridge University Press}, 0-521-47465-5, 1995. %pub - isbn - year
	\end{thebibliography}
	
\end{document}
