\input{template}
\input{macros}

\begin{document}
\lecture{23} {An example illustrating the LP duality based MST algorithm}{TAs}

In this note we illustrate the MST algorithm derived in the class using LP duality. 

\section{Relaxed LP for the MST of an undirected graph and its Dual}

The {\em relaxed} LP formulation (i.e. after removing the constraints $x_e\ integer, x_e \leq 1$ ) for the MST of a graph $G(V,E)$ is the following:
\begin{alignat*}{3}
&\text{min } & \sum_e c_e x_e &\\
&\text{s.t. } & \sum_{e \text{ crosses } \pi} x_e & \geq \#(\pi) - 1 & \quad &\forall \pi\\
&& x_e & \geq 0 & & \forall e \in E
\end{alignat*}
where \begin{itemize}
\item $c_e \geq 0$ is the weight of the edge $e \in E$
\item $\pi$ denotes a partition of the vertex set $V$ and can be represented as the set of disjoint subsets of the vertex set $V$, i.e. $\pi \equiv \{p_1, p_2, \ldots, p_k\}, p_i \subset V, \cup p_i = V, p_i \cap p_j = \phi$. $\#$ is the number of `parts' in $\pi$ i.e. $=k$
\item $e$ crosses $\pi$ means one end vertex of $e$ belongs to $p_i$ and other end belongs to $p_j, i \neq j$.
\end{itemize}
The dual LP is given by
\begin{alignat*}{3}
&\text{max } & \sum_e y_{\pi} & (\#(\pi)-1) \\
&\text{s.t. } & \sum_{e \text{ crosses } \pi} y_{\pi} & \leq c_e & \quad &\forall e \in E\\
&& y_{\pi} & \geq 0 & & \forall \pi
\end{alignat*}

\section{Formulations for an example graph}

Let us see the formulation for an example graph in figure \ref{fig1}(i).

\begin{figure}[!h] 
\centering
\includegraphics[width=4.0in]{illus1}
\caption{An example graph and intermediate steps of the algorithm}
\label{fig1}
\end{figure}

The relaxed primal LP is:
{\scriptsize
\begin{alignat*}{3}
&\text{min } & x_{ab} + 2x_{cd} + 3x_{ac} + 4x_{ad} & + 5x_{bc} \\
&\text{s.t. } 
 & x_{ab} + x_{cd} + x_{ac} + x_{ad} + x_{bc} & \geq 4 - 1 & \quad & \text{for } \pi=\{a,b,c,d\}\\
&&       x_{cd} + x_{ac} + x_{ad} + x_{bc} & \geq 3 - 1 & \quad & \text{for } \pi=\{ab,c,d\}\\
&& x_{ab} + x_{cd} + x_{ac}       + x_{bc} & \geq 3 - 1 & \quad & \text{for } \pi=\{ac,b,d\}\\
&& x_{ab} + x_{cd}       + x_{ad} + x_{bc} & \geq 3 - 1 & \quad & \text{for } \pi=\{ad,b,c\}\\
&& x_{ab} + x_{cd} + x_{ac} + x_{ad} + x_{bc} & \geq 3 - 1 & \quad & \text{for } \pi=\{bc,a,d\}\\
&& x_{ab} + x_{cd} + x_{ac} + x_{ad}       & \geq 3 - 1 & \quad & \text{for } \pi=\{bd,a,c\}\\
&& x_{ab}       + x_{ac} + x_{ad} + x_{bc} & \geq 3 - 1 & \quad & \text{for } \pi=\{cd,a,b\}\\
&&             x_{ac} + x_{ad} + x_{bc} & \geq 2 - 1 & \quad & \text{for } \pi=\{ab,cd\}\\
&& x_{ab} + x_{cd} + x_{ac}             & \geq 2 - 1 & \quad & \text{for } \pi=\{ac,bd\}\\
&& x_{ab} + x_{cd}       + x_{ad} + x_{bc} & \geq 2 - 1 & \quad & \text{for } \pi=\{ad,bc\}\\
&&       x_{cd} + x_{ac}       + x_{bc} & \geq 2 - 1 & \quad & \text{for } \pi=\{abc,d\}\\
&&       x_{cd}       + x_{ad}       & \geq 2 - 1 & \quad & \text{for } \pi=\{abd,c\}\\
&& x_{ab}                   + x_{bc} & \geq 2 - 1 & \quad & \text{for } \pi=\{acd,b\}\\
&& x_{ab}       + x_{ac} + x_{ad}       & \geq 2 - 1 & \quad & \text{for } \pi=\{bcd,a\}\\
&& x_e & \geq 0 & & \forall e = 1..5
\end{alignat*}
}
And the corresponding dual is

{\scriptsize
max \begin{multline*}
3y_{\{a,b,c,d\}} + 2y_{\{ab,c,d\}} + 2y_{\{ac,b,d\}} + 2y_{\{ad,b,c\}} + 2y_{\{bc,a,d\}} + 2y_{\{bd,a,c\}} + 2y_{\{cd,a,b\}} \\
+ y_{\{ab,cd\}} + y_{\{ac,bd\}} + y_{\{ad,bc\}} + y_{\{abc,d\}} + y_{\{abd,c\}} + y_{\{acd,b\}} + y_{\{bcd,a\}} \\
\end{multline*}
subj. to
\begin{align}
\scriptsize
e=ab: y_{\{a,b,c,d\}} + y_{\{ac,b,d\}} + y_{\{ad,b,c\}} + y_{\{bc,a,d\}} + y_{\{bd,a,c\}}
+ y_{\{cd,a,b\}} + y_{\{ac,bd\}} + y_{\{ad,bc\}} + y_{\{acd,b\}} + y_{\{bcd,a\}} &\leq 1
\label{dc1} \\
e=cd: y_{\{a,b,c,d\}} + y_{\{ab,c,d\}} + y_{\{ac,b,d\}} + y_{\{ad,b,c\}} + y_{\{bc,a,d\}}
+ y_{\{bd,a,c\}} + y_{\{ac,bd\}} + y_{\{ad,bc\}} + y_{\{abc,d\}} + y_{\{abd,c\}} &\leq 2
\label{dc2} \\
e=ac: y_{\{a,b,c,d\}} + y_{\{ab,c,d\}} + y_{\{ac,b,d\}} + y_{\{bc,a,d\}} + y_{\{bd,a,c\}}
+ y_{\{cd,a,b\}} + y_{\{ab,cd\}} + y_{\{ac,bd\}} + y_{\{abc,d\}} + y_{\{bcd,a\}} &\leq 3
\label{dc3} \\
e=ad: y_{\{a,b,c,d\}} + y_{\{ab,c,d\}} + y_{\{ad,b,c\}} + y_{\{bc,a,d\}} + y_{\{bd,a,c\}}
+ y_{\{cd,a,b\}} + y_{\{ab,cd\}} + y_{\{ad,bc\}} + y_{\{abd,c\}} + y_{\{bcd,a\}} &\leq 4
\label{dc4} \\
e=bc: y_{\{a,b,c,d\}} + y_{\{ab,c,d\}} + y_{\{ac,b,d\}} + y_{\{ad,b,c\}} + y_{\{bc,a,d\}}
+ y_{\{cd,a,b\}} + y_{\{ab,cd\}} + y_{\{ad,bc\}} + y_{\{abc,d\}} + y_{\{acd,b\}} &\leq 5
\label{dc5} \\
\forall \pi \quad \quad y_{\pi} & \geq 0 
\end{align}
}

\section{The primal-dual algorithm}

The algorithm that we designed is the following:

\begin{algorithm}
\caption{MST algorithm developed using LP duality}
\label{mstlpd}
\begin{algorithmic}[0]
\State Initialize all $y_{\pi} \leftarrow 0$
\State Set $i \leftarrow 0, \pi_0 \leftarrow $ the partition in which each vertex is a part by itself
\Repeat
\State Raise $y_{\pi_i}$ until dual constraint corresponding to some edge $e$ becomes tight
\State Set $x_e \leftarrow 1$
\State Set $\pi_{i+1} \leftarrow $ the partition got from $\pi_i$ by merging end points of $e$ 
\State Set $i \leftarrow i+1$
\Until{edges with $x_e=1$ forms a spanning tree}
\end{algorithmic}
\end{algorithm}

Let us apply the technique on the example graph in figure \ref{fig1}(i). Intermediate steps of the algorithm \ref{mstlpd} on this instance are given in table \ref{table1}. Initially all $y_{\pi}=0$. This corresponds to figure \ref{fig1}(ii).

\begin{table}[h!]
\centering
\begin{tabular}{|l|c|c|c|}
\hline
Property $\backslash$ Iteration & $1^{st}$ & $2^{nd}$ & $3^{rd}$ \\
\hline
\hline
$\pi$ considered& $\{a,b,c,d\}$ & $\{ab,c,d\}$ & $\{ab,cd\}$ \\
\hline
[constraint involved, & [\eqref{dc1},1], [\eqref{dc2},2], [\eqref{dc3},3] & [\eqref{dc2},2-1], [\eqref{dc3},3-1], & [\eqref{dc3},3-1-1], [\eqref{dc4},4-1-1] \\
max raise in $y_{\pi}$ possible] & [\eqref{dc4},4], [\eqref{dc5},5] & [\eqref{dc4},4-1],[\eqref{dc5},5-1] & [\eqref{dc5},5-1-1] \\
\hline
constraint tightens first ie & \eqref{dc1} & \eqref{dc2} & \eqref{dc3} \\
for which max raise is min & & & \\
\hline
$y_{\pi}$ raised & $y_{\{a,b,c,d\}}=1$ & $y_{\{ab,c,d\}}=2-1=1$ & $y_{\{ab,cd\}}=3-1-1=1$\\
\hline
$x_e$ set & $x_{ab}=1$ & $x_{cd}=1$ & $x_{ac}=1$ \\
\hline
Vertices of $e$ & $a,b$ & $c,d$ & $a,c$ \\
\hline
New $\pi$ & $\{ab,c,d\}$ & $\{ab,cd\}$ & $\{abcd\}$, MST found \\
\hline
Sub-figure no. & (iii)  & (iv) & (v) \\
\hline
\end{tabular}
\caption{Trace of the primal-dual algorithm on the example graph}
\label{table1}
\end{table}

\end{document}

