NP Completeness II
, September 17, 2007
Figure 2.1: A clique of size 4
inside a graph with 8 vertices.
We remind the reader, that a
is a complete graph,
where every pair of vertices are connected by an edge. The
problem asks what is the largest clique appearing
as a subgraph of
. See Figure 2.1.
What is the largest number of nodes
forming a complete subgraph?
problem, since the output of the algorithm is a number
and not just true
The ﬁrst natural question, is how to solve
. A naive algorithm would work by
enumerating all subsets
), checking for each such subset
if it induces a clique in
all pairs of vertices in
are connected by an edge of
). If so, we know that
is a clique, where
; that is, the graph formed by removing all
the vertices are not in
(in particular, only edges that have both endpoints in
). Finally, our algorithm would return the largest
encountered, such that
is a clique. The
running time of this algorithm is
as can be easily veriﬁed.
When solving any algorithmic problem, always try ﬁrst to ﬁnd 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 Attribution-Noncommercial 3.0 License. To view a copy of
this license, visit
or send a letter to Creative Commons,
171 Second Street, Suite 300, San Francisco, California, 94105, USA.