0% found this document useful (0 votes)
42 views35 pages

Unit-5 NP-Completeness Theoery

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views35 pages

Unit-5 NP-Completeness Theoery

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Unit-5

Introduction to complexity classes and NP-


completeness
− We have studied many algorithmic strategies to solve a variety of problems. Some
algorithms have polynomial-time complexities (E.g. Binary search: O(log n), Merge sort:
O(n log n), Prim's algorithm : O(n2)), and some have exponential complexities
(E.g. 0/1 Knapsack problem: O(2n/2), Travelling Salesperson Problem (TSP): O(n22n)).
− Algorithms with exponential runtime demand for the impossible number of computing
resources even with the moderate size of the input.
− The theory of computational complexity investigates the number of computing resources
required to solve a specific problem based on its complex nature.

 5.1 COMPUTATIONAL COMPLEXITY

− Computational complexity theory refers to the lower bounds on the efficiency of the
algorithms in a pessimistic way to describe the difficulty level of those algorithms.
− It categorizes numerous computational problems based on their inherent difficulty and
defines the relations between them.
− It identifies different models of efficient computation, their strengths and weaknesses, and
their relationships.

 5.1.1 Basic Terminologies of Computational Complexity

GQ. Explain polynomial and non-deterministic polynomial time problems. Explain its
Computational complexity. (4 Marks)
GQ. What are deterministic and non-deterministic algorithms? Explain with an
example. (4 Marks)

 Optimization problem
− It is a computational problem that determines the optimal value of a specified cost function.

Unit-5 NP Completeness Page 1 of 35


− It includes minimization problems like optimal storage on tapes problem, minimum
spanning tree (MST) problem, TSP, optimal binary search tree (OBST) problem, vertex
cover problem.
− It includes maximization problems like knapsack problem, job sequencing problem, max-
clique problem.

 Decision problem
− It is a restricted type of computational problem that produces only two possible outputs
(“yes” or “no”) for each input.
− A decision problem only verifies whether the input satisfies a specific property.
− E.g. Primality test, Hamiltonian cycle: Whether a given graph has any Hamiltonian cycle
in it?
− A decision algorithm answers the correct truth value TRUE or FALSE for each input
instance of a given decision problem in a finite amount of time.
− The decision problems are easier to solve than the optimization problems.
− If a decision problem is “hard” to solve, then it implies that the corresponding optimization
problem is also “hard”. Thus, the theory of computational complexity is built around the
decision problems that have implications for optimization problems.
− An optimization problem can be formulated as a decision problem.
− E.g. Clique decision problem: Is there any clique of size at least s, for some s in a given
graph?

 Decidable problem
− A decision problem is said to be decidable if there exists a decision algorithm to solve it.
− The decidable problems get the correct TRUE or FALSE answer for a given input either
in polynomial time or in non-polynomial time. Thus, the decidable problems can be either
tractable or intractable.
− E.g. Primality test, TSP, knapsack problem, Hamiltonian cycle problem.

 Undecidable problem
− A decision problem is said to be undecidable if there is no decision algorithm to solve it.
− Such problems do not get the correct “TRUE” or “FALSE” answer for a given input by
any algorithm.

Unit-5 NP Completeness Page 2 of 35


− E.g. Halting problem: For a given input instance whether a computer program will halt or
continue its execution indefinitely?

 Tractability
− It defines the feasibility of an algorithm to complete its execution in a reasonable time.
− The problems are said to be tractable if they get solved in polynomial time using
deterministic algorithms.
− E.g. Time complexities O(n2), O(n3), O(1), O(n log n).
− Some examples of the tractable problems: linear search: O(n), binary search: O(log n),
merge sort: O(n log n), Prim’s algorithm: O(n2).

 Intractability
− It defines the infeasibility of an algorithm to complete its execution in a reasonable time.
− The problems are said to be intractable if they cannot be solved in polynomial time using
deterministic algorithms.
− There are some intractable but decidable problems with exponential runtime. E.g. Time
complexities: O(2n), O(nn), O(n!).
− Some examples of the intractable problems: 0/1 knapsack problem: O(2n/2), TSP: O(n22n),
m-colouring problem: O(nmn).

 Deterministic algorithm
− The algorithm is said to be deterministic if it generates the same result for the same set of
inputs.
− The deterministic algorithms uniquely define the outcomes for specific legitimate input.
− All computer programs are deterministic.
− E.g. Addition of first n numbers, sorting algorithms, searching algorithms.

 Non-deterministic algorithm
− The algorithm is said to be non-deterministic if it generates different results for the same
set of inputs on different executions.
− The non-deterministic algorithms arbitrarily define the outcomes for specific legitimate
input.
− Though there is a degree of randomness to the outcomes of a non-deterministic algorithm,

Unit-5 NP Completeness Page 3 of 35


they are restricted to a certain set of possibilities.
− A non-deterministic algorithm follows two stages:
(i) Non-deterministic stage of guessing the outcome for a given input instance.
(ii) Deterministic stage of verifying the outcome whether it satisfies a particular
property.
− In a non-deterministic algorithm, the next step of execution cannot be decided.
− In practice, no such algorithm is implemented on a computer.
− E.g. A non-deterministic searching algorithm, a non-deterministic sorting algorithm.

 Complexity classes
− In the theory of computational complexity, the computational problems are classified as
per their complex nature and the requirements of computing resources. These classes of
problems are known as complexity classes.
− The problems with a similar range of time and space requirements to get their solutions are
included in a single complexity class.
− Complexity classes help in the organization of similar types of problems.
− The major four complexity classes are:
(1) P-Class problems,
(2) NP-Class problems,
(3) NP-Hard problems and
(4) NP-Complete problems.

 5.2 NON-DETERMINISTIC ALGORITHMS

Non-deterministic algorithms produce different outputs on different executions though


the input remains the same. The outputs produced by those algorithms belong to specific sets
of possible outcomes.

 The general procedure

For a given decision problem, a non-deterministic algorithm works in two stages :

Unit-5 NP Completeness Page 4 of 35


(1) Guessing stage : In this stage, a non-deterministic algorithm randomly selects one of the
possible outcomes.
(2) Verifying stage : In this stage, a non-deterministic algorithm checks whether the selected
choice leads to the successful or unsuccessful execution of an algorithm to solve a given
problem in that run.
In general, non-deterministic algorithms include the following three functions:
(1) Choice (X) : This function randomly selects one of the possible outcomes from a set X.
(2) Failure () : This function indicates an unsuccessful execution.
(3) Success () : This function indicates successful execution.

 5.2.1 The Example of a Deterministic and Non-Deterministic Algorithm

We consider an example of the searching algorithm that searches for an element in a given
list of elements.

 Problem description

− Consider a set of elements X [1 : n], n  1. The searching problem is to find an element y


in a set X.
− The searching algorithm finds an index i such that X[i] = y (a successful search) or i = 0 if
it does not find an element y in X (an unsuccessful search).

Deterministic searching algorithm


Algorithm Search_D(X, y, n)
/*Input: An array X[1 : n], (n  1 is a set of n elements in which an element y is to be
searched.
Output: An index i in an array X, such that X[i] = y or i = 0 if y is not found in X.*/
{
for ( i:=1; i  n; i++)
{
if (X[i] = y)
{
write(i) ; /*An element y found at position i. Successful search.*/
break;
}
}
if (i = n+1)

Unit-5 NP Completeness Page 5 of 35


write (0) ; /*An element y is not present in X[1 : n]. Unsuccessful search.*/
}

− Here, if an element y is found at index i, 1  i  n in an array X[1: n] then the algorithm


has a successful search otherwise it is an unsuccessful search.
− Complexity analysis of the deterministic searching algorithm: It takes O(n) time.

Non-deterministic searching algorithm


Algorithm Search_ND(X, y, n)
/*Input: An array X[1 : n], (n  1 is a set of n elements in which an element y is to be
searched.
Output: An index i in an array X, such that X[i] = y or i = 0 if y is not found in X.*/
{
i : = Choice(1, n) ; // Guessing stage
if (X[i] = y) // Verification stage
{
write(i) ;
Success ( ) ; /*Indicates a successful execution.*/
}
else
{
write (0) ;
Failure ( ) ; /*Indicates an unsuccessful execution.*/
}
}

− Here, a function Choice(1, n) randomly selects any index in the range [1, n].
− If an element y is found at this randomly selected index i in an array X then the algorithm
has a successful execution indicating the same by a function Success( ).
− However, if an element y is not found at this randomly chosen index i in an array X then
the algorithm has an unsuccessful execution indicating the same by a function Failure( ).
− Complexity analysis of the non-deterministic searching algorithm: Each of the three
functions Choice(1, n), Success( ), and Failure( ) takes a constant execution time O(1).
− Hence non-deterministic complexity of this non-deterministic searching algorithm is O(1).
− Every deterministic searching algorithm has time complexity (n) to search an element in
an unordered set of n elements.

Unit-5 NP Completeness Page 6 of 35


− Thus, the searching can be done in O(1) time only if there exists any machine to run a non-
deterministic algorithm. Practically no such machine exists.

GQ. Define a deterministic and non-deterministic algorithm. Write one example of a


deterministic and non-deterministic algorithm. (7 Marks)
GQ. Consider the following search algorithm:
j = any value between 1 to n
if (a[j] = x) then
print “Success”;
else
print “Failure”;
Is this algorithm non-deterministic? Justify your answer. (7 Marks)

Ans. :
− Definitions of a deterministic and non-deterministic algorithm :
− Refer to the definitions mentioned in section 5.1.1 Basic Terminologies of Computational
Complexity.
− E.g. A deterministic searching algorithm and a non-deterministic searching algorithm.
− An example of a deterministic algorithm :
− Refer to section 5.2.1 Deterministic searching algorithm.
− An example of a non-deterministic algorithm :
− Refer to section 5.2.1 Non-deterministic searching algorithm.

 5.3 COMPUTATIONAL COMPLEXITY CLASSES


− Computational complexity classes describe the categories of computational problems
based on their algorithmic complexities. There are four broad categories of problems: (1)
P-Class problems, (2) NP-Class problems,
(3) NP-Hard problems and (4) NP-Complete problems.

 5.3.1 The classes: P, NP, NP-Hard, NP-Complete

Unit-5 NP Completeness Page 7 of 35


GQ. Define P, NP, NP-complete, and NP-hard problems. Give examples of each. (7marks)

GQ. Write a brief note on NP-completeness and the classes P, NP, and NPC. (7marks)

GQ. Define P and NP problems. Also, give an example of each type of problem. (4 marks)

GQ. Define NP-Complete and NP-Hard problems. Also, give examples. (4 marks)

GQ. Explain “P = NP ?” problem. (4 marks)

1. P-Class

− It is the class of decision problems that can be solved in polynomial time by deterministic
algorithms.

 A polynomial-time algorithm
− It is an algorithm whose running time is polynomially dependent on the input size of a
problem instance.
− Thus, a polynomial-time algorithm for a problem instance of size n has its worst-case
complexity O(p(n)) where p(n) is the polynomial of input size n. E.g. Time complexities
O(n2), O(n3), O(1), O(n log n).
− “P” stands for the Polynomial-time algorithm.
− P-Class problems are decidable and tractable problems.
− Some examples of P-Class problems: linear search: O(n), binary search: O(log n), merge
sort: O(n log n), Prim’s algorithm: O(n2), Floyd-Warshall’s algorithm: O(n3).

2. NP-Class

− It is the class of decision problems that can be solved in polynomial time by non-
deterministic algorithms.
− “NP” stands for the Non-deterministic Polynomial-time algorithm and not for Non-
polynomial time algorithms.

 Non-deterministic polynomial-time algorithms produce possible solutions to given


problems in a non-deterministic way and verify the correctness of those solutions in
polynomial time.
− If somebody tells us a solution to the problem, then we can verify it in polynomial time.

Unit-5 NP Completeness Page 8 of 35


Such problems are NP-Class problems. E.g. Sudoku puzzle.
− NP-Class problems are decidable.
− NP-Class problems are tractable or intractable.
− As the definition of NP-Class problems applies to all P-Class problems, P  NP; but it is
an open question in computational complexity: does P = NP?
− All P-Class problems and NP-Complete problems are NP-Class problems, but its inverse
is not true by assuming PNP.
− Some classic examples of NP-Class problems: 0/1 knapsack problem, TSP, graph
colouring problem, vertex-cover problem, clique problem.

3. NP-Hard Class

 A decision problem P1 is NP-Hard if each NP-Class problem is polynomially reducible


to P1 (i.e. for each problem P2  NP, P2  P1).
− Thus, it implies that an NP-Hard problem is at least as hard as the hardest NP-Class
problem.
− All NP-Complete problems are NP-Hard problems, but all NP-Hard problems are not
NP-Complete problems.
− Though the name is NP-Hard, all problems in this class do not belong to NP-Class.
− NP-Hard problems are decidable or undecidable.
E.g.
(a) Decidable NP-Hard problems: vertex-cover decision problem, the clique decision
problem, m-colouring decision problem, TSP decision problem.
(b) Undecidable NP-Hard problems: Halting problem.

4. NP-Complete Class

 A decision problem P1 is NP-Complete if,


(i) P1 is an NP-Class problem (i.e. P1  NP) and
(ii) Each NP-Class problem is polynomially reducible to P1 (i.e. for each problem P2
 NP, P2  P1).

Unit-5 NP Completeness Page 9 of 35


− Thus, P1 is said to be NP-Complete if P1  NP and P1 NP-Hard.
− An NP-Complete problem is solvable in polynomial time iff P = NP. [This is the
implication of Cook’s theorem that says, “Satisfiability is in P iff P = NP.”]
− Consequently, if an NP-Complete problem gets a solution in polynomial time, then all
NP-Class problems could get their solutions in polynomial time. Thus, NP-Complete
problems are the hardest problems in NP-Class.
− NP-Complete problems can have possible solutions only by applying the non-
deterministic algorithms and their solutions can be verified in polynomial time.
− E.g. Circuit-satisfiability problem, the vertex-cover decision problem, the clique decision
problem, the m-colouring decision problem, TSP decision problem.

The relationship among P, NP, NP-Hard and NP-Complete problems (assuming P  NP)
is depicted in Fig. 5.3.1.

Fig. 5.3.1: Generally assumed relationship among P, NP, NP-Hard, and NP-
Complete problems

 5.4 THEORY OF REDUCIBILITY

GQ. Explain the polynomial-time reduction algorithm. (4 marks)

Unit-5 NP Completeness Page 10 of 35


GQ. Consider two problems A & B. If A ≤P B and if B can be solved in
polynomial time, then prove that A can also be solved in polynomial time.
(4 Marks)

GQ. Comment on the statement: “Two problems L1 and L2 are polynomially


equivalent iff L1 α L2 and L2 α L1". (4 Marks)

GQ. What is Reduction in NP-Completeness proofs? (4 Marks)

GQ. Write a short note on polynomial-time reduction. (4 Marks)


Suppose a kid has not yet learned the procedure of multiplying two numbers, but he knows
the procedure of calculating a sum of two numbers. If someone defines the problem of
multiplication as a problem of repetitive addition and asks that kid to solve it, then the kid can
solve the problem of multiplication using the procedure of addition. This example resembles
the theory of reducibility.

 5.4.1 Polynomial-time Reduction

− Suppose P1 and P2 are two decision problems and a problem P2 can be solved by a
polynomial-time deterministic algorithm.

 A decision problem P1 is polynomially reducible to a decision problem P2 if there exists a


transformation function f that converts all instances of P1 to all instances of P2 such that :

o Function f maps all “yes” or “accept” instances of P1 to all “yes” or “accept” instances
of P2 and all “no” or “reject” instances of P1 to "no" or “reject” instances of P2.
o Function f can be computed using a polynomial-time algorithm.

 If any decision problem P1 is polynomially reducible to some decision problem P2 that is


solvable by a known polynomial-time deterministic algorithm, then problem P1 can also be
solved in polynomial time using the same algorithm.

− It is also written as P1  P2 or P1 P P2.

Unit-5 NP Completeness Page 11 of 35


Fig. 5.4.1 : Polynomial-time reduction

− Thus, through polynomial-time reduction one can prove the easiness of computations for
problem P1 by using the easiness of computations for problem P2.

 Two problems P1 and P2 are polynomially equivalent iff P1  P2 and P2  P1 (or it can be
also written as iff P1 P P2 and P2 P P1).

 5.4.2 Reducibility and NP-Completeness

− Theory of NP-Completeness describes the hardness or the complexity level of a problem.


− NP-Completeness proofs use polynomial-time reductions in a pessimistic way.
− Instead of proving the ‘easiness’ of a problem, NP-Completeness follows the theory of
reducibility to prove the ‘hardness’ of a problem.
− Thus, the theory of reducibility proves the non-existence of a polynomial-time algorithm
to solve a particular problem.
− E.g. Suppose we want to prove that there is no polynomial-time algorithm to solve a
decision problem P2 and we know that there is no polynomial-time algorithm to solve
another decision problem P1.

 Proof
− Let us assume a problem P2 can be solved by a known polynomial-time algorithm.
(i) By applying polynomial-time reduction depicted in Fig. 5.4.1 we would have a solution to
P1 using a polynomial-time solution to P2. But it contradicts the known fact of the non-
existence of any polynomial-time algorithm to solve P1.

Unit-5 NP Completeness Page 12 of 35


(ii) It falsifies our assumption that there exists a polynomial-time algorithm to solve P2. Thus,
using this proof by contradiction we can prove that there is no polynomial-time algorithm
to solve P2.

 5.5 NP-COMPLETE PROBLEMS

GQ. Write a brief note on NP-hard problems. (4 marks)

GQ. Write a short note on the NP-completeness problem. (4 marks)

GQ. Which are the three major concepts used to show that a problem is an NP-

Complete problem? (4 marks)

GQ. What is an NP-Complete Algorithm? How do we prove that an algorithm is NP-

Complete? (Give an example) (7 Marks)

− If a decision problem P1 is known to be NP-Complete, then one can prove that any other

decision problem P2 is also NP-Complete using the theory of polynomial-time reduction

(i.e. by showing P1  P2).

− Thus, to prove the NP-Completeness of any decision problem there must be the “first” NP-

Complete problem.

− The circuit-satisfiability problem is the first proven NP-Complete problem and hence

it is used to prove the NP-Completeness of any other decision problem by referring to the

theory of polynomial-time reduction.

Unit-5 NP Completeness Page 13 of 35


 The circuit-satisfiability problem : A combinational circuit formed by using OR, AND,
NOT gates produces Boolean output based on a set of Boolean inputs. The circuit-

satisfiability problem determines some set of inputs to this Boolean circuit to produce the

output = 1 (or TRUE).

 Proofs for NP-Hard and NP-Complete problems

GQ. How do you prove that a problem is NP-hard? (4 Marks)

Proofs for NP-Hard and NP-Complete problems are based on the theory of reducibility.

Proof for the NP-Hardness:

− Let a decision problem P1 is to be proved as an NP-Hard problem.

− We know that an NP-Hard problem is at least as hard as the hardest NP-Class problem and

NP-Complete problems are the hardest problems in NP-Class.

− Thus, if any NP-Complete problem P2 is polynomially reducible to P1 (i.e. P2  P1), then

P1 is NP-Hard.

− As per Cook's theorem, all NP-Complete problems are polynomially reducible to the

satisfiability (SAT) problem. So, if SAT  P1 then P1 is said to be an NP-Hard problem.

Proof for the NP-Completeness:

− Let a decision problem P1 is to be proved as an NP-Complete problem and we have another

decision problem P2 which is NP-Complete.

− If P1NP, P2  P1 then P1 is NP-Complete.

− Since, NP-Complete class = NP-Class  NP-Hard class, if P1NP and P1NP-Hard, then

P1 is NP-Complete.

− Thus, if P1NP and SAT  P1 then P1 is said to be an NP-Complete problem.

Unit-5 NP Completeness Page 14 of 35


 5.5.1 The 3-SAT Problem

− 3-SAT problem is a particular case of the satisfiability (SAT) problem.

− The satisfiability problem is also known as the “Boolean satisfiability” or “propositional

satisfiability” problem.

− In 1971, Stephen Cook proved the first time that the satisfiability problem is NP-Complete.

 Problem description

 An expression (or a formula) in the propositional calculus is formed by using Boolean

variables x1, x2, .... and the operations OR, AND, NOT. E.g. ( x1 x2)  (x3  x4) where

 denotes OR,  denotes AND,  denotes NOT.

− The expression is ‘satisfiable’ if there is some set of truth assignments to the variables in

it that makes the expression TRUE. E.g. [ x1 x2] is satisfied if x1 = FALSE and x2 =

TRUE.

 The satisfiability (SAT) problem is to ascertain whether the given Boolean expression is

satisfiable. E.g. ( x1 x1) is un-satisfiable for any truth values of x1.

 Varieties of SAT problem

 The CNF-satisfiability problem is the SAT problem for Conjunctive Normal Form

(CNF) expressions which are represented as I = 1 Ci where Ci’s are the clauses each
M

expressed as  bij; m is the number of clauses, bij’s are literals (variables or their negations)

and j is the number of literals in each clause.

E.g. (x1x2  x3  x4)  (x1 x2  x3 x4).

Unit-5 NP Completeness Page 15 of 35


 The 3-SAT problem is the SAT problem for CNF expressions in which each clause
contains at most three literals.

E.g. (x1   x2  x3)  (x1  x2  x3)

 The 3-SAT problem is generalized to the k-SAT problem in which the CNF formula
consists of clauses with at most k-literals in each clause.

 The DNF-satisfiability problem is the SAT problem for Disjunctive Normal Form (DNF)

expressions which are represented as I = 1 Ci where Ci’s are the clauses each expressed as
M

 bij; m is the number of clauses, bij’s are literals and j is the number of literals in each

clause. E.g. (x1 x2  x3)  (x1 x2 x3)

− The DNF SAT problem has a trivial solution if at least one of the clauses in a DNF

expression is satisfiable. A clause in a DNF expression is a conjunction and it is satisfiable

only if it does not have both xi and  xi for some variable xi in it.

Non-deterministic algorithm

Algorithm 3-SAT_ND (E, n)


/* Input: E is a Boolean propositional expression composed of 3 variables x1, x2 and x3 .
Output: Indication of success if E is satisfiable, otherwise signal of failure. */
{
//Guessing stage:
for (i := 1; i  3 ; i+ +)
{
xI:= Choice(TRUE, FALSE) ;
/* Random choice of truth assignments to x1, x2 and x3.*/
}
//Verification stage:
if E(x1, x2, x3)
Success( ) ;
/* Indicates success, if E is satisfiable for a randomly selected choice of
truth assignments to x1, x2 and x3.*/
else Failure( ) ;

Unit-5 NP Completeness Page 16 of 35


/*Results failure if E is un-satisfiable for a randomly selected choice of
truth assignments to x1, x2, x3.*/
}

− The non-deterministic algorithm for a 3-SAT problem randomly assigns TRUE or FALSE
value to each of the three variables in the given Boolean propositional expression.
− Thus, it non-deterministically determines one of the 23 possible truth assignments to 3
variables x1, x2, x3 and checks whether an expression E (x1, x2, x3) is TRUE for that random
choice of truth assignments to x1, x2, and x3.

 Complexity analysis
− To make a random choice of truth assignments to n variables (x1, x2,.... xN), the non-
deterministic time (n) is needed. So to make a random choice of truth assignments to 3
variables (x1, x2, x3), the non-deterministic time (3) => constant time O(1) is needed.

− To verify the satisfiability of an expression E(x1, x2, x3) for the random choice of truth
assignments to x1, x2, and x3 the required deterministic time directly proportional to the
length 3 of the expression E is constant time O(1).

 Proof of the NP-Completeness


GQ. What are SAT and 3-SAT problems? Prove that 3-SAT problem is NP-Complete.
(8 Marks)

GQ. What is Boolean Satisfiability Problem? Explain the 3-SAT problem. Prove 3-
SAT is NP-Complete. (8 Marks)

GQ. Explain in brief the NP-Complete problem. Prove that the 3-SAT problem is NP-
Complete. (8 Marks)

GQ. What is the 3-SAT problem? Prove that the


3-SAT problem is NP-Hard. (8 Marks)

 Proof

Unit-5 NP Completeness Page 17 of 35


By definition of NP-Complete problem, the 3-SAT problem is NP-Complete if (i) 3-SAT
 NP and (ii) 3-SAT  NP-Hard.

(i) To prove 3-SAT  NP

− For a given 3-CNF expression, we can randomly choose a set of truth assignments to the
variables in it.
− Then in polynomial time, we can verify the given
− The 3-CNF formula is evaluated to be TRUE for that chosen set of truth assignments.

(ii) To prove 3-SAT  NP-Hard

We show that SAT  3-SAT

 Step 1 :
− We represent a propositional Boolean expression E1 as a binary “parse” tree in which
leaves represent literals and internal nodes represent connectives.
− Using the property of associativity, we fully parenthesize E1 such that each internal node
in a corresponding sparse tree has 1 or 2 children.
− Let yI represents the output at each internal node in a parse tree.

− We express E1 as the AND of output yI at the root and the conjunction of the other outputs
at each node. Let the resultant expression be E2.
− E.g. Let E1 =  x1  x2  (x3 → x4)

o We parenthesize E1 to get,
E1 =  x1  (x2  (x3 → x4))

o We represent E1 as a binary parse tree as given in Fig. 5.5.1.

Fig. 5.5.1

Unit-5 NP Completeness Page 18 of 35


 E2 = y1  (y1  ( x1  y2))  (y2  (x2  y3)  (y3  (x3 → x4))

 Step 2 :
− We convert each clause in the resultant expression E2 into CNF.
− For the same, we evaluate all truth assignments to all variables in E2 using a truth table.
− Based on it we construct a Disjunctive Normal Form (DNF) for truth assignments
evaluating to 0.
− Then we convert this DNF formula into a CNF formula using DeMorgan’s laws :
(1)  (a  b) =  a   b and (2)  (a  b) =  a   b
Let this resultant CNF expression be E3 which is equivalent to the original expression E1.
− E.g. In step (1) we have E2 = y1  (y1  ( x1  y2)) which is equivalent to E1.

o We construct a truth table for the same E2 as below:

Table 5.5.1

y1 y2 x1 y1  ( x1  y2)

1 1 1 0

1 1 0 1

1 0 1 0

1 0 0 0

0 1 1 1

0 1 0 0

0 0 1 1

0 0 0 1

o Considering the truth assignments evaluating to 0 in the truth table we form a DNF
formula E3 equivalent to  E2 as below :

E3 = (y1  y2  x1)  (y1   y2  x1)  (y1   y2   x1)  (y1  y2   x1)

o We apply DeMorgan’s law to E3 to get a CNF formulae E4 as below :


E4 = ( y1   y2   x1)  ( y1  y2  x1)  ( y1  y2  x1)  (y1   y2  x1)

 Step 3 :

Unit-5 NP Completeness Page 19 of 35


− Finally, we convert the resultant CNF formula E4 into 3-CNF formula E5 such that each
clause in it has exactly 3 distinct literals.
− Any clause Ci in a CNF expression E4 is added to a
− 3-CNF expression E5 by the following rules:
(i) If CI has exactly 3 distinct literals, then directly add it to E5.
E.g. In the above example, all clauses in E4 have exactly 3 distinct literals so they are
directly added to E5.
Thus, we get a 3-CNF expression E5 equivalent to the original expression E1=  x1 
x2  (x3→ x4) as below :

E5 = ( y1  y2   x1)  ( y1  y2   x1)  ( y1  y2  x1)  (y1   y2  x1)

(ii) If Ci contains 2 different literals i.e. Ci = (p  q) then add third literal as r and  r to
make it (p  q  r)  (p  q   r) as clauses in a 3-CNF expression E5. For any truth
value of r (r = 0 or r = 1), one of these clauses results in 1, and the other results in (p 
q).
(iii) If Ci contains only 1 literal i.e. Ci = (p) then add 2 more literals as q,  q, r, and  r to
make clauses (p  q  r)  (p   q   r)  (p  q  r)  (p   q   r) in a 3-CNF
expression E5. For any truth values of q and r, one of these clauses results in (p) and
the remaining 3 clauses result in 1.
− Thus, in polynomial time by following the afore mentioned steps (1), (2), (3) any
propositional Boolean expression can be converted to an equivalent 3-CNF expression. So,
SAT  3-SAT  3-SAT  NP-Hard.

− Since both, the conditions: (i) 3-SAT  NP and (ii) 3-SAT  NP-Hard, the 3-SAT problem
is proved to be an NP-Complete problem.
− It is a classic example of an NP-Complete problem.

 5.5.2 The Hamiltonian Cycle Problem


 Problem description
− A Hamiltonian cycle or circuit of a given graph is a round-trip path that starts at a specific
node, visits all nodes excluding the starting node in the graph exactly once, and ends at the

Unit-5 NP Completeness Page 20 of 35


starting node.
− A graph can have zero, one, or multiple Hamiltonian cycles in it.
− It applies to both directed and undirected graphs.
− In the travelling salesperson problem (TSP), a tour completed by a salesperson is a
Hamiltonian cycle.
− E.g. Fig. 5.5.2 shows examples of graphs with and without Hamiltonian cycles.

(a) G with Hamiltonian cycles : (1-2-3-4-5-6-1) and (1-6-5-4-3-2-1)

(b) G with no Hamiltonian cycle


Fig. 5.5.2 : Examples of graphs with and without Hamiltonian cycles

− Hamiltonian cycle decision problem (HCDP) is to find whether a given undirected graph
has any Hamiltonian cycle in it.

Non-deterministic algorithm
Algorithm HCD_ND (G, n, s)
/* Input: G = (V, E) is an undirected graph where V is a set of nodes and E is a set of edges. n
is the number of nodes in G.
Output: Indicates success if a graph has a Hamiltonian cycle, otherwise signals failure.*/
{
V := ; /* V is an initially empty set to store nodes of a subgraph of G.*/

/* Guessing stage: Random choice of a sequence of n vertices of G. */


for (i := 1 ; i  n ; i ++)
{
v := Choice (1, n) ;

Unit-5 NP Completeness Page 21 of 35


if (v  V)
Failure( );
V :=V  {v} ; //Adds a distinct node v to a set V
}
//Verification stage:
if ( an edge <vn, v1> E , v1, vn  V))
Failure( ); /* If there is no path from last node to the first node of selected
random sequence to complete a cycle then it indicates failure. */
else
{
for (edge < vi, vi+1 > such that vi, vi+1  V, vi  vi+1,
1  i  n)
if (<vi, vi+1 > E)

Failure( );
/*If each ordered pair of nodes in a set V is not adjacent then there is no
Hamiltonian path. If so, it indicates failure. */
Success( ); /*Indicates success if randomly selected sequence of n vertices form a
Hamiltonian cycle. */
}
}

 Complexity analysis
− To make a random choice of a sequence of n vertices of a given graph, the non-
deterministic time O(n) is needed.
− To check whether a randomly chosen sequence of n vertices is a Hamiltonian cycle in the
given graph, the required deterministic time is (|E|).

− Thus, the total non-deterministic time is  (|V| + |E|).

 Proof of the NP-Completeness


GQ. Prove that if G is an undirected bipartite graph with an odd number of vertices,
then G is non-Hamiltonian. (4marks)
GQ. State whether the Hamiltonian problem is a NP-Complete problem? Justify your
answer. (7 marks)

 Proof : By definition of the NP-Complete problem, the Hamiltonian cycle decision problem
(HCDP) is NP-Complete if (i) HCDP  NP and (ii) HCDP  NP-Hard.

Unit-5 NP Completeness Page 22 of 35


(i) To prove that HCDP  NP:

− For a given undirected graph G = (V, E), we can randomly choose a sequence of n vertices.
Then in polynomial time, we can verify that a selected sequence of n vertices forms a
Hamiltonian cycle by testing whether each node of G is visited exactly once excluding the
first node which is visited twice to complete a cycle.

(ii) To prove that HCDP  NP-Hard:

− We can show that either VCDP (vertex cover decision problem) HCDP or SAT HCDP.

− Here, we show SAT HCDP.


− Consider a propositional Boolean formula E representing an instance of the SAT problem
with variables x1, …, xn and clauses C1,..., Ck.
− Reduction Steps (very superficial level):
(1) Construct a specific graph structure (a “gadget”) that represents the variables x1, …,
xn of a given formula E.
(2) Use another graph structure to represent the clauses C1,..., Ck of a given formula E.
(3) Connect these two graph structures up such that the resulting graph structure encodes
the given formula E.
(4) Show that the resulting graph structure has a Hamiltonian cycle iff the given
propositional Boolean formula E is satisfiable.
− Fig. 5.5.3(a),(b),(c) depict the different reduction steps of SAT  HCDP.

(a) A gadget representing the variables x1, …, xn of a formula E

Unit-5 NP Completeness Page 23 of 35


(b) Add a new vertex for each clause C1,..., Ck of a formula E

(c) Connecting up the paths


Fig. 5.5.3 : (a),(b),(c) Reduction steps of SAT  HCDP
− Now we show that the resulting graph structure has a Hamiltonian cycle iff the given
propositional Boolean formula E is satisfiable.
o A Hamiltonian path in the resulting graph structure encodes a set of truth assignments
for the variables.
o These truth values depend on the direction in which each chain is traversed.
o To check the presence of a Hamiltonian cycle in a resultant graph structure, we have
to visit each node representing a clause.
o We can only visit a clause if we satisfy it by assigning the TRUE value to one of its
terms.
o Thus, if there is a Hamiltonian cycle present in the resulting graph structure, there is a
set of truth assignments for the variables that satisfy the formula E.
− Since both the conditions: (i) HCDP  NP and (ii) HCDP  NP-Hard is proved, the
Hamiltonian Cycle decision problem is NP-Complete.

GQ. Prove that the Hamiltonian Cycle decision problem is NP-Hard. (7 Marks)

Unit-5 NP Completeness Page 24 of 35


 Proof : Refer to part(ii) To prove HCDP  NP-Hard.

 5.5.3 Travelling Salesman Problem

GQ. State whether the travelling salesman problem is an NP-Complete problem?


Justify your answer. (8 Marks)

GQ. Explain travelling salesman problem. Prove that it is NP-Complete problem. (8


Marks)

− The travelling salesperson problem (TSP) asks to minimize the cost (or length) of a tour
that visits all cities only once and ends at the starting city.

 Problem description
− Let G = (V, E) be a weighted directed graph of a set V of vertices and a set E of edges. A
node in a graph represents a city and an edge < i, j > E represents a path between two
cities i and j. The cost (weight) of an edge < i, j > E is given as Cij for all i and j V.

− Let |V|=n and n > 1. A tour of G starts at any node i  V and ends at i by visiting all other
nodes in (V – {i}) only once.
− Thus, a tour of G is a Hamiltonian cycle including each vertex in V. The sum of the costs
of all paths (or edges) included in a tour determines the cost of a tour.
− The travelling salesman problem is to determine a tour with the smallest cost value.
− The travelling salesman decision problem is to find whether a given weighted directed
graph has a tour with a minimum cost k.

 Proof of the NP-Completeness


GQ. State whether the travelling salesman problem is an NP-Complete problem?
Justify your answer. (8 Marks)
GQ. Explain travelling salesman problem. Prove that it is NP-Complete problem. (8
Marks)

 Proof

Unit-5 NP Completeness Page 25 of 35


By definition of NP-Complete problem, the travelling salesman decision problem (TSDP)
is NP-Complete if (i) TSDP  NP and (ii) TSDP  NP-Hard.

(i) To prove that TSDP  NP

− For a given directed graph G = (V, E), we can randomly choose a sequence of n vertices
as a tour by the travelling salesman. Then in polynomial time, we can verify the credibility
of a selected tour by testing whether each node of G is visited exactly once excluding the
first node which is visited twice to complete a cycle.
− Then we sum the total cost of the paths (edges) in a tour and finally, we verify if the cost
of a tour is minimum. As this can be accomplished in polynomial time, TSDP  NP.

(ii) To prove that TSDP  NP-Hard:

− We know that Hamiltonian Cycle Decision Problem (HCDP) is an NP-Complete problem.


So, we show HCDPTSDP.
− Let G = (V, E) be an instance of HCDP and then an instance of TSP is built with some
bound m such that G has a Hamiltonian cycle iff G’ has a tour of length m. We develop
the complete graph G’= (V, E’), where E’ = {<i, j> : i, j ∈ V and i ≠ j}.
− The cost (weight) function Cij for all i and j V is given as:

Cij = 0 ; if an edge < i, j > E

Cij = 1;if an edge < i, j > E.


− As |V|= n, the length of tour m is bounded by O(n).
− Now let us assume that a Hamiltonian cycle H exists in G. So, it is sure that the cost of
each edge < i, j > in H is 0 in G’ as each edge < i, j > E. Hence, H has a cost of 0 in G’
Therefore, if G consists of a Hamiltonian cycle then G’ has a tour of cost 0.
− Conversely, we consider that G’ has a tour H’ of cost at most 0. As per definition, the costs
of edges in E’ are 0 and 1. Therefore, every edge must have a cost of 0 as the cost of H’ is
0. We conclude that H’ contains only edges  E. So, it is proven that G has a Hamiltonian
cycle iff G’ has a tour of cost at most 0.
− Since both the conditions: (i) TSDP  NP and (ii) TSDP  NP-Hard is proved, the
travelling salesman decision problem is NP-Complete.

Unit-5 NP Completeness Page 26 of 35


 5.5.4 Clique Problem
− It is a classic example of an NP-Complete problem.

 A clique is a complete sub graph of a given undirected graph. In a complete subgraph, all
nodes are connected.

 The size of a clique is defined by a number of nodes in it.


 A clique with a maximum number of nodes is known as a maximum clique.
 Maximal clique
(i) Consider an undirected graph G = (V, E) where V is a set of nodes and E is a set edges
in G.
(ii) A subgraph G = (V, E) of a graph G where V  V and E  E is said to be a maximal
clique in G if
(iii) G is a clique (all nodes in G are connected) and

(iv) There is no node  (V – V) that connects all nodes in G.


− Maximal cliques cannot be expanded by adding any more nodes into them.
− E.g. In a graph G shown in Fig. 5.5.4.(a):
o There are 5 cliques of size 1 (i.e. all nodes),
o There are 8 cliques of size 2 (i.e. all edges),
o There are 5 cliques of size 3,
o There is one clique of size 4 i.e. a maximum clique in G.

((a) Given (b) Not a clique (c) Non-maximal (d) A maximal (e) A maximal
graph G as nodes 1 and 4 clique as node 4 clique of size 3 clique of size 4.
are not adjacent connects to all This is also a
nodes in a maximum
subgraph clique.

Fig. 5.5.4 : Clique examples

 Problem description

Unit-5 NP Completeness Page 27 of 35


− There are two general formulations of a clique problem:
(i) Clique optimization problem and
(ii) Clique decision problem

 The max-clique problem is a type of optimization problem of finding a maximum clique


with the highest number of nodes in a given undirected graph.

 The clique decision problem (CDP) is to check whether a given undirected graph has a
clique of size at least s for some given s.
− The theory of NP-Completeness refers to the clique decision problem (CDP).

Non-deterministic algorithm for CDP

Algorithm CDP_ND (G, n, s)


/* Input: G = (V, E) is an undirected graph where V is a set of nodes and E is a set of edges.
n is a number of nodes in G. s is a size of a clique in a G.
Output : Indicates success if a graph has a clique of size at least s, otherwise signals
failure.*/
{
V := ; /* V is an initially empty set to store nodes of a subgraph of G.*/

/*Guessing stage: Random choice of s distinct nodes forming a subgraph of G.*/


for (i := 1 ; i  s ; i ++)
{
v := Choice (1, n) ;
if v V then Failure( );
V := V  {} ; //Add a distinct node  to a set V
}

//Verification stage:
for (all pairs (0, 1) such that 0, 1  V and 0  1) do
if an edge <0, 1>  E then Failure( );
/*If each pair of nodes in a set V is not adjacent, then that subgraph is not
a clique. If so, indicate failure. */
Success ( ); /*Indicate success if randomly selected subgraph is a clique of size s. */
}
 Complexity analysis

− To make a random choice of a subgraph with s vertices among total n vertices of a given
graph, the non-deterministic time O(n) is needed.

Unit-5 NP Completeness Page 28 of 35


− To check whether a randomly chosen subgraph of s vertices is a clique in a given graph,
the required deterministic time is O(s2).
− Thus the total non-deterministic time is O(n + s2) = O(n2) as s has an upper bound O(n).

 Proof of NP-Completeness

GQ. Prove that Clique problem is NP-Complete. (8 marks)

GQ. CNF-Satisfiability is polynomially transformable to the clique problem.


Therefore prove that the clique problem is NP-Complete. (8 Marks)

GQ. Prove that Clique decision problem is NP-Hard. (8 marks)

 Proof :
By definition of NP-Complete problem, the Clique Decision Problem (CDP) is NP-
Complete if (i) CDP  NP and (ii) CDP  NP-Hard.

(i) To prove that CDP  NP :

− For a given undirected graph G = (V, E) we can randomly choose a subgraph G = (V, E)
of G such that V  V and E  E. Then in polynomial time we can verify that a subgraph
G is a clique in G by testing whether, for each pair v0, v1 V, there is an edge
< v0, v1 >  E.

(ii) To prove CDP  NP-Hard :

− We show that CNF-SAT  CDP. To prove that CNF-SAT  CDP, we can represent a
CNF-formula F of length m as a graph G = (V, E) such that G has a clique of size at least
m iff F is satisfiable.
m
− Let F = i = 1 ci be a CNF-formula of length m. Let xi, 1  i  n be the variables in F. Then

any F can be represented as G = (V, E) as given below :


V = {(b, i) | b is a literal in clause Ci in a CNF-formula F, 1  i  m}

E = {< (b, i), (d, i) > | i  j and b   d}


− This graph G = (V, E) can be easily constructed from a CNF- formula F in polynomial
time.

Unit-5 NP Completeness Page 29 of 35


E.g. F = ( x1   x2  x3)  (x1  x2   x3). The corresponding graph is depicted in Fig.
5.5.5 F has a length of 2 and G has six cliques of size 2. Consider a clique with vertices
{( x1, 1), (x2, 2)}. By assigning TRUE value to all 3 variables x1, x2 and x3, the
CNF- formula F is satisfiable.

Fig. 5.5.5: A graph G constructed from a CNF formula E

− We must show that the construction of graph G from formula F is a polynomial-time


reduction: A formula F is satisfiable iff a graph G has a clique of size  s.
(i) If F is satisfiable, then there must be at least one literal in each clause Ci with value
TRUE. Let S = {(b, i) | b = TRUE in Ci} be a set of exactly one such (b, i) for each i,
1  i  m. Any two nodes (b, i) and (d, i) in S are connected by an edge in G since i 
j and both b and d have the value TRUE. Thus, S is a clique of size m in
graph G.
(ii) Similarly, consider G = (V, E ) is a clique of size m in G. Since no edges in G connect
nodes from the same clause, G has exactly one node per clause. As G does not have
edges connecting a literal and its negation, we can assign TRUE values to all literals
corresponding to vertices in a clique G. Thus we get at least one literal per clause with
value TRUE. That makes each clause satisfiable and hence a CNF expression F is
satisfied.
− Since CNF-SAT  CDP, CDP is an NP-hard problem.

− Thus, both the conditions: (i) CDP NP and


(ii) CDP  NP-Hard, are proved. So the CDP is proved to be NP-Complete. If the number
of clauses in F is m then the corresponding G having a clique of size at least m is
constructed in (m) time.

Unit-5 NP Completeness Page 30 of 35


 5.5.5 Vertex Cover Problem
− It is a classic example of an NP-Complete problem.
− It is also known as “node cover problem”.

 A vertex cover of a given undirected graph G = (V, E) is a subset V  V iff each edge <
v0, v1 > E, v0, v1 V is incident to at least one node in V’ that means either v0  V or v1
 V or 0, v1 V.

 The size of a vertex cover (|V|) is the number of vertices in it.


− Since each node in a vertex cover V “covers” its incident edges, all nodes in V covers all
the edges in E of a given graph G = (V, E).

(a) Given graph (b) Vertex cover of (c) Vertex cover of size 4
size 3 (smallest vertex
cover)
Fig. 5.5.6: Vertex Cover Examples

 Problem description

− A vertex cover problem has two general variants as below :


(i) Vertex cover optimization problem
(ii) Vertex cover decision problem

 The vertex cover optimization problem is to determine a vertex cover with the minimum
number of nodes for a given undirected graph.

 The vertex cover decision problem (VCDP) is to check whether a given undirected graph
has a vertex cover of size at most s for some given s.
− The theory of NP-Completeness refers to the vertex cover decision problem (VCDP).

Unit-5 NP Completeness Page 31 of 35


Non-deterministic algorithm of VCDP
Algorithm VCDP _ ND (G, n, s)
/* Input: G = (V, E) is an undirected graph where V is a set of vertices and E is a set of edges.
n = | V | = number of vertices in G. s is a size of a vertex cover of G.
Output: Indicates success if a graph has a vertex cover of size at most s, otherwise signals
failure */
{
V :=  ; /* V is an initially empty set to store randomly selected nodes of G. V
describes the cover of G. */

/* Guessing stage: Random choice of s distinct nodes forming a cover of graph G. */


for (i := 1 ; i  s ; i ++)
{
 := Choice (1, n);
if v  V then Failure ( ) ;
V := V  {v}; // Add a distinct node v to a set V
}

// Verification stage:
for (each edge < v0 , v1 >  E and v0 , v1  V ) do
{
if ((v0  V) || (v1  V) || (v0, v1  V))
then Success ();
else Failure (); /*If all nodes in a randomly selected set V covers all edges of the
graph G then indicates success, otherwise signals failure*/
}
}

 Complexity analysis

− To make a random choice of a set with S nodes among total n nodes of a given graph, the
non-deterministic time (n) is needed.
− To check whether a randomly chosen set of nodes is a vertex cover of a given graph, the
required deterministic time is (|E|).

− Thus, the total nondeterministic time is  (|V| + |E|).

Unit-5 NP Completeness Page 32 of 35


 Proof of NP-Completeness

GQ. Prove that vertex cover problem is NP-Complete. (8 marks)

GQ. Prove that vertex cover decision problem is NP-Hard. (8 marks)

 Proof :
By definition of NP-Complete problem, the vertex cover decision problem (VCDP) is NP-
Complete if (i) VCDP  NP and (ii) VCDP  NP-Hard.

(i) To prove that VCDP  NP :

− For a given undirected graph G = (V, E), we can randomly choose a set of vertices V  V
and |V| = s for some given size s. Then in polynomial time, we can verify that set V is a
vertex cover of G by testing whether each edge < v0, v1 >  E and v0, v1  V is incident to
at least one node in V.

(ii) To prove that VCDP  NP-Hard :

− We will show that CDP (clique decision problem)  VCDP.

− The proof of CDP  VCDP refers the concept of “complement” of a graph. For a
– = (V  E
undirected graph G = (V, E) its complement is given by G – ) where E
– = {< v , v
0 1

> | v0, v1 V and < v0, v1 >  E}.

− Let < G, n, s > be an instance of CDP where G is a given undirected graph with n vertices
and a clique of size at least s.
− This instance of CDP can be reduced to an instance of VCDP in polynomial time by
– = (V  E
constructing the complement G – ) of a graph G. Then G
– has a vertex cover of size

at most (n – s). So, by polynomial-time reduction a CDP instance < G, n, s > is transformed
– , n, n – s >.
to a VCDP instance < G
− E.g. consider a CDP instance < G, 5, 3 > as depicted in Fig. 5.5.7(a). G has 5 nodes and a
clique of size 3 including nodes 3, 4 and 5.


– , 5, 2 > as depicted
This CDP instance is polynomially reducible to a VCDP instance <G
– has 5 nodes a vertex cover of size 2 including nodes 1 and 2.
in Fig. 5.5.7(b) below G

Unit-5 NP Completeness Page 33 of 35


(a) (b)

Fig. 5.5.7: Example CDP  VCDP


– = (V E
We must show that the construction of G – ) of VCDP instance from G = (V, E)

of CDP instance is a polynomial-time reduction: A graph G has a clique of size  s iffthe


– has a vertex cover of size  (|V| – s).
graph G
– does not
(i) If G = (V, E) has a clique G = (V, E) where V  V, E  E and | V | = s. E
–  E = . Hence, the
contain the edges connecting nodes in a clique G, that means E
– must cover all edges in E
remaining (|V| – |V|) = (n – s) vertices in G –.

– = (V E
(ii) Similarly, V  V is a vertex cover of G – ) then V – V must form a clique in G.

− Thus, we have shown that CDP  VCDP. Also, we know that CNF-SAT  CDP. So, by
transitivity CNF-SAT  VCDP. Thus, it is proved that VCDP  NP-Hard.

− Since both the conditions: (i) VCDP  NP and (ii) VCDP  NP-Hard are proved the vertex
cover decision problem is NP-Complete.

 5.5.6 Reducibility Structure of NP-Complete Problems

Fig. 5.5.8 : Reducibility structure of some NP-Complete problems

Unit-5 NP Completeness Page 34 of 35


− All proofs of the NP-Completeness typically follow the reducibility structure based on the
NP-Completeness of the circuit-satisfiability problem as shown in Fig. 5.5.8.
− It obeys the transitive property. So, if a problem P1  problem P2 and problem P2  problem
P3 then the problem P1  problem P3.

Unit-5 NP Completeness Page 35 of 35

You might also like