\input{template}
\input{macros}
\begin{document}
\lecture{23}{Primal-dual algorithm for MST (contd..)}{Mahak Patidar}

\section{A brief recap of last lecture}


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_{\pi} 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{The algorithm for MST}
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}

We start with any feasible solution for the dual LP and maintain feasibility in both primal and dual LP's. In each iteration, we try to improve the dual solution. For this, we raise the value of the dual variables one by one. If a constraint becomes tight for an edge we donot raise the dual variable for partitions which this edge crosses. Note that implicitly  we are doing what problem 2 in Quiz 2 dictates.\\
\\
After each iteration, we take the edges for which the constraints are equalities. If this set of edges yield a connected graph, we are done. A spanning tree will yield a primal feasible solution. Note the use of complementary slackness.
\\
We essentially start with zero partition (i.e. an empty tree initially) and add edges as we go along until dual constraint corresponding to some edge e becomes tight. We then include e into our solution by setting $x_e = 1$ and partition is updated by merging end points of $e$. The algorithm terminates with a spanning tree having edges with $x_e = 1$ of the input graph.



\section{Proof of optimality}

We can prove that the above algorithm gives optimum solution by proving that cost of primal and
dual are same and they both are feasible.\\
\\Cost of primal is given by:
\begin{alignat*}{4}
&& \sum_{e } c_e & \quad \text{ where e is chosen by the algorithm}&&\\
& \text{ = } & \sum_{e} & \sum_{\substack{\pi \\ \text{ e crosses } \pi}}
y_{\pi} &&\\
& \text{ = } & \sum_{\pi} & \sum_{\substack{e \\ \text{ e crosses } \pi}}
y_{\pi} &&\\
& \text{ = } & \sum_{\pi} y_{\pi} &\sum_{e \text{ crosses } \pi} 1 &&\\
& \text{ = } & \sum_{\pi} y_{\pi} & \text{ (} \# \text{ of edges chosen
which crosses }
	\pi \text{)} &&\\
&&& \hspace{20 mm} \Downarrow &\\
&&& \hspace{15 mm} (\#(\pi) - 1) \leftarrow  \text{where } y_{\pi} > \text{ 0} &\\
\end{alignat*}

This is exactly the cost of the dual. So we have proved that the cost of primal is same as the cost of the dual
$\implies$ both of them are optimal











\section{Some comments and observations}
\begin{itemize}
\item Optimality can be proved by using complimentary slackness
\item This LP has an integral solution which is optimal
\item Number of constraints is exponential(becaouse number of partitions is exponential)
\item The edges which become tight are in increasing order of weights
\end{itemize}
\section{Exercises}
\begin{itemize}
\item Run the algoritm with ${\pi}$ restricted to 2. Manipulate the dual variables so that you end up with Kruskal's algorithm. Apply the above proof of correctness, you will get struck.
\item $\forall$ n, find an example where optimum of the LP is less than the weight of the minimum spanning tree.
\item Prove that if we add a new constraint 
\begin{alignat*}{3}
\sum x_e = n-1, 
\end{alignat*}
there exist an integral solution to the LP
\item Observe that the way we choose $y_{\pi}$ corresponds to the last problem of quiz 2.
\end {itemize}
\end{document}
