The Wayback Machine - https://web.archive.org/web/20241029004622/https://www.geeksforgeeks.org/proof-that-clique-decision-problem-is-np-complete-set-2/
Open In App

Proof that Clique Decision problem is NP-Complete | Set 2

Last Updated : 01 Jul, 2020
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow
Prerequisite: NP-Completeness, Clique problem. A clique in a graph is a set of vertices where each vertex shares an edge with every other vertex. Thus, a clique in a graph is a subgraph which is a complete graph. Problem: Given a graph G(V, E) and an integer K, the problem is to determine if the graph contains a clique of size K. Explanation: An instance of the problem is an input specified to the problem. An instance of the Clique problem is a graph G (V, E) and a positive integer K, and the problem is to check whether a clique of size K exists in G. Since an NP-Complete problem, by definition, is a problem which is both in NP and NP-hard, the proof for the statement that a problem is NP-Complete consists of two parts:
  1. The problem itself is in NP class
  2. All other problems in NP class can be polynomial-time reducible to that. (B is polynomial-time reducible to C is denoted as B$\leqslant_P$C)
If the 2nd condition is only satisfied then the problem is called NP-Hard. But it is not possible to reduce every NP problem into another NP problem to show its NP-Completeness all the time. That is why if we want to show a problem is NP-Complete we just show that the problem is in NP and any NP-Complete problem is reducible to that, then we are done, i.e. if B is NP-Complete and B$\leqslant_P$C for C in NP, then C is NP-Complete. In this article, we will prove that the Clique Detection Problem is NP-Complete by the help of Independent Set problem, which is NP-Complete. Refer to Proof that Clique Decision problem is NP-Complete, for the proof with the help of Boolean Satisfiability Problem.
  1. Clique Problem is in NP If any problem is in NP, then, given a ‘certificate’, which is a solution to the problem and an instance of the problem (a graph G and a positive integer K, in this case), we will be able to verify (check whether the solution given is correct or not) the certificate in polynomial time. The certificate is a subset V’ of the vertices, which comprises the vertices belonging to the clique. We can validate this solution by checking that each pair of vertices belonging to the solution are adjacent, by simply verifying that they share an edge with each other. This can be done in polynomial time, that is O(V +E) using the following strategy for graph G(V, E):
    flag=true
    For every pair {u, v} in the subset V’:
        Check that these two
             vertices {u, v} share an edge
        If there is no edge,
          set flag to false and break
    If flag is true:
        Solution is correct
    Else:
        Solution is incorrect 
    
  2. Clique Problem is NP-Hard To prove that the clique problem is NP-Hard, we take the help of a problem that is already NP-Hard and show that this problem can be reduced to the Clique problem. For this, we consider the Independent Set problem, which is NP-Complete (and hence NP-Hard). Every instance of the independent set problem consisting of the graph G (V, E) and an integer K can be converted to the required graph G’ (V’, E’) and K’ of the Clique problem. We will construct the graph G’ by the following modifications: V’ =V, that is all the vertices of graph G are a part of the graph G’ E’ = complement of the edges E, that is, the edges not present in the original graph G. The graph G’ is the complementary graph of G. The time required to compute the complementary graph G’ requires a traversal over all the vertices and edges. Time complexity: O (V+E) We will now prove that the problem of computing the clique indeed boils down to the computation of the independent set. The reduction can be proved by the following two propositions:
    • Let us assume that the graph G contains a clique of size K. The presence of clique implies that there are K vertices in G, where each of the vertices is connected by an edge with the remaining vertices. This further shows that since these edges are contained in G, therefore they can’t be present in G’. As a result, these K vertices are not adjacent to each other in G’ and hence form an Independent Set of size K.
    • We assume that the complementary graph G’ has an independent set of vertices of size K’. None of these vertices shares an edge with any other vertices. When we complement the graph to obtain G, these K vertices will share an edge and hence, become adjacent to each other. Therefore, the graph G will have a clique of size K.
Thus, we can say that there is a clique of size K in graph G if there is an independent set of size K in G’ (complement graph). Therefore, any instance of the clique problem can be reduced to an instance of the Independent Set problem. Thus, the clique problem is NP-Hard. Conclusion:
Hence, the Clique Decision problem is NP-Complete


Similar Reads

