NP-Completeness
Graph Theory
Clique Problem
Independent Set
Computational Complexity

Prove NP-Completeness clique independent set graph

Data Structures & Algorithms practice on Codemia

Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.

Practice algorithms

In the realm of computational complexity theory, two prominent problems that play a pivotal role are the Clique and the Independent Set problems. These problems are exemplary in showcasing the intricate nature of NP-Completeness. In this comprehensive exposition, we will delve into the proof of NP-Completeness for the Clique and Independent Set problems, elucidating their significance and interrelation.

Understanding the Basics

Graph Terminology

Before delving into the technical proofs, it's crucial to familiarize ourselves with some key graph-theory terminologies:

  • Graph: A collection of vertices (or nodes) connected by edges.
  • Clique: A subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent.
  • Independent Set: A subset of vertices in a graph, no two of which are adjacent.

NP-Completeness

A decision problem is said to be in NP (Nondeterministic Polynomial time) if, given a "yes" instance, there exists a certificate verifiable in polynomial time. A problem is NP-Complete if it is both in NP and as hard as any problem in NP, meaning any NP problem can be transformed into it in polynomial time.

The Clique Problem

Problem Definition

For a given graph G=(V,E)G = (V, E) and a positive integer kVk \leq |V|, does there exist a subset CVC \subseteq V such that Ck|C| \geq k and every pair of vertices in CC is connected by an edge in EE?

Proving NP-Completeness

Verification

The Clique problem belongs to NP because, given a subset of vertices, one can verify in polynomial time whether all pairs of vertices in this subset are adjacent.

Polynomial Time Reduction

To demonstrate NP-Completeness, we prove that the Clique problem is at least as hard as any other problem in NP. We achieve this by performing a polynomial time reduction from a known NP-Complete problem, such as the 3-SAT problem, to the Clique problem:

  1. Start with a 3-SAT instance: A conjunction of clauses, each having three literals.
  2. Construct a graph for the Clique problem:
    • For every clause in the 3-SAT instance, create a set of vertices for the literals within it.
    • Add edges between vertices corresponding to non-contradictory literals from different clauses.
  3. Transformation and Clique Identification:
    • A k-clique in this graph corresponds to a satisfying assignment of the 3-SAT problem, where kk is the number of clauses.

The above transformation can clearly be executed in polynomial time, and therefore, the Clique problem is NP-Complete.

The Independent Set Problem

Problem Definition

Given a graph G=(V,E)G = (V, E) and a positive integer kVk \leq |V|, determine if there exists a subset IVI \subseteq V such that Ik|I| \geq k and no two vertices in II are connected by an edge in EE.

Proving NP-Completeness

Verification

The Independent Set problem is in NP because, given a subset of vertices, it's feasible to verify in polynomial time that no two vertices within the subset are connected by an edge.

Mathematical Connection and Reduction

A fundamental property is that any independent set in a graph GG is a clique in its complement graph G\overline{G}, wherein an edge exists between vertices if and only if they are not connected in GG.

Establishing Completeness

  • Reduction can be illustrated by mapping a Clique problem instance to an Independent Set problem:
    1. Transform the graph: Given graph GG, construct its complement G\overline{G}.
    2. Equivalence: A kk-clique in GG corresponds to a kk-independent set in G\overline{G}. This reduction implies that finding a clique in the graph involves finding an independent set in the complement graph, thus exhibiting the NP-Completeness nature of the Independent Set problem.

Key Points Summary

ComponentClique ProblemIndependent Set Problem
Problem DefinitionSubset of vertices all pairs adjacentSubset of vertices no pairs adjacent
VerificationVerify subset adjacency in polynomial timeVerify no edges between vertices in polynomial time
Reduction Strategy3-SAT to CliqueClique to Independent Set
Complementarity-Clique in GG ↔ Independent Set in G\overline{G}

Conclusion

The Clique and Independent Set problems epitomize the profound challenges of NP-Complete problems. Understanding these problems not only sheds light on the complexity class NP itself but also enhances our grasp of graph theory's role in computational complexity. Through rigorous polynomial-time reductions and leveraging mathematical connections, we firmly establish both as NP-Complete, enriching the landscape of computational problem-solving.


Related reading
Course
Intermediate
27 lessons
15 hours
DSA Fundamentals

Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Data Structures & Algorithms practice on Codemia

Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.

Practice algorithms

All Rights Reserved.