Chapter 2
NP Completeness II
By
Sariel HarPeled
, September 17, 2007
Version: 1.02
2.1
MaxClique
Figure 2.1: A clique of size 4
inside a graph with 8 vertices.
We remind the reader, that a
clique
is a complete graph,
where every pair of vertices are connected by an edge. The
MaxClique
problem asks what is the largest clique appearing
as a subgraph of
G
. See Figure 2.1.
Problem:
MaxClique
Instance:
A graph
G
Question:
What is the largest number of nodes
in
G
forming a complete subgraph?
Note that
MaxClique
is an
optimization
problem, since the output of the algorithm is a number
and not just true
/
false.
The first natural question, is how to solve
MaxClique
.
A naive algorithm would work by
enumerating all subsets
S
⊆
V
(
G
), checking for each such subset
S
if it induces a clique in
G
(i.e.,
all pairs of vertices in
S
are connected by an edge of
G
). If so, we know that
G
S
is a clique, where
G
S
denotes the
induced subgraph
on
S
defined by
G
; that is, the graph formed by removing all
the vertices are not in
S
from
G
(in particular, only edges that have both endpoints in
S
appear in
G
S
). Finally, our algorithm would return the largest
S
encountered, such that
G
S
is a clique. The
running time of this algorithm is
O
2
n
n
2
as can be easily verified.
T IP
Suggestion 2.1.1
When solving any algorithmic problem, always try first to find a simple (or even
naive) solution. You can try optimizing it later, but even a naive solution might give you useful
insight into a problem structure and behavior.
This work is licensed under the Creative Commons AttributionNoncommercial 3.0 License. To view a copy of
this license, visit
http://creativecommons.org/licenses/bync/3.0/
or send a letter to Creative Commons,
171 Second Street, Suite 300, San Francisco, California, 94105, USA.
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
We will prove that
MaxClique
is
NPH
. Before dwelling into that, the simple algorithm
we devised for
MaxClique
shade some light on why intuitively it should be
NPH
: It does not
seem like there is any way of avoiding the brute force enumeration of all possible subsets of the
vertices of
G
. Thus, a problem is
NPH
or
NPC
,
intuitively
, if the only way we know
how to solve the problem is to use naive brute force enumeration of all relevant possibilities.
How to prove that a problem
X
is
NPH
?
Proving that a given problem
X
is
NPH
is
usually done in two steps. First, we pick a known
NPC
problem
A
. Next, we show how
to solve any instance of
A
in polynomial time, assuming that we are given a polynomial time
algorithm that solves
X
.
Proving that a problem
X
is
NPC
requires the additional burden of showing that is
in
NP
. Note, that only decision problems can be
NPC
, but optimization problems can
be
NPH
; namely, the set of
NPH
problems is much bigger than the set of
NPC
problems.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Viswanathan
 Algorithms, Computational complexity theory, vertices, independent set, NPcomplete, NPHard

Click to edit the document details