\documentclass[11pt]{article}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{url}


\setlength{\parindent}{0pt}
\setlength{\parskip}{8pt}

\title{CS140 - Example NP Complete reduction}
\author{}
\date{}

\begin{document}

\maketitle
  
  
Show that {\sc Clique} is NP-Complete. (Given a graph $G$ does the graph have a clique of size $k$.)

\begin{enumerate}
\item {\sc Clique} is in NP.

A solution for click is a set of vertices $V' \subseteq V$.  Check the following:

\begin{itemize}
\item[-] Check that $|V'| = k$
\item[-] For each pair of vertices $u, v \in V'$ check that $(u,v) \in E$.
\end{itemize}

There are $O(V^2)$ checks and each check is $O(V)$, so the overall run-time is $O(V^3)$.

\item To show that {\sc Clique} is NP-Hard we show: {\sc Independent-Set} $\leq_p$ {\sc Clique}.  

(We're assuming {\sc Independent-Set} is NP-Complete.)

 \begin{itemize}
 \item Reduction: given an instance $\langle G,k \rangle$ of {\sc
    Independent-Set}, we transform it into an instance of {\sc Clique},  $\langle G',k' \rangle$, as
    follows:
    \begin{itemize}
    \item Let $V' = V$, i.e., copy all of the vertices.
    \item For all pairs of vertices $u, v \in V$, if $(u, v) \notin E$, add an edge $(u,v)$ to $G'$, i.e., $E'$ will consist of all the edges \emph{not} in $G$.
    \item Set $k' = k$.
    \end{itemize}
  \item Reduction in polynomial time: The reduction takes time $O(V^2)$ to create $\langle G',k' \rangle$, which is polynomial wrt the original problem instance.
  \item ``yes'' $\leftrightarrow$ ``yes''
    \begin{itemize}
    \item ``yes'' for {\sc Independent-Set} $\rightarrow$ ``yes'' for {\sc
      Clique}

A ``yes'' for {\sc Independent-Set} means that there are $k$ vertices in $G$ such where no edge exists between these vertices.  In $G'$ these vertices will therefore be fully connected forming a clique of size $k$.
   \item ``yes'' for {\sc Clique} $\rightarrow$ ``yes'' for {\sc
      Independent-Set}
       
A ``yes'' for {\sc Clique} means there is a clique of 
	size $k$ in $G'$.  In $G$ these vertices will not have any edges between them, so they will represent an independent set.
    \end{itemize}
   \end{itemize}
\end{enumerate}

\end{document}