Proof that Clique Decision problem is NP-Complete
Prerequisite: NP-Completeness A clique is a subgraph of a graph such that all the vertices in this subgraph are connected with each other that is the subgraph is a complete graph. The Maximal Clique Problem is to find the maximum sized clique of a given graph G, that is a complete graph which is a subgraph of G and contains the maximum number of ve
4 min read
Prove that a problem consisting of Clique and Independent Set is NP Complete
Prerequisite: NP-Completeness, NP Class, Clique, Independent Set Problem: Given an undirected graph G = (V, E) and an integer K, determine if a clique of size K as well as an independent set (IS) of size K, exists. Demonstrate that it is an NP Complete. Explanation: A Clique is a subgraph of a graph in which all of the vertices are connected, formi
6 min read
Two Clique Problem (Check if Graph can be divided in two Cliques)
A Clique is a subgraph of graph such that all vertices in subgraph are completely connected with each other. Given a Graph, find if it can be divided into two Cliques. Examples: Input : G[][] = {{0, 1, 1, 0, 0}, {1, 0, 1, 1, 0}, {1, 1, 0, 0, 0}, {0, 1, 0, 0, 1}, {0, 0, 0, 1, 0}}; Output : Yes This problem looks tricky at first, but has a simple and
13 min read
Maximal Clique Problem | Recursive Solution
Given a small graph with N nodes and E edges, the task is to find the maximum clique in the given graph. A clique is a complete subgraph of a given graph. This means that all nodes in the said subgraph are directly connected to each other, or there is an edge between any two nodes in the subgraph. The maximal clique is the complete subgraph of a gi
14 min read
Proof that Subgraph Isomorphism problem is NP-Complete
Subgraph Isomorphism Problem: We have two undirected graphs G1 and G2. The problem is to check whether G1 is isomorphic to a subgraph of G2. Graph Isomorphism: Two graphs A and B are isomorphic to each other if they have the same number of vertices and edges, and the edge connectivity is retained. There is a bijection between the vertex sets of the
4 min read
Proof that Collinearity Problem is NP Complete
Problem: Given 3 points a, b, c, the task is to check if these three points are collinear. Explanation: An instance of the problem is an input specified to the problem. An instance of the collinearity problem is three points ((ax, ay), (bx, by), (cx, cy)). Since an NP-Complete is a problem which is both in NP and NP-hard, the proof for the statemen
2 min read
Proof that Independent Set in Graph theory is NP Complete
Prerequisite: NP-Completeness, Independent set. An Independent Set S of graph G = (V, E) is a set of vertices such that no two vertices in S are adjacent to each other. It consists of non- adjacent vertices. Problem: Given a graph G(V, E) and an integer k, the problem is to determine if the graph contains an independent set of vertices of size >
5 min read
Proof that Dominant Set of a Graph is NP-Complete
Pre-requisite: Dominant Set of a Graph, NP-Complete A dominating set in a graph G = (V, E) is a subset of vertices V’ following the condition that the vertices not belonging in V’ are adjacent to some vertex in V’. Problem: Given a graph G(V, E) and an integer k, the problem is to determine if the graph has a Dominating Set of size k. Explanation:
5 min read
Proof that traveling salesman problem is NP Hard
Pre-requisite: Travelling Salesman Problem, NP Hard Given a set of cities and the distance between each pair of cities, the travelling salesman problem finds the path between these cities such that it is the shortest path and traverses every city once, returning back to the starting point. Problem - Given a graph G(V, E), the problem is to determin
2 min read
Proof that vertex cover is NP complete
Prerequisite - Vertex Cover Problem, NP-Completeness Problem - Given a graph G(V, E) and a positive integer k, the problem is to find whether there is a subset V’ of vertices of size at most k, such that every edge in the graph is connected to some vertex in V’. Explanation - First let us understand the notion of an instance of a problem. An instan
5 min read
Proof that Hamiltonian Cycle is NP-Complete
Prerequisite: NP-Completeness, Hamiltonian cycle. Hamiltonian Cycle: A cycle in an undirected graph G=(V, E) traverses every vertex exactly once. Problem Statement: Given a graph G=(V, E), the problem is to determine if graph G contains a Hamiltonian cycle consisting of all the vertices belonging to V. Explanation: An instance of the problem is an
4 min read
Proof that NAE-4-SAT is NP Complete
Problem Statement: Given a 4-CNF formula f, the task is to check if there is every clause such that at least one literal is TRUE and the other is FALSE. Explanation: An instance of the problem is an input specified to the problem. An instance of the NAE-4-SAT Problem is a boolean 4-CNF formula. Since an NP-complete problem is a problem which is bot
4 min read
Proof that MAX-SAT is NP Complete
Prerequisite: NP-Completeness, NP Class, SAT Problem: The MAX-SAT problem which is built on top of SAT(Boolean Satisfiability Problem) problem takes a boolean formula in conjunctive normal form with m clauses, n literals and input variable g where g ≤ m. If such an assignment exists, the result is an assignment of the literals such that at-least g
5 min read
Proof that Almost-SAT is NP Complete
Prerequisite: NP-Completeness, NP Class, SAT Problem- The Almost-SAT problem which is built on top of SAT(Boolean Satisfiability Problem) problem takes a boolean formula in conjunctive normal form with m clauses as input. If such an assignment exists, the result is an assignment of the literals such that exactly m-1 clauses evaluate to TRUE, otherw
5 min read
Proof that SAT is NP Complete
SAT Problem: SAT(Boolean Satisfiability Problem) is the problem of determining if there exists an interpretation that satisfies a given boolean formula. It asks whether the variables of a given boolean formula can be consistently replaced by the values TRUE or FALSE in such a way that the formula evaluates to TRUE. If this is the case, the formula
3 min read
Proof that 4 SAT is NP complete
4-SAT Problem: 4-SAT is a generalization of 3-SAT(k-SAT is SAT where each clause has k or fewer literals). Problem Statement: Given a formula f in Conjunctive Normal Form(CNF) composed of clauses, each of four literals, the problem is to identify whether there is a satisfying assignment for the formula f. Explanation: An instance of the problem is
3 min read
Transportation Problem | Set 7 ( Degeneracy in Transportation Problem )
Please go through this article first. This article will discuss degeneracy in transportation problem through an explained example. Solution: This problem is balanced transportation problem as total supply is equal to total demand. Initial basic feasible solution: Least Cost Cell Method will be used here to find the initial basic feasible solution.
3 min read
Proof: Why the Root Mean Square of two positive numbers is always greater than their Geometric Mean?
This article focuses on discussing the proof of why the root-mean-square of two positive numbers is always greater than their geometric mean. Before getting into the details of the proof, let's first discuss the basic terminologies: Root Mean Square (RMS):Consider some numbers, A1, A2, A3, A4, .... AN, the root-mean-square of these numbers will be
3 min read
Proof: Why There Is No Rational Number Whose Square is 2?
Problem Statement : Why There Is No Rational Number Whose Square is 2. Rational Numbers: A number that can be expressed in the form of p/q, where p and q are integers and q ≠ 0, is known as a rational number. Examples are 0, 1, -1, 5/2, etc. Solution:Let's get started with the proof of the above problem statement. Proof in this article will be done
2 min read
Proof: Why Probability of complement of A equals to one minus Probability of A [ P(A') = 1-P(A) ]
Probability refers to the extent of the occurrence of events. When an event occurs like throwing a ball, picking a card from the deck, etc., then there must be some probability associated with that event. Basic Terminologies: Random Event-If the repetition of an experiment occurs several times under similar conditions, if it does not produce the sa
4 min read
Hitting Set problem is NP Complete
Prerequisite: NP CompleteProblem: Given a ground set X of elements and also a grouping collection C of subsets available in X and an integer k, the task is to find the smallest subset of X, such that the smallest subset, H hits every set comprised in C. This implies that the intersection of H and S is null for every set S belonging to C, with size
3 min read
Secretary Problem (A Optimal Stopping Problem)
The Secretary Problem also known as marriage problem, the sultan's dowry problem, and the best choice problem is an example of Optimal Stopping Problem. This problem can be stated in the following form: Imagine an administrator who wants to hire the best secretary out of n rankable applicants for a position. The applicants are interviewed one by on
12 min read
Nuts & Bolts Problem (Lock & Key problem) using Quick Sort
Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping between nuts and bolts. Match nuts and bolts efficiently. Constraint: Comparison of a nut to another nut or a bolt to another bolt is not allowed. It means a nut can only be compared with a bolt and a bolt can only be compared with a nut to see which
12 min read
Nuts & Bolts Problem (Lock & Key problem) using Hashmap
Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping between nuts and bolts. Match nuts and bolts efficiently. Constraint: Comparison of a nut to another nut or a bolt to another bolt is not allowed. It means nut can only be compared with bolt and bolt can only be compared with a nut to see which one i
5 min read
Difference between 0/1 Knapsack problem and Fractional Knapsack problem
What is Knapsack Problem?Suppose you have been given a knapsack or bag with a limited weight capacity, and each item has some weight and value. The problem here is that "Which item is to be placed in the knapsack such that the weight limit does not exceed and the total value of the items is as large as possible?". Consider the real-life example. Su
13 min read
Difference between NP hard and NP complete problem
Prerequisite: NP-Completeness NP Problem: The NP problems set of problems whose solutions are hard to find but easy to verify and are solved by Non-Deterministic Machine in polynomial time. NP-Hard Problem: A Problem X is NP-Hard if there is an NP-Complete problem Y, such that Y is reducible to X in polynomial time. NP-Hard problems are as hard as
2 min read
Weighted Sum Method - Multi Criteria Decision Making
Weighted Sum Method is a multi-criterion decision-making method in which there will be multiple alternatives and we have to determine the best alternative based on multiple criteria. There are other methods available including Weighted Product Method (WPM), Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS), VIKOR, MOORA, GT
3 min read
Decision Trees - Fake (Counterfeit) Coin Puzzle (12 Coin Puzzle)
Let us solve the classic "fake coin" puzzle using decision trees. There are the two different variants of the puzzle given below. I am providing description of both the puzzles below, try to solve on your own, assume N = 8. Easy: Given a two pan fair balance and N identically looking coins, out of which only one coin is lighter (or heavier). To fig
12 min read
Decision Tree in Machine Learning
A decision tree in machine learning is a versatile, interpretable algorithm used for predictive modelling. It structures decisions based on input data, making it suitable for both classification and regression tasks. This article delves into the components, terminologies, construction, and advantages of decision trees, exploring their applications
12 min read
Shortest Superstring Problem | Set 2 (Using Set Cover)
Given a set of n strings S, find the smallest string that contains each string in the given set as substring. We may assume that no string in arr[] is substring of another string. Examples: Input: S = {"001", "01101", "010"} Output: 0011010 Input: S = {"geeks", "quiz", "for"} Output: geeksquizfor Input: S = {"catg", "ctaagt", "gcta", "ttca", "atgca
3 min read
three90RightbarBannerImg