\documentclass[11pt]{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning,chains,fit,shapes,calc}

\usepackage{graphicx}
\DeclareMathOperator*{\E}{\mathbb{E}}
\DeclareMathOperator*{\F}{\mathbb{F}}
\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} }
      \textcolor{red}{\textbf{NOTE:} THESE NOTES HAVE NOT BEEN EDITED OR CHECKED FOR CORRECTNESS}
    }
  }
  \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}
\definecolor{myblue}{RGB}{80,80,160}
\definecolor{mygreen}{RGB}{80,160,80}

\lecture{21 --- Nov. 14, 2017}{Fall 2017}{Prof.\ Eric Price}{Ethan Arnold, Yanyao Shen}

\section{Overview}

In the last lecture, we discussed spectral graph sparsification. In this lecture, we turn to the problem of computing edge connectivity in DAGs.

\section{Edge Connectivity}

In a directed graph, the $s$-$t$ edge connectivity is the maximum number of edge-disjoint paths from $s$ to $t$. This is equal to the $s$-$t$ min-cut, as well as the $s$-$t$ max flow. Thus, we can compute the $s$-$t$ edge connectivity in a general graph in $O(m^2 n)$ time using Ford-Fulkerson. We will consider the more specific problem of computing edge connectivity in a directed acyclic graph with maximum degree $d$. Cheung, Lau, and Leung give an $O(md^{1.38})$-time algorithm in \cite{CLL}. (This is the same as the time to multiply an $m \times d$ matrix by a $d \times m$ matrix.)

For this problem, we turn to network coding.

\section{Network Coding}

Suppose node $s$ (source) wants to communicate a long message to node $t$ (target) in a communication network, where no nodes are aware of the global graph structure. For now, we consider any directed graph (i.e., the network may have cycles). Each directed edge may send one ``packet'' of information at each time step, and all the edges send information at the same time during a time step. We will assume that the packets are relatively large and may include some sequence number if we care about the order of packets; henceforth we only care that after some time $t$ knows all the packets that $s$ wanted to communicate, and not the order in which they arrived.

Concretely, $s$ has $k$ messages that it wants to send. Each of these messages is an element of $\F_q^{\ell}$, where $q$ and $\ell$ are reasonably large. (Recall that $\F_q$ is the finite field with $q$ elements, where $q$ is prime.)

Let packet size $\ell^{'} = \ell+k$, $m_i^{'} = (e_i | m_i)$, where $e_i$ is the unit vector in $\mathbb{F}_q^{\ell}$. Now, $m_1^{'}, m_2^{'}, \cdots, m_k^{'}$ are linearly independent. This guarantees that we can recover the original vectors exactly through Gram-Shmidt decomposition. Now, let
$$
z = \left( \begin{bmatrix}
1 &0  &0 &m_1\\ 
0 & \ddots & 0& \vdots\\ 
0 & 0 & 1 & m_k
\end{bmatrix} \right)
$$
and the source $s$ knows  $span(z) \subset \mathbb{F}_q^{\ell+k}$. 
At each time step, any vertex $v$ knows subspace $X_v\subset \mathbb{F}_q^{\ell^{'}}$ ($X_v = \{0\}, \forall v\neq s$  to start with). At every time step, on every edge $(u,v)$, $u$ picks a random vector $w\in X_u$ and sends it to $v$. Any $v$ that receives $(w_1,\cdots, w_d)$ from neighbors, sets $X_v \leftarrow span(X_v, w_1,\cdots, w_d)$. 


\begin{definition}
Let $Y_v= X_v^{\perp} = \{w\in \mathbb{F}_q^{\ell^{'}} | \langle w, w^{'}\rangle=0, \forall w^{'} \in X_v\}$.  Say $v$ is ``aware'' of $w$ if $w\notin Y_v$. 
\end{definition}
The goal of the algorithm is that, at the end, $t$ is aware of everything $s$ is aware of.

\begin{claim}
If $u$ is aware of $w$, $v$ is not aware of $w$ at a given time step, and $u$ sends message to $v$. Then, 
$$
\Pr [\mbox{$v$ is unaware of $w$ in the next round}] \le \frac{1}{q}.
$$
\end{claim}
This result is straightforward since in order for $v$ to be unaware of $w$ in the next round, the coefficient for $w$ in the random vector should be $0$. For field $\mathbb{F}_q^{\ell^{'}}$, this probability is $1/q$.

On any length $L$ path, any $w$ that $s$ is aware of,
\begin{align*}
& \Pr[\mbox{$t$ unaware of $w$ after $R$ rounds}] \\
\le & \Pr[\mbox{awareness fails to move forward $\ge r$ times}] \\
\le & {{L+r}\choose{r}} \frac{1}{q^r} \\
\le & \left(\frac{e(1+\frac{L}{r})}{q}\right)^r
\end{align*}
where $R = L+r$. Therefore, after $R$ rounds, if $|C_{s,t}|=\mbox{minimum $s\rightarrow t$ cut size}$,
$$
\Pr[\mbox{chance that $t$ is unaware of $w$}] \le \left(\frac{e(1+\frac{n}{r})}{q}\right)^{|C_{s,t}|r} \lesssim q^{-|C_{s,t}|R(1-\epsilon)}
$$
if $q\ge 2^{1/\epsilon}, R\ge n/\epsilon$.

If $t$ is aware of all $w\in X_s, w\neq 0$, then $X_t$ must be $X_s$. Since $|X_t| = q^k$, $X_t = X_s$ w.h.p. after 
$$
q^k \cdot q^{-R|C_{s,t}|(1-O(\epsilon))}=o(1).
$$ 
Since $q$ is large, we only need the LHS in the above equation to be less than $\frac{1}{q}$, which gives the sufficient condition:
\begin{equation*}
k<R|C_{s,t}|(1-O(\epsilon)) - 1
\end{equation*}
On the other hand, we know that the capacity of the network requires the possible number of messages to be sent satisfies
\begin{equation*}
k \le R\cdot \frac{\ell^{'}}{l} |C_{s,t}| = R\cdot |C_{s,t}| (1+\epsilon) \triangleq \mathrm{OPT}
\end{equation*}
This is saying that the randomized network coding algorithm succeeds as long as $k\le (1-O(\epsilon))\cdot \mathrm{OPT}$.  

\section{Applying network coding to edge connectivity}

First, we will aim for $O(md^2)$ time to find the edge connectivity in a DAG. Later, we will improve this to $O(md^{1.38})$. We will consider the nodes in topological order (this can be computed in $O(m)$ time), and we will simulate a single round of ``knowledge propagation'' as described in the previous section.

After simulating one round of communication (every edge sends exactly one message), we output $\dim X_t$, and we hope that this is equal to $|C_{s,t}|$ (as this is what we are trying to compute). Clearly, $\dim X_t \leq |C_{s,t}|$, because $|C_{s,t}|$ is a bound on the amount of communication that could have been transmitted from $s$ to $t$. We would like to show that the probability that $\dim X_t < |C_{s,t}|$ is not too large.

To do this, we first consider the probability that the awareness of a particular vector $w$ is transmitted from $s$ to $t$ along a particular path. This is at least
\begin{equation*}
(1 - \frac{1}{q})^n \geq 1 - \frac{n}{q}.
\end{equation*}
Thus, the probability that awareness of $w$ is transmitted along any path is at least
\begin{equation*}
1 - (\frac{n}{q})^{|C_{s,t}|} = 1 - q^{-|C_{s,t}|(1 - \log_q n)}.
\end{equation*}
Note that the number of vectors $w$ that $t$ is unaware of at the end is equal to
\begin{equation*}
q^{|X_t^\perp|} = q^{d-\dim X_t},
\end{equation*}
and the expected value of this quantity is
\begin{equation*}
q^{d-|C_{s,t}|(1 - \log_q n)}.
\end{equation*}
Thus, by Markov's inequality, we have that the number of vectors $w$ that $t$ is unaware of is at most
\begin{equation*}
q^{d-|C_{s,t}|(1 - \log_q n) + 1/2},
\end{equation*}
with high probability, and so with high probability it is also the case that
\begin{equation*}
\dim X_t \geq |C_{s,t}|(1 - \log_q n) - 1/2.
\end{equation*}

To learn $|C_{s,t}|$ exactly, we may set $q > n^{2d}$, or for an approximation of $|C_{s,t}|$ we may use a smaller value of $q$.

We have established that with high probability we obtain the correct edge connectivity value, so all that is left is to consider the time complexity. We transmit a vector $m$ times, and each vector is a random linear combination of known vectors. We can generate the coefficients and compute the vector to transmit in $O(d^2)$ time. Upon receiving a vector from a neighbor, we simply orthogonalize it with respect to the already-known vectors of the current node, which takes $O(d^2)$ time.

Since we repeat this process for every edge, we have a total of $O(md^2)$ time to compute edge connectivity with high probability.

To achieve $O(md^{1.38})$ time, we can reduce all of these operations to matrix operations. We can batch the operations at every node, so that we orthogonalize all the incoming messages at the same time.

\bibliographystyle{alpha}

\begin{thebibliography}{42}

% \bibitem[1]{BM}
% Birnbaum, Benjamin, and Claire Mathieu. 
% \newblock {\em On-line bipartite matching made simple.}
% \newblock ACM SIGACT News 39.1 (2008): 80-87.

\bibitem[1]{CLL}
Cheng, Lau, and Leung.
\newblock {\em Graph Connectivities, Network Coding, and Expander Graphs.}
\newblock 2011 IEEE 52nd Annual Symposium on Foundations of Computer Science (FOCS)

% \bibitem[2]{KVV}
% Karp, Richard M., Umesh V. Vazirani, and Vijay V. Vazirani. 
% \newblock {\em An optimal algorithm for on-line bipartite matching.}
% \newblock Proceedings of the twenty-second annual ACM symposium on Theory of computing. ACM, 1990.

\end{thebibliography}

\end{document}