SlideShare a Scribd company logo
1 of 34
INDIAN INSTITUTE OF INFORMATION TECHNOLOGY,
DESIGN & MANUFACTURING, KANCHEEPURAM
STUDY OF NP-COMPLETE PROBLEMS: POLY-TIME
REDUCTIONS AND COMPUTING OPT SOLUTIONS
SUBMITTED BY:
K SESHAGIRI RAO
ID: 2010UIT190
INFORMATION TECHNOLOGY
MNIT JAIPUR
GUIDE:
Dr. N SADAGOPAN
ASSISTANT PROFESSOR
COMPUTER ENGG. DEPT.
IIIT D&M KANCHEEPURAM
SIGNATURE
(Dr. N Sadagopan) DATE OF SUBMISSION: 16-07-2013
RESEARCH INTERNSHIP REPORT
2
INDEX
TOPIC Pg. No.
I. INTRODUCTION 3-4
II. PERMUTATION PROBLEMS
2.1 HAMILTONIAN PATH
2.2 HAMILTONIAN CYCLE
2.3 3-VERTEX COLORING
2.4 3-EDGE COLORING
5-9
III. SUBSET PROBLEMS
3.1 MINIMIZATION PROBLEMS
3.1.1 STEINER TREE
3.1.2 DOMINATING SET
3.1.3 VERTEX COVER
3.2 MAXIMIZATION PROBLEMS
3.2.1 INDEPENDENT SET
3.2.2 CLIQUE
3.3 EXACT-3-COVER
3.4 SATISFIABILITY
10-20
IV. POLYNOMIAL-TIME REDUCTIONS
4.1 3-SAT TO CLIQUE
4.2 CLIQUE TO INDEPENDENT SET
4.3 INDEPENDENT SET TO VERTEX COVER
4.4 VERTEX COVER TO HAMILTON CYCLE
4.5 HAMILTON CYCLE TO HAMILTON PATH
4.6 HAMILTON PATH TO HAMILTON CYCLE
4.7 3-SAT TO EXACT-3-COVER
4.8 VERTEX COVER TO DOMINATING SET
21-33
V. CONCLUSION 34
RESEARCH INTERNSHIP REPORT
3
INTRODUCTION
Any problem is either solvable or unsolvable. Solvability depends on the
availability of an algorithm that terminates in finite amount of time. Such ones
are said to be solvable and the rest are all unsolvable. Most of the unsolvable
problems have a countably infinite domains. A problem to find the largest number
in a finite set of integers is a solvable one as it terminates in finite time and gives
a solution but finding the highest natural number or highest prime number in the
set of natural numbers is an unsolvable one because the algorithm never
terminates.
SOLVABLE:
The efficiency and complexity of the algorithm that solves a problem may be
determined on the basis of space and time it takes to give an output. Considering
time complexity, it cannot always be determined whether an algorithm is efficient
in comparison to another one because time complexity always depends on the
hardware configuration of the computer. So, it cannot always be taken as a
criterion for deciding the efficiency of the algorithm. In order to avoid this,
number of steps taken for getting the answer (in the worst case) is considered as
a better option.
Based on complexity, the set of problems may be classified as follows:
 Polynomial time (Poly-time): If there exists an algorithm that runs in
polynomial number of steps i.e., O( nk
), k is a natural number.
 Exponential time (EXP-time): If all the algorithms run in exponential
number of steps i.e., O( kn
), k is a natural number.
NP COMPLETENESS:
It’s not always possible to find a deterministic polynomial solution to a problem.
Sometimes, problem may have to be solved in a machine with countably infinite
no of processors within a polynomial amount of time. Such problems are called
NP (Non-deterministic polynomial time problems). NP is the set of decision
problems where the "yes"-instances can be accepted in polynomial time by a non-
RESEARCH INTERNSHIP REPORT
4
deterministic Turing machine. An algorithm on such a non-deterministic machine
consists of two phases, the first of which consists of a guess about the solution,
which is generated in a non-deterministic way, while the second consists of a
deterministic algorithm that verifies or rejects the guess as a valid solution to the
problem.
The complexity class P is contained in NP, but NP contains many important
problems, the hardest of which are called NP-complete problems, for which no
polynomial-time algorithms are known for solving them (although they can be
verified in polynomial time). The most important open question in complexity
theory, the P = NP problem, asks whether polynomial time algorithms actually
exist for NP-complete, and by corollary, all NP problems. It is widely believed
that this is not the case.
NP COMPLETE:
NP-complete is a subset of NP, the set of all decision problems whose solutions
can be verified in polynomial time. A decision problem C is NP-complete if:
1. C is in NP, and
2. Every problem in NP is reducible to C in deterministic polynomial time.
C can be shown to be in NP by demonstrating that a candidate solution to C can
be verified in deterministic polynomial time.
Note that a problem satisfying condition 2 is said to be NP-hard, whether or not
it satisfies condition 1.
NP HARD:
NP-hard (Non-deterministic Polynomial-time hard), in computational complexity
theory, is a class of problems that are, informally, "at least as hard as the hardest
problems in NP". A problem H is NP-hard if and only if there is an NP-complete
problem L that is polynomial time Turing-reducible to H (i.e., L ≤ TH).
RESEARCH INTERNSHIP REPORT
5
PERMUTATION PROBLEMS
2.1 HAMILTONIAN PATH
A Hamiltonian path or traceable path is a path that visits each vertex exactly once.
A graph that contains a Hamiltonian path is called a traceable graph. A graph is
Hamiltonian-connected if for every pair of vertices there is a Hamiltonian path
between the two vertices.
The path which is in bold mode is a Hamiltonian path for the given graph.
Trivial solution to this problem is an exponential time one with a complexity
O(n!). This problem is known to be NP-Complete by a polynomial-time
reduction from the Vertex Cover problem. Interestingly, if the decision
algorithm for Hamilton path problem is given, then we can get the Hamilton path
in polynomial time. We below present an algorithm to find one such Hamilton
path using a decision algorithm. As on date, it is known whether the decision
algorithm is solvable in polynomial time or not. Any result towards that direction
will only imply that P=NP.
Algorithm using Decision Box:
Let V(G) be the set of vertices of graph G and let the set of edges be E(G). As the
vertices are traversed exactly once in the graph, exactly n-1 edges are present in
the Hamiltonian path. Pass G to decision box and if this returns yes, there is a
Hamiltonian path for this problem. If no, then no such path exists.
If yes, remove the first vertex, say e1, and let the new graph be G1, and pass G1
to the decision box. If yes, it means that there is a Hamiltonian path which does
not include e1. If no, it means that the edge is a must in the Hamiltonian path.
RESEARCH INTERNSHIP REPORT
6
Proceed this until all the edges are checked in the similar way. The sub graph that
is finally left is the Hamiltonian path for the given graph G. Although, multiple
Hamiltonian paths exist for the given graph, this algorithm returns only one. This
algorithm runs with a complexity O(n), where n is the number of edges.
2.2 HAMILTONIAN CYCLE
In graphs, a Hamiltonian cycle of a graph G is a sub graph such that each vertex
is traversed exactly once, except the ones at the edge of the cycle, and all the
vertices in the graph are covered.
The sub graph marked in the red color is a Hamiltonian cycle for the given graph.
There may be many other cycles existing in the graph.
Trivial solution to this problem is an exponential time one with a complexity
O(n!). Using a decision box, this complexity can be brought down to polynomial
time. Similar to Hamilton path problem, we below present a polynomial-time
algorithm to compute the Hamilton Cycle, given a decision algorithm for
Hamilton Cycle.
Algorithm using Decision Box:
Let V(G) be the set of vertices of graph G and let the set of edges be E(G). As the
vertices are traversed exactly once in the graph (leaving the ones at the edges),
exactly n edges are present in the Hamiltonian cycle. Pass G to decision box and
if this returns yes, there is a Hamiltonian cycle for this problem. If no, then no
such cycle exists.
RESEARCH INTERNSHIP REPORT
7
If yes, remove the first edge, say e1, and let the new graph be G1, and pass G1 to
the decision box. If yes, it means that there is a Hamiltonian cycle which does not
include e1. If no, it means that the edge is a must in the Hamiltonian cycle.
Proceed this until all the edges are checked in the similar way. The sub graph that
is finally left is the Hamiltonian cycle for the given graph G. Although, multiple
Hamiltonian cycles are existing for the given graph, this algorithm returns only
one. This algorithm runs with a complexity O(n), where n is the number of edges.
2.3 3 VERTEX COLORING
In graph theory, graph coloring is a special case of graph labelling. It is an
assignment of labels traditionally called "colors" to elements of a graph subject
to certain constraints. In its simplest form, it is a way of coloring the vertices of
a graph such that no two adjacent vertices share the same color. This is called a
vertex coloring.
In the above fig., it can be observed that the graph has been colored using exactly
3 colors. This belongs to the category of 3 vertex coloring as the vertices are
colored in this graph and that too using exactly 3 colors.
The trivial solution to solve this coloring problem runs typically with a
complexity O(2n
). So, it is necessary to find a polynomial time algorithm to solve
this and this can be done only using a decision algorithm. This is an NP-Complete
problem in theoretical computer science.
Algorithm using Decision Box:
Let G be the graph with vertex set V(G) and color set {c1, c2, c3}.
RESEARCH INTERNSHIP REPORT
8
Pass G to the decision box which checks if the graph can be colored using only 3
colors or less. If yes, proceed forward and if otherwise no 3 color graph exists for
the given one and if yes, proceed to next step of coloring the vertices of the graph
with the given 3 colors.
Color vertex v1 from the set V(G) with c1 and let the new graph be G1 and then,
pass G1 to decision box. If it gives yes, leave the vertex colored. Otherwise,
change the color to c2 and again pass G1 to decision box. Similarly, do upto we
get a yes or all 3 colors are used up.
Repeat the procedure for all the vertices and this must finally leave a graph
colored with 3 colors given in the color set.
Let there be a total of n vertices in the graph. So, the total complexity of coloring
is O(3*n) in the worst case. So, the above algorithm runs in polynomial time using
a decision box.
2.4 3 EDGE COLORING
In graph theory, an edge coloring of a graph is an assignment of “colors” to the
edges of the graph so that no two adjacent edges have the same color. For
example, the figure to the right shows an edge coloring of a graph by the colors
red, blue, and green. Edge colorings are one of several different types of graph
coloring. The edge-coloring problem asks whether it is possible to color the edges
of a given graph using at most k different colors, for a given value of k, or with
the fewest possible colors. The minimum required number of colors for the edges
of a given graph is called the chromatic index of the graph. For example, the
edges of the graph in the illustration can be colored by three colors but cannot be
colored by two colors, so the graph shown has chromatic index three.
RESEARCH INTERNSHIP REPORT
9
By Vizing's theorem, the number of colors needed to edge color a simple graph
is either its maximum degree Δ or Δ+1. For some graphs, such as bipartite graphs
and high-degree planar graphs, the number of colors is always Δ, and for
multigraphs, the number of colors may be as large as 3Δ/2. There are polynomial
time algorithms that construct optimal colorings of bipartite graphs, and colorings
of non-bipartite simple graphs that use at most Δ+1 colors; however, the general
problem of finding an optimal edge coloring is NP-complete and the fastest
known algorithms for it take exponential time.
Algorithm using Decision Box:
Let G be the graph with edge set E(G) and color set {c1, c2, c3}.
Pass G to the decision box which checks if the graph can be colored using only 3
colors or less. If yes, proceed forward and if otherwise no 3 color graph exists for
the given one and if yes, proceed to next step of coloring the edges of the graph
with the given 3 colors.
Color edge e1 from the set E(G) with c1 and let the new graph be G1 and then,
pass G1 to decision box. If it gives yes, leave the edge colored. Otherwise, change
the color to c2 and again pass G1 to decision box. Similarly, do upto we get a yes
or all 3 colors are used up.
Repeat the procedure for all the edges and this must finally leave a graph colored
with 3 colors given the color set.
Let there be a total of m edges in the graph. So, the total complexity of coloring
is O(3*m) in the worst case. So, the above algorithm runs in polynomial time
using a decision box.
RESEARCH INTERNSHIP REPORT
10
SUBSET PROBLEMS
3.1 MINIMIZATION
3.1.1 VERTEX COVER
A vertex cover of a graph G is a set C of vertices such that each edge of G is
incident to at least one vertex in C. The set C is said to cover the edges of G.
A minimum vertex cover of a graph is the set of minimum possible no. of vertices
that cover all the edges in the graph.
As we can see in the above two images that both the graphs have vertex covers
in both figures but the VCs given the below one are minimum ones. The vertices
coloured in red are the ones present in VC.
Vertex cover of a complete graph is n-1. Vertex cover problem belongs to the
class of NP-Complete ones. No successful polynomial time algorithm has been
designed till today to find an optimum solution to this problem.
Approximation algorithm:
1. Sort the vertices in descending order of the degree of vertices.
2. Pick the one with max degree and remove all the edges that are connected
to this vertex.
3. Pick max from the remaining set.
4. Repeat this till the set of edges in the graph becomes zero.
This algorithm definitely gives a VC but it cannot be proved that it always gives
an optimum solution. So let’s say that it gives a solution OPT+K for some positive
integer K. This algorithm also definitely runs in polynomial time. But this is not
the solution that we need.
Now, for an optimum solution with a non-deterministic Turing machine with 2n
processors, we just need to spend a unit time to generate all the possible solutions
RESEARCH INTERNSHIP REPORT
11
and test each one of them with one processor. So, this is solved in non-
deterministic polynomial time. But this is an ideal and impractical case.
For some practicality, let’s say a decision algorithm is given to us that just gives
a yes/no output for some input. The working time and complexity of this decision
box is not of importance and using this a polynomial time algorithm can be
generated that produces an optimum solution for vertex cover problem for any
graph. Decision box here is simply a black box to us and its working is not a
matter of concern for us.
Algo using decision box:
Let the total no of vertices be ‘n’ and set be V(G) in graph G and let the set of
edges be E(G).
Now, is known that V(G) is itself a VC with cardinality n.
Pass G, n to the decision box that tests if there exists a vertex cover of size n in
graph G and returns yes if present otherwise no. If yes, pass G, n-1 and continue
this until a first no appears.
Say G, k is yes and G, k-1 is no. So, k is the cardinality of the minimum vertex
cover. So, this runs with a complexity O(n).
Claim 1: k is the size of the minimum VC if a first no appears at G, k-1.
Now, remove a vertex v1 from the graph G and say its G1 and pass G1, k to
decision box and see if the min VC changes. If it says it doesn’t change, the vertex
v1 is not present in the VC and if it changes, that means this vertex v1 is a part of
VC and add this to the set of VC. Add this back and now remove v2 and check
similarly. This will finally generate the min VC for the graph G.
This part runs with a complexity of O(n).
So, total complexity is twice O(n) which is polynomial time.
Claim 2: when the above algo terminates, the VC generated is a min VC.
If we can prove claims 1 and 2, it will be clear that a VC algo that runs in
polynomial time exists using a decision box.
Proof for claim 1:
V(G) will always be a vertex cover because this is the total set of vertices
connecting all the edges in the graph and in this way all edges are covered.
RESEARCH INTERNSHIP REPORT
12
Now in the above process, we get a first no at k-1. This means that no vertex
cover exists that is of size k-1 for the graph G. for now say that k is the min VC.
Let’s assume that there is an m < k-1 and G, m is true.
So, by hypothesis, m is the size of the min VC.
Now, let’s add (k-1-m) random no of vertices to this VC and this must give a VC
of size k-1. But it is given that G, k-1 is false which is a contradiction. This means
that no such m < k-1 exists and k is the cardinality of min VC.
Proof for claim 2:
From claim 1, it is clear that the cardinality of this set of VC is k. Now, lets
assume that there is some edge uv which is not in this VC. So, add either u or v
to this set which makes the cardinality of the min VC k+1 but this is a
contradiction to the hypothesis. So, our assumption is false. Hence, the set VC
generated after the algorithm is the minimum vertex cover.
As both the claims are proved, it is clear that the algorithm gives a minimum
vertex cover using a decision box, running in a polynomial time.
3.1.2 STEINER TREE
Geometric Steiner tree problem states that, given N points in the plane, the goal
is to connect them by lines of minimum total length in such a way that any two
points may be interconnected by line segments either directly or via other points
and line segments.
The Steiner tree problem is superficially similar to the minimum spanning tree
problem: given a set V of points (vertices), interconnect them by a network
(graph) of shortest length, where the length is the sum of the lengths of all edges.
The difference between the Steiner tree problem and the minimum spanning tree
problem is that, in the Steiner tree problem, extra intermediate vertices and edges
may be added to the graph in order to reduce the length of the spanning tree.
These new vertices introduced to decrease the total length of connection are
known as Steiner points or Steiner vertices. It has been proved that the resulting
connection is a tree, known as the Steiner tree. There may be several Steiner trees
for a given set of initial vertices.
RESEARCH INTERNSHIP REPORT
13
The above figure clearly shows multiple Steiner trees for a given set of vertices
(bold ones) for the given graph. The problem of Steiner tree is an NP-Hard type
one and no polynomial time solution has been found yet.
Algorithm using Decision Box:
Let G be the given graph with vertex set V(G) and R be the set of vertices given
that must be present in the Steiner tree. k is an integer given such that the
maximum number of edges that can be used to connect the vertices in R is k.
So, the minimum number of edges needed is |R| - 1 for |R| vertices in the set. Now
pass G, |R|-1 to Decision box which checks if there is some possibility in the
graph such that vertices in R may be connected using exactly |R|-1 number of
vertices. If yes, proceed forward or else increase the number of edges passed by
1 and pass to decision box until k is reached in similar manner i.e., G, i is passed
where I ranges from |R|-1 to k.
Even if G, k gives a no, solution does not exist for the given set for that problem.
If a first yes is obtained at some position for the problem, then it is the minimum
number of edges needed to obtain a Steiner tree.
Claim 1: The number of edges obtained from above procedure, say l, is the min
one for a Steiner tree to be generated.
After obtaining the min number of edges, say l, we must generate the tree itself.
Remove an edge say e1 from the graph and let the new graph be G1. Pass G1, l
RESEARCH INTERNSHIP REPORT
14
to decision box to see if it gives yes or not. Go on like this removing it the edges
as long as the graph says yes and on obtaining no, restore the removed edge and
this means that it is present in the min Steiner tree. This runs with complexity of
O(n).
Claim 2: The part of graph left at the end is the minimum Steiner tree.
If both the above 2 claims are proved, it will be clear that this algorithm helps in
generating the minimum Steiner tree.
Proof for Claim 1:
We know that G, l-1 is false from the hypothesis. So, let’s assume that there is
some p<l-1 for which G, p is true. So, if we add l-1-p edges to this set, then the
tree obtained must still be a Steiner tree but from the hypothesis, G, l-1 is never
true. This is a contradiction and hence, our assumption is false. So, l is the number
of edges in the min Steiner tree.
Proof for Claim 2:
From the above proof, we obtained that l is the number of edges in the minimum
Steiner tree i.e. the cardinality of the Steiner tree is l.
Let us assume that the tree obtained after the above algo is not the min Steiner
tree. Let there be an uncovered vertex u in the set R. So, in order to cover this
vertex, another edge say (u,v) must be added to the Steiner tree which makes the
cardinality l+1 and this is a contradiction. So, our assumption that the set obtained
is not a min Steiner tree is wrong.
Hence, both the claims are proved and this shows that the algorithm generates a
minimum Steiner tree.
3.1.3 DOMINATING SET
In graph theory, a dominating set for a graph G = (V, E) is a subset DS of V such
that every vertex not in DS is adjacent to at least one member of DS. It is also one
of the NP-Complete decision problems in Computer Science.
Minimum Dominating set is the smallest possible dominating set for a graph G.
A minimal dominating set is one, which on removal of any of its elements, no
longer remains a dominating set. It may not always be a minimum DS. All
RESEARCH INTERNSHIP REPORT
15
minimum DSs are minimal but the converse is not always true. More than one
minimum and minimal dominating sets may exist for a given graph G.
The vertices in red represent the ones belonging to the dominating set. In fig. (a),
the DS is of cardinality 3 which is not minimum as we have 2 elements each in
fig. (b) and (c). But, all 3 of the above given figures are minimal dominating sets.
For a complete graph, size of the minimum DS is 1.
Algorithm:
Trivial solution for the DS problem is that generate all possible subsets of V(G)
and check for the smallest DS. But this takes O(2n) time.
No polynomial time approximation algorithm has been discovered till date. In a
non-deterministic frame, we may get the solution with a complexity O(n).
Algorithm using decision box:
Let n be the total number of vertices in graph G. The vertex set V(G) is a
dominating set of size n. So, continuously pass G, i to decision box until we get
a false such that i starts from n and ends at 1, reducing in steps of 1. Suppose we
get first false at k-1. Then k is the cardinality of the min DS.
Claim 1: k obtained in the above part is the size of min DS.
Proof for claim 1:
We know that G, k is true and G, k-1 is false. Assume that there is some m<k-1
for which G, m is true. So, it means that there is a dominating set of size m, which
is less than k.
After adding a few vertices to this set, it should still remain a DS. Say we add k-
1-m number of vertices to this set which makes its cardinality k-1 and it’s a DS.
RESEARCH INTERNSHIP REPORT
16
But as per hypothesis, no DS of size k-1 exists. This is a contradiction. So, our
assumption that there exists some m<k-1 for which G, m is true is not correct.
Hence our claim that k is the size of the min DS is proved.
3.2 MAXIMIZATION
3.2.1 CLIQUE
A clique in an undirected graph G is a subset of its vertices such that every two
vertices in the subset are connected by an edge.
In the above fig., sets {2, 3}, {4, 5}, {5, 2} are all cliques of size 2 as a vertex in
the set is connected to every other vertex in that set.
Maximum clique of a graph G is defined as the clique of largest cardinality
possible for the given graph G. For eg., in the above fig, {1, 2, 5} is also a clique
as every vertex in the set is connected to every other one and it is the largest one
possible for that graph.
The concept of maximal clique also plays a role in clique problems. Maximal
clique is a set of vertices so that if other vertex in the graph can be added to, it
will no longer remain a clique. Maximal cliques may be of very small size. For
eg., {4, 5} is a maximal clique whereas {2, 5} is not because 1 can be added and
the set still remains a clique.
Every maximum clique is a maximal clique but the converse is not always true.
For a complete graph, size of the maximum clique is ‘n’ and for all the rest of the
graphs, it is always < n.
Algorithm: Trivial solution for the clique problem is that generate all possible
subsets of V(G) and check for the largest clique. But this takes O(2n
) time.
RESEARCH INTERNSHIP REPORT
17
No polynomial time approximation algorithm has been discovered till date. In a
non-deterministic frame, we may get the solution with a complexity O(n).
Algorithm using decision box:
Every single vertex is a clique. So, start passing G, i to decision box where, G is
the graph and 1<= i <=n. Stop at the point where G, i is false for the first time.
That means that no clique exists of size i. Hence, i-1 is the size of the largest
clique. Let this be k.
Claim 1: k obtained in the above algo is the size of the largest clique.
Now, remove the vertex v1 from the graph and pass the new graph G1, k to the
decision box and see if it is true. If it is true, remove that vertex. Now check for
v2. If it is false, add it back or else remove it also. Similarly continue and the
graph left finally is the maximum clique.
Claim 2: The set obtained after the above algorithm is a maximum clique.
If we are able to prove the above two claims, it will be proved that this algorithm
will give a maximum clique. The complexity can be seen to be twice of O(n),
which is very much a polynomial time running one.
Proof for claim 1:
Let there be some m > k+1 for which G, m is true in the decision box. So, size of
the clique is m.
Even if we remove a few vertices and their corresponding edges, it must still be
a clique. Remove m-(k+1) vertices randomly from the clique set. Now, we have
a clique of cardinality k+1 but it is given that G, k+1 is false which is a
contradiction.
Hence, our assumption is false.
Hence, k is the size of the maximum clique.
So, the claim has been proved.
Proof for claim 2:
From the above claim, it is clear that the cardinality of the maximum clique is k.
Let us assume that there some vertex u, which is connected to each and every
vertex in the clique set obtained from the algorithm. This vertex u is not included
in the clique set.
RESEARCH INTERNSHIP REPORT
18
So add this but this makes the cardinality of the set k+1.
But the hypothesis says that the size of the max clique is k. This is a contradiction.
Hence, our assumption that the set obtained is not the maximum clique is false.
Hence, the claim is proved.
3.2.2 INDEPENDENT SET
In graph theory, an independent set or stable set is a set of vertices in a graph G,
no two of which are adjacent. That is, it is a set of vertices such that for every two
vertices in IS, there is no edge connecting the two. Equivalently, each edge in the
graph has at most one endpoint in the IS.
Independent set can be simply said to be the complement of a Vertex Cover
(problem 3.1.1). Because VC has all the edges covered with atleast one vertex
present in the set and this means that all the left out vertices are disconnected and
they can be said to me an IS.
Maximum IS is the largest set possible for a graph G so that all the vertices in it
are disjoint. Max IS is the complement of min VC for a given graph G. So, if we
can obtain min VC with a polynomial time complexity using a decision algorithm,
the max IS is also obtained, obviously, with the same complexity.
A maximal IS is one, which on addition of any of the other vertices in GIS, no
longer remains an IS. All maximum IS are maximal but the converse is not
always true.
In the above fig., the vertices in blue are the ones in IS. It is clearly visible that
all of them are disconnected mutually.
RESEARCH INTERNSHIP REPORT
19
3.3 SATISFIABILITY PROBLEM
In computer science, satisfiability is the problem of determining if there exists an
interpretation that satisfies a given Boolean formula. In other words, it establishes
if the variables of a given Boolean formula can be assigned in such a way as to
make the formula evaluate to TRUE. Equally important is to determine whether
no such assignments exist, which would imply that the function expressed by the
formula is identically FALSE for all possible variable assignments. In this latter
case, we would say that the function is unsatisfiable; otherwise it is satisfiable.
For example, the formula a AND b is satisfiable because one can find the values
a = TRUE and b = TRUE, which make (a AND b) = TRUE.
SAT was the first known example of an NP-complete problem. That briefly
means that there is no known algorithm that efficiently solves all instances of
SAT, and it is generally believed (but not proven) that no such algorithm can
exists.
Algorithm using a decision box:
Say that C is the CNF form of all the given clauses, say c1 to cm. Let the variables
be from x1 to xn.
Pass C, x1 to the decision box which assigns True to x1 and checks for a
combination of rest of all the variables so that C may return True. If such an
assignment exists, x1 = 1 is in the solution set or else x1 = 0 is in the solution set.
Now, similarly test for x2 to xn. If any of the variable and its complement are
present in a single clause ci, solution to the problem does not exist. Or if any of
the clauses is false by the part of solution we obtained for all combinations of rest
of variables, no solution exists in that case as well.
3.4 EXACT 3 COVER
In mathematics, given a collection S of subsets of a set X, an exact cover is a sub
collection S* of S such that each element in X is contained in exactly one subset
in S*. One says that each element in X is covered by exactly one subset in S*. An
exact cover is a kind of cover.
In computer science, the exact cover problem is a decision problem to find an
exact cover or else determine none exists. The exact cover problem is NP-
RESEARCH INTERNSHIP REPORT
20
complete and is one of Karp's 21 NP-complete problems. The exact cover
problem is a kind of constraint satisfaction problem.
The trivial algorithm to solve this problem is exponential time with a complexity
O(2n
).
Algorithm using Decision Box:
Let X = {x1, x2, x3,…, x3q } be the variables arranged into sets of 3 element clauses
C = {c1, c2, c3,…, cn } where n>=q.
The problem is mainly described as selecting any q clauses from the clause set so
that ci ∩ cj = ɸ for all ci, cj ∈ C and ⋃ 𝑐
𝑞
= X.
Let S be the final set of clauses. Initially, S = ɸ. Add c1 to S and pass S, q-1 to
decision box. It searches for any q-1 clauses combination from the set C and gives
out yes if any such combination exists. In this case, leave c1 in S and remove it
from C. Otherwise, remove c1 from both C and S.
Add c2 to S obtained from above procedure and check in the same way as
described. Repeat this process until required number of clauses reduces to 0 or all
the clauses have been visited once.
Finally the set S obtained is the exact 3 cover for the set of given clauses and
variables.
RESEARCH INTERNSHIP REPORT
21
POLYNOMIAL-TIME REDUCTIONS
In computational complexity theory, a polynomial-time reduction is a reduction
which is computable by a deterministic Turing machine in polynomial time. If it
is a many-one reduction, it is called a polynomial-time many-one reduction,
polynomial transformation, or Karp reduction. If it is a Turing reduction, it is
called a polynomial-time Turing reduction or Cook reduction.
Polynomial-time reductions are important and widely used because they are
powerful enough to perform many transformations between important problems,
but still weak enough that polynomial-time reductions from problems in NP or
co-NP to problems in P are considered unlikely to exist. This notion of
reducibility is used in the standard definitions of several complete complexity
classes, such as NP-complete, PSPACE-complete and EXPTIME-complete.
4.1 3-SAT TO CLIQUE
Let F be a 3-Conjunctive Normal Form formula
C1, C2, C3,…, Ck are Clauses in F
Xj,1, Xj,2, Xj,3 are the literals in Cj
For this reduction to be possible, there must be an instance of 3-SAT which must
be polynomial time reducible to Clique and also an instance of Clique that can be
reduced to 3-SAT in polynomial time.
Construction:
For each literal Xj,q in F, create a distinct vertex in graph G representing it.
G contains all the edges except – the edges that connect vertices in same clause
and the edges that connect vertices which are negation of one another.
This construction will generate something like this
This construction will generate a graph G and reduction is possible if we can
prove that
F is satisfiable ↔ G has a K-Clique
RESEARCH INTERNSHIP REPORT
22
→: If F is true, we need to show that G has a K-clique.
For F to be satisfiable, atleast one literal must be true in each and every clause.
So, all such literals are connected in the graph that was constructed. So, atleast K
such literals are present, all clauses combined. Hence, it is clear that such a K
combination is a K-Clique.
So, the forward direction is true.
←: If there is a K-Clique in graph G, it is needed to be proved that F is satisfiable.
Graph G has a K-Clique means that each and every edge in the clique is between
the literals in different clauses because, from the construction, edges don’t exist
between literals in same clause.
So, every one of the K-Clauses has one true instance of one of the literals. So, the
formula F is satisfiable.
As we have proved that the statement is true for both forward and backward
directions, the statement is proved.
So 3-SAT is polynomial time reducible to Clique.
RESEARCH INTERNSHIP REPORT
23
4.2 CLIQUE TO INDEPENDENT SET
The input is graph G = (V, E) and integer k≤|V|.
Does the graph contain a clique of j vertices; i.e. is there a subset S⊂V , where
|S|≤j, such that every pair of vertices in S defines an edge of G?
For example, the graph in Figure above contains a clique of five vertices. In the
independent set problem, we looked for a subset S with no edges between two
vertices of S. However, for a clique, we insist that there always be an edge
between two vertices. A reduction between these problems results by reversing
the roles of edges and non-edges, an operation known as complementing the
graph:
Independent Set (G, k)
Construct a graph G = (V', E') where V'=V, and
For all (i, j) not in E, add (i, j) to E'
Return the answer to Clique (G', k)
These last two reductions provide a chain linking three different problems. The
hardness of independent set is implied by the hardness of the clique, which is
implied by the hardness of 3-SAT. By constructing reductions in a chain, we link
together pairs of problems in implications of hardness. Our work is done as soon
as all these chains begin with a single problem that is accepted as hard.
Satisfiability is the problem that serves as the first link in this chain.
Thus, an instance of a K-Clique is reduced in polynomial number of steps to an
instance of independent set. The reduction is hence successful.
RESEARCH INTERNSHIP REPORT
24
4.3 INDEPENDENT SET TO VERTEX COVER
Let G be a given graph with vertices V(G) and edges E(G).
Let VC be the vertex cover of the graph G.
So, each and every edge in E has atleast one end point in VC.
If we remove VC from V, no edge remains in the graph. So, the graph is totally
disconnected and this means that it is an independent set.
In the above figure, the vertices marked in red are the VC and the ones in blue
belong to independent set. The vertex cover is of size 3 and Independent set is of
size 4 and the total number of vertices are 7. Both VC and IS do not have any
common vertex. It is clearly visible that independent set is the complement of the
vertex cover with respect to the vertices present in it.
So, V’ = V-VC is the independent set.
It is possible to reduce Independent set into a vertex cover in polynomial time.
Hence, the reduction is true.
Also, we obtained that Independent set is an NP-Complete problem ( by reduction
from another NPC). Now, Vertex cover is obtained by reduction from
Independent set, which is an NPC. So, Vertex Cover also is an NP-Complete
problem.
RESEARCH INTERNSHIP REPORT
25
4.4 VERTEX COVER TO HAMILTON CYCLE
For every edge in the Minimum Vertex Cover problem, we must reduce it to a
contraption in the Hamiltonian Cycle Problem as explained the figure below. An
edge (u, v) must be transformed into a fig with 12 vertices in the following way.
There are only three possible ways that a cycle can include all of the vertices in
this contraption. These are depicted in the figures below.
All components that represent edges connected to u are
strung together into a chain. If there are n vertices, then we
will have n of these chains, all interwoven.
The only other changes we need to make are at the ends of
the chains.
RESEARCH INTERNSHIP REPORT
26
In this way, after making all the changes as described in the above process, the
graph given below is transformed in the following way.
If we want to know if it’s possible to cover the original graph using only k
vertices, this would be the same as seeing if we can include all of the vertices
using only k chains.
How can we include exactly k chains in the Hamiltonian Cycle problem using the
vertex cover is the problem of concern for us now. If it is reducible in polynomial
time, then our reduction from vertex cover to Hamiltonian cycle is true.
To solve this, we must add k extra vertices and connect each of them to the
beginning and end of every chain. Since each vertex can only be included once,
this allows k chains in the final cycle.
Let the graph be the figure given below and its transformed one initially is given.
RESEARCH INTERNSHIP REPORT
27
After applying the above procedure, i.e., adding k vertices to the transformed
graph and an edge from these vertices to each and every beginning and end vertex
in the transformed graph, the newly generated graph is as shown below.
So, these k edges in the final transform correspond to the Hamiltonian cycle
obtained for that graph using Vertex cover. As this procedure runs in polynomial
number of steps, it is a polynomial time reduction from vertex cover to the
Hamiltonian cycle.
RESEARCH INTERNSHIP REPORT
28
4.5 HAMILTON CYCLE TO HAMILTON PATH
Given instance of Hamiltonian Cycle G, choose an arbitrary node V and split it
into two nodes to get graph G’ as shown in the figure below.
Now any Hamiltonian Path must start at V’ and end at V’’.
For a polynomial time reduction to exist from Hamilton cycle to Hamilton path,
it must be proved that
HAMILTON CYCLE ↔ HAMILTON PATH
1. If graph G has a Hamilton cycle that includes a vertex, say V, then a
Hamilton path must exist in the same cycle after we split up V into V’ and
V’’. So, the Hamilton Path starts at V’ and ends at V’’.
2. If graph G has a Hamilton Path staring at V’ and ending at V’’, it is clear
that after joining V’ and V’’ to obtain V, the path gets converted into a
Hamilton Cycle. So, the converse is also proved.
Hence, the reduction from Hamiltonian cycle to Hamiltonian path is existing. The
complexity of this reduction is just traversing each vertex in the Hamilton Cycle
only once which means it is O(n) i.e., it is a polynomial time complex reduction.
4.6 HAMILTON PATH TO HAMILTON CYCLE
To show that HP reduces to HC, we need to show Ham. Path can solved using
Ham. Cycle.
Let G = (V, E) be the input to HP and G' = (V', E') be the input to HC and let T
be the transformation function (reduction function) such that:
G' = T(G) and HP(G) = HC(T(G'))
Try the following reduction:
RESEARCH INTERNSHIP REPORT
29
Assume there is an algorithm HC that takes a graph G' = (V', E') and answers the
question whether G' contains a simple cycle.
Let v' be a vertex not in G.
The reduction is as follows:
V' = {V, v'} i.e., G' is G with one extra vertex v'
E' = {E, (v', u) for all u in V} i.e., v' has an edge to every other vertex in V
1. This reduction runs in Polynomial Time. Adding one extra vertex takes
constant time. Adding edges from v' to all vertices in V takes O(|V|) time.
Therefore, the transformation function T runs in Polynomial time.
2. For all strings G, if G is a YES input to HP, then T(G) is a YES input to HC.
Assume G is a YES input to HP, meaning graph G contains a simple path. Let the
start vertex for that simple path be called s and the end vertex be called t.
G' = T(G). G' will contain the simple path from s to t just like G. G' will also
contain a vertex v' with two edges (t, v') and (v', s). Now G' must contain a simple
cycle s  t  v' s (where s  t is the simple path between s and t found in G).
Since G' contains a simple cycle, T(G) is a YES input to HC.
3'. For all strings G, if T(G) is a YES input to HC then G is a YES input to HP.
Assume that G' = T(G) is a YES input to HC. Then G' contains a simple cycle
that must go through v'. Let C be the name of the simple cycle in G'. C must go
through v' and two other adjacent vertices t and s such that edges (t, v') and (v', s)
must be in C. Now C can be thought of a simple path between s and t (call it S)
and the two edges connecting v' with s and t.
So, C = {S, (t, v'), (v', s)}.
Cycle C is a simple cycle, which means it does not visit the same vertex twice, so
aside from (t, v') and (v', s) C does not contain any edge connecting v' with any
other vertex, which means that S does not contain any edges leading to v' which
means that S is entirely contained in E. S visits every vertex in V' except for v',
so S visits every vertex in V.
Since S is a simple path that uses edges in E and visits every vertex in V, S must
be a simple path in G. Therefore G contains a simple cycle and G is a YES input
to HP. Thus, it is shown that Hamiltonian Path is polynomial time reducible to
Hamiltonian cycle.
RESEARCH INTERNSHIP REPORT
30
4.7 3-SAT TO EXACT-3-COVER
Membership in NP is obvious. Given the guessed cover, we need only verify, by
scanning each subset in the cover in turn, that all set elements are covered. We
want to reduce 3-SAT to X3C. The first question to address is the representation
of a truth assignment. One possible solution is to set up two three-sets for each
variable and to ensure that exactly one of the two three-sets is selected in any
solution. The latter can be achieved by taking advantage of the requirement that
the cover be exact: once a three-set is picked, any other three-set that overlaps
with it is automatically excluded. Since a variable may occur in several clauses
of the 1in3SAT problem and since each element of the X3C problem may be
covered only once, we need several copies of the construct corresponding to a
variable (to provide an “attaching point” for each literal). This in turn raises the
issue of consistency: all copies must be “set” to the same value.
Let an instance of Positive 1in3SAT have n variables and k clauses.
For each clause, c = {x, y, z}, we set up six elements, xc, yc, zc, tc, f ′c , and f ′′c.
The first three will represent the three literals, while the other three will
distinguish the true literal from the two false literals. For each variable, we
construct a component with two attaching points (one corresponding to true, the
other to false) for each of its occurrences, as illustrated in Figure and described
below.
Let variable x occur nx times (we assume that each variable considered occurs at
least once). We set up 4nx elements, of which 2nx will be used as attaching points
while the others will ensure consistency.
Call the attaching points Xt
i and Xf
i, for 1 ≤ i ≤ nx ;
Call the other points pi
x , for 1≤ i ≤ 2nx .
Now we construct three sets. The component associated with variable x has 2nx
sets:
• {p2i-1x, p2i
x, Xt
i} for 1 ≤ i ≤ nx,
• {p2i
x, p2i+1
x, Xf
i} for 1 ≤ i < nx, and
• {p2nx
x, p1
x, Xf
nx}.
RESEARCH INTERNSHIP REPORT
31
Each clause c = {x, y, z} gives rise to nine three-sets, three for each literal. The
first of these sets, if picked for the cover, indicates that the associated literal is the
one set to true in the clause; for literal x in clause c, this set is {xc, tc, Xt
i } for
some attaching point i . If one of the other two is picked, the associated literal is
set to false; for our literal, these sets are {xc, f′c, Xf
i} and {xc, f′′c, Xf
i}. Overall,
our transformation produces an instance of X3C with 18k elements and 15k three-
sets and is easily carried out in polynomial time.
Now notice that, for each variable x, the element p1
x can be covered only by one
of two sets: {p1
x, p2
x, Xt
1} or {p2nx
x, p1
x, Xf
nx}. If the first is chosen, then the
second cannot be chosen too, so that the element p2nx
x must be covered by the
only other three-set in which it appears, namely {p2nx-1
x, p2nx
x, Xtn
x}.
Continuing this chain of reasoning, we see that the choice of cover for p1
x entirely
determines the cover for all pi
x, in the process covering either
(i) all of the Xf
i and none of the Xt
i or
(ii) The converse.
Thus a covering of the components associated with variables corresponds to a
legal truth assignment, where the uncovered elements correspond to literal values.
Turning to the components associated with the clauses, notice that exactly three
RESEARCH INTERNSHIP REPORT
32
of the nine sets must be selected for the cover. Whichever set is selected to cover
the element tc must include a true literal, thereby ensuring that at least one literal
per clause is true. The other two sets chosen cover f′c and f′′c and thus must contain
one false literal each, ensuring that at most one literal per clause is true. Our
conclusion follows.
From this reduction and the preceding ones, we see that a typical reduction from
a satisfiability problem to another problem uses a construction with three distinct
components.
We often transform an asymmetric satisfiability problem into a symmetric
problem in order to take advantage of the rigidity of 1in3SAT. In such cases, we
must provide an indication of which part of the solution is meant to represent true
and which false. This is often done by means of enforcers (in the terminology of
Garey and Johnson). The following proof presents a simple example of the use of
enforcers; it also illustrates another important technique: creating exponentially
large numbers out of sets.
4.8 VERTEX COVER TO DOMINATING SET
Given a potential dominating set S, we can check in polynomial time that every
vertex is either in S, or adjacent to a vertex in S. Note that we can assume there
are no isolated vertices in G, because a graph G with l isolated vertices has a
dominating set of size k iff the graph with those isolated vertices removed has a
dominating set of size k −l, since each isolated vertex must be in every dominating
set.
Now, we reduce VC to DS and show that it is NP-complete. Given an instance of
VC, with graph G = (V, E) and parameter k, construct a new graph G’. First add
all vertices and edges of G to G’. Then, for each edge e = (u, v) ∈ E, add a node
we to V’, and add edges (u, we) and (v, we) to E’.
Note that we can assume the vertex cover instance has no isolated vertices since
removing those vertices will exactly preserve the set of feasible solutions.
There is a vertex cover of size k in G iff there is a dominating set of size k in G’.
I. If we have a vertex cover S of size k in G, then the claim is that S is a
dominating set for G’ as well.
RESEARCH INTERNSHIP REPORT
33
Consider any node v ∈ V’. We must show that either v ∈ S or there is some
adjacent node which is in S. There are two cases.
Case 1: v is an original node from V. Since there are no isolated vertices in G,
there is some edge (u, v) ∈ E. Since S is a feasible vertex cover, one of u and v
must be in S. Thus, either v ∈ S, or an adjacent node is in S.
Case 2: v = we is a new node added to V’, where e ∈ E. By the previous argument,
if e = (i, j), then either i ∈ S or j ∈ S. But we know that the edges (i, we) and (j,
we) are both in E’. So, we is adjacent to a node in S.
Thus, we have that S is a dominating set in G’ of size k.
II. Assume we have a dominating set S in G’ of size k. So, claim is that S
is a VC of size k with respect to graph G.
If there are any nodes we in S, with e = (u, v), we can replace we by either u or v,
and we will still have a dominating set, since removing we can only potentially
un-cover nodes u and v, and (u, v) ∈ E’. If u and v are both in S, then we can
replace we by any arbitrary vertex to maintain that the set has size k.
After this procedure has finished, we have a set S’ which only consists of vertices
in V. The claim is that this set S’ is a vertex cover for G. Consider any edge e =
(u, v) ∈ E. Since S’ is a dominating set in G’, either we ∈ S’, or some node adjacent
to we is in S’.
But we constructed S’ from vertices in V, so it must be the case that some node
adjacent to we is in S’. But the only nodes adjacent to we in G’ are u and v, so one
of them is in S’. Thus, every edge e ∈ E is adjacent to some node in S’, so it is a
feasible vertex cover.
RESEARCH INTERNSHIP REPORT
34
CONCLUSION
The report clearly depicts the fact that Subset Problems and Permutation
Problems of theoretical Computer Science are solved in Polynomial time using
different decision algorithms, based on the problem. If a decision algorithm is not
used, these problems can’t be designed in polynomial time. Instead, a non-
deterministic algorithm may be used but it is not practically feasible to solve that
way. The permutation problems solved are Hamiltonian Path, Hamiltonian Cycle,
Vertex Coloring, 3-Edge Coloring and the problems of Subset category are
Steiner Tree, Dominating Set, Minimum Vertex Cover, Maximum Independent
Set, Maximum Clique, Exact-3-Cover and Satisfiability.
A problem is NP-Complete if it belongs to the class of NP problems and it must
be reducible to each and every other problem in NP class Or the problem must be
reduced in polynomial time from another NP-Complete problem. SAT is an NPC
(NP-Complete) and it is proven. Hence, it is considered NPC in this document by
default. 3-SAT can be reduced from SAT. Clique is reduced from 3-SAT in
polynomial time. Then, Independent set is reduced from Clique and Vertex cover
is reduced from Independent Set. Hamiltonian Cycle is reduced from Vertex
Cover. Similarly, other reductions are clearly proved in this report.
Date: 16-07-2013 Signature
( Dr. N Sadagopan )

More Related Content

What's hot (20)

Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
27 NP Completness
27 NP Completness27 NP Completness
27 NP Completness
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
Lecture26
Lecture26Lecture26
Lecture26
 
Np complete
Np completeNp complete
Np complete
 
NP Complete Problems
NP Complete ProblemsNP Complete Problems
NP Complete Problems
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 
Greedy Algorithm
Greedy AlgorithmGreedy Algorithm
Greedy Algorithm
 
Divide and Conquer
Divide and ConquerDivide and Conquer
Divide and Conquer
 
Travelling SalesMan Problem(TSP)
Travelling SalesMan Problem(TSP)Travelling SalesMan Problem(TSP)
Travelling SalesMan Problem(TSP)
 
strassen matrix multiplication algorithm
strassen matrix multiplication algorithmstrassen matrix multiplication algorithm
strassen matrix multiplication algorithm
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
Shortest path algorithms
Shortest path algorithmsShortest path algorithms
Shortest path algorithms
 
Data Structure and Algorithm - Divide and Conquer
Data Structure and Algorithm - Divide and ConquerData Structure and Algorithm - Divide and Conquer
Data Structure and Algorithm - Divide and Conquer
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
 
Sum of subsets problem by backtracking 
Sum of subsets problem by backtracking Sum of subsets problem by backtracking 
Sum of subsets problem by backtracking 
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
dynamic programming Rod cutting class
dynamic programming Rod cutting classdynamic programming Rod cutting class
dynamic programming Rod cutting class
 

Viewers also liked

Choosing the right database
Choosing the right databaseChoosing the right database
Choosing the right databaseDavid Simons
 
Graph theory in Practise
Graph theory in PractiseGraph theory in Practise
Graph theory in PractiseDavid Simons
 
CS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf bookCS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf bookappasami
 
Role Model of Graph Coloring Application in Labeled 2D Line Drawing Object
Role Model of Graph Coloring Application in Labeled 2D Line Drawing ObjectRole Model of Graph Coloring Application in Labeled 2D Line Drawing Object
Role Model of Graph Coloring Application in Labeled 2D Line Drawing ObjectWaqas Tariq
 
Skiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np completeSkiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np completezukun
 
Optimal Algorithm
Optimal AlgorithmOptimal Algorithm
Optimal Algorithmguest628caa
 
lecture 30
lecture 30lecture 30
lecture 30sajinsc
 
Chapter 14: The Nervous System Part 3 - Reflex Actions
Chapter 14: The Nervous System Part 3 - Reflex ActionsChapter 14: The Nervous System Part 3 - Reflex Actions
Chapter 14: The Nervous System Part 3 - Reflex Actionsj3di79
 
Graph theory 1
Graph theory 1Graph theory 1
Graph theory 1Tech_MX
 
introduction to graph theory
introduction to graph theoryintroduction to graph theory
introduction to graph theoryChuckie Balbuena
 
Заметки на полях
Заметки на поляхЗаметки на полях
Заметки на поляхVasily Tkachev
 
Assessment of the market position of the telecommunications company
Assessment of the market position  of the telecommunications company Assessment of the market position  of the telecommunications company
Assessment of the market position of the telecommunications company Yuliana Zaharova
 

Viewers also liked (20)

NP Complete Problems -- Internship
NP Complete Problems -- InternshipNP Complete Problems -- Internship
NP Complete Problems -- Internship
 
Choosing the right database
Choosing the right databaseChoosing the right database
Choosing the right database
 
Graph theory in Practise
Graph theory in PractiseGraph theory in Practise
Graph theory in Practise
 
CS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf bookCS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf book
 
Internship
InternshipInternship
Internship
 
Cognitive Radio Networks
Cognitive Radio NetworksCognitive Radio Networks
Cognitive Radio Networks
 
Role Model of Graph Coloring Application in Labeled 2D Line Drawing Object
Role Model of Graph Coloring Application in Labeled 2D Line Drawing ObjectRole Model of Graph Coloring Application in Labeled 2D Line Drawing Object
Role Model of Graph Coloring Application in Labeled 2D Line Drawing Object
 
Skiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np completeSkiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np complete
 
Optimal Algorithm
Optimal AlgorithmOptimal Algorithm
Optimal Algorithm
 
lecture 30
lecture 30lecture 30
lecture 30
 
Np hard
Np hardNp hard
Np hard
 
2 Graph Theory
2 Graph Theory2 Graph Theory
2 Graph Theory
 
Chapter 14: The Nervous System Part 3 - Reflex Actions
Chapter 14: The Nervous System Part 3 - Reflex ActionsChapter 14: The Nervous System Part 3 - Reflex Actions
Chapter 14: The Nervous System Part 3 - Reflex Actions
 
Graphs
GraphsGraphs
Graphs
 
NP completeness
NP completenessNP completeness
NP completeness
 
Graph theory 1
Graph theory 1Graph theory 1
Graph theory 1
 
introduction to graph theory
introduction to graph theoryintroduction to graph theory
introduction to graph theory
 
Mother's Day
Mother's DayMother's Day
Mother's Day
 
Заметки на полях
Заметки на поляхЗаметки на полях
Заметки на полях
 
Assessment of the market position of the telecommunications company
Assessment of the market position  of the telecommunications company Assessment of the market position  of the telecommunications company
Assessment of the market position of the telecommunications company
 

Similar to NP-COMPLETE PROBLEMS: POLY-TIME REDUCTIONS AND COMPUTING OPT SOLUTIONS

Algorithm chapter 10
Algorithm chapter 10Algorithm chapter 10
Algorithm chapter 10chidabdu
 
Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2Techglyphs
 
Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Deepak John
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexityAnkit Katiyar
 
Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem sumit gyawali
 
UNIT-V.pdf daa unit material 5 th unit ppt
UNIT-V.pdf daa unit material 5 th unit pptUNIT-V.pdf daa unit material 5 th unit ppt
UNIT-V.pdf daa unit material 5 th unit pptJyoReddy9
 
9. chapter 8 np hard and np complete problems
9. chapter 8   np hard and np complete problems9. chapter 8   np hard and np complete problems
9. chapter 8 np hard and np complete problemsJyotsna Suryadevara
 
Basic_concepts_NP_Hard_NP_Complete.pdf
Basic_concepts_NP_Hard_NP_Complete.pdfBasic_concepts_NP_Hard_NP_Complete.pdf
Basic_concepts_NP_Hard_NP_Complete.pdfArivukkarasu Dhanapal
 
Np completeness h4
Np completeness  h4Np completeness  h4
Np completeness h4Rajendran
 
Design and Analysis of Algorithms Exam Help
Design and Analysis of Algorithms Exam HelpDesign and Analysis of Algorithms Exam Help
Design and Analysis of Algorithms Exam HelpProgramming Exam Help
 
Lego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawingsLego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawingsMathieu Dutour Sikiric
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2S.Shayan Daneshvar
 

Similar to NP-COMPLETE PROBLEMS: POLY-TIME REDUCTIONS AND COMPUTING OPT SOLUTIONS (20)

Algorithm chapter 10
Algorithm chapter 10Algorithm chapter 10
Algorithm chapter 10
 
Teori pnp
Teori pnpTeori pnp
Teori pnp
 
Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2
 
Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Analysis and design of algorithms part 4
Analysis and design of algorithms part 4
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
class23.ppt
class23.pptclass23.ppt
class23.ppt
 
Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem
 
UNIT-V.pdf daa unit material 5 th unit ppt
UNIT-V.pdf daa unit material 5 th unit pptUNIT-V.pdf daa unit material 5 th unit ppt
UNIT-V.pdf daa unit material 5 th unit ppt
 
9. chapter 8 np hard and np complete problems
9. chapter 8   np hard and np complete problems9. chapter 8   np hard and np complete problems
9. chapter 8 np hard and np complete problems
 
Basic_concepts_NP_Hard_NP_Complete.pdf
Basic_concepts_NP_Hard_NP_Complete.pdfBasic_concepts_NP_Hard_NP_Complete.pdf
Basic_concepts_NP_Hard_NP_Complete.pdf
 
lect5-1.ppt
lect5-1.pptlect5-1.ppt
lect5-1.ppt
 
AA ppt9107
AA ppt9107AA ppt9107
AA ppt9107
 
Np completeness h4
Np completeness  h4Np completeness  h4
Np completeness h4
 
Design and Analysis of Algorithms Exam Help
Design and Analysis of Algorithms Exam HelpDesign and Analysis of Algorithms Exam Help
Design and Analysis of Algorithms Exam Help
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Lego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawingsLego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawings
 
P vs NP
P vs NP P vs NP
P vs NP
 
Introduction
IntroductionIntroduction
Introduction
 
Approx
ApproxApprox
Approx
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2
 

Recently uploaded

Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 

Recently uploaded (20)

Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 

NP-COMPLETE PROBLEMS: POLY-TIME REDUCTIONS AND COMPUTING OPT SOLUTIONS

  • 1. INDIAN INSTITUTE OF INFORMATION TECHNOLOGY, DESIGN & MANUFACTURING, KANCHEEPURAM STUDY OF NP-COMPLETE PROBLEMS: POLY-TIME REDUCTIONS AND COMPUTING OPT SOLUTIONS SUBMITTED BY: K SESHAGIRI RAO ID: 2010UIT190 INFORMATION TECHNOLOGY MNIT JAIPUR GUIDE: Dr. N SADAGOPAN ASSISTANT PROFESSOR COMPUTER ENGG. DEPT. IIIT D&M KANCHEEPURAM SIGNATURE (Dr. N Sadagopan) DATE OF SUBMISSION: 16-07-2013
  • 2. RESEARCH INTERNSHIP REPORT 2 INDEX TOPIC Pg. No. I. INTRODUCTION 3-4 II. PERMUTATION PROBLEMS 2.1 HAMILTONIAN PATH 2.2 HAMILTONIAN CYCLE 2.3 3-VERTEX COLORING 2.4 3-EDGE COLORING 5-9 III. SUBSET PROBLEMS 3.1 MINIMIZATION PROBLEMS 3.1.1 STEINER TREE 3.1.2 DOMINATING SET 3.1.3 VERTEX COVER 3.2 MAXIMIZATION PROBLEMS 3.2.1 INDEPENDENT SET 3.2.2 CLIQUE 3.3 EXACT-3-COVER 3.4 SATISFIABILITY 10-20 IV. POLYNOMIAL-TIME REDUCTIONS 4.1 3-SAT TO CLIQUE 4.2 CLIQUE TO INDEPENDENT SET 4.3 INDEPENDENT SET TO VERTEX COVER 4.4 VERTEX COVER TO HAMILTON CYCLE 4.5 HAMILTON CYCLE TO HAMILTON PATH 4.6 HAMILTON PATH TO HAMILTON CYCLE 4.7 3-SAT TO EXACT-3-COVER 4.8 VERTEX COVER TO DOMINATING SET 21-33 V. CONCLUSION 34
  • 3. RESEARCH INTERNSHIP REPORT 3 INTRODUCTION Any problem is either solvable or unsolvable. Solvability depends on the availability of an algorithm that terminates in finite amount of time. Such ones are said to be solvable and the rest are all unsolvable. Most of the unsolvable problems have a countably infinite domains. A problem to find the largest number in a finite set of integers is a solvable one as it terminates in finite time and gives a solution but finding the highest natural number or highest prime number in the set of natural numbers is an unsolvable one because the algorithm never terminates. SOLVABLE: The efficiency and complexity of the algorithm that solves a problem may be determined on the basis of space and time it takes to give an output. Considering time complexity, it cannot always be determined whether an algorithm is efficient in comparison to another one because time complexity always depends on the hardware configuration of the computer. So, it cannot always be taken as a criterion for deciding the efficiency of the algorithm. In order to avoid this, number of steps taken for getting the answer (in the worst case) is considered as a better option. Based on complexity, the set of problems may be classified as follows:  Polynomial time (Poly-time): If there exists an algorithm that runs in polynomial number of steps i.e., O( nk ), k is a natural number.  Exponential time (EXP-time): If all the algorithms run in exponential number of steps i.e., O( kn ), k is a natural number. NP COMPLETENESS: It’s not always possible to find a deterministic polynomial solution to a problem. Sometimes, problem may have to be solved in a machine with countably infinite no of processors within a polynomial amount of time. Such problems are called NP (Non-deterministic polynomial time problems). NP is the set of decision problems where the "yes"-instances can be accepted in polynomial time by a non-
  • 4. RESEARCH INTERNSHIP REPORT 4 deterministic Turing machine. An algorithm on such a non-deterministic machine consists of two phases, the first of which consists of a guess about the solution, which is generated in a non-deterministic way, while the second consists of a deterministic algorithm that verifies or rejects the guess as a valid solution to the problem. The complexity class P is contained in NP, but NP contains many important problems, the hardest of which are called NP-complete problems, for which no polynomial-time algorithms are known for solving them (although they can be verified in polynomial time). The most important open question in complexity theory, the P = NP problem, asks whether polynomial time algorithms actually exist for NP-complete, and by corollary, all NP problems. It is widely believed that this is not the case. NP COMPLETE: NP-complete is a subset of NP, the set of all decision problems whose solutions can be verified in polynomial time. A decision problem C is NP-complete if: 1. C is in NP, and 2. Every problem in NP is reducible to C in deterministic polynomial time. C can be shown to be in NP by demonstrating that a candidate solution to C can be verified in deterministic polynomial time. Note that a problem satisfying condition 2 is said to be NP-hard, whether or not it satisfies condition 1. NP HARD: NP-hard (Non-deterministic Polynomial-time hard), in computational complexity theory, is a class of problems that are, informally, "at least as hard as the hardest problems in NP". A problem H is NP-hard if and only if there is an NP-complete problem L that is polynomial time Turing-reducible to H (i.e., L ≤ TH).
  • 5. RESEARCH INTERNSHIP REPORT 5 PERMUTATION PROBLEMS 2.1 HAMILTONIAN PATH A Hamiltonian path or traceable path is a path that visits each vertex exactly once. A graph that contains a Hamiltonian path is called a traceable graph. A graph is Hamiltonian-connected if for every pair of vertices there is a Hamiltonian path between the two vertices. The path which is in bold mode is a Hamiltonian path for the given graph. Trivial solution to this problem is an exponential time one with a complexity O(n!). This problem is known to be NP-Complete by a polynomial-time reduction from the Vertex Cover problem. Interestingly, if the decision algorithm for Hamilton path problem is given, then we can get the Hamilton path in polynomial time. We below present an algorithm to find one such Hamilton path using a decision algorithm. As on date, it is known whether the decision algorithm is solvable in polynomial time or not. Any result towards that direction will only imply that P=NP. Algorithm using Decision Box: Let V(G) be the set of vertices of graph G and let the set of edges be E(G). As the vertices are traversed exactly once in the graph, exactly n-1 edges are present in the Hamiltonian path. Pass G to decision box and if this returns yes, there is a Hamiltonian path for this problem. If no, then no such path exists. If yes, remove the first vertex, say e1, and let the new graph be G1, and pass G1 to the decision box. If yes, it means that there is a Hamiltonian path which does not include e1. If no, it means that the edge is a must in the Hamiltonian path.
  • 6. RESEARCH INTERNSHIP REPORT 6 Proceed this until all the edges are checked in the similar way. The sub graph that is finally left is the Hamiltonian path for the given graph G. Although, multiple Hamiltonian paths exist for the given graph, this algorithm returns only one. This algorithm runs with a complexity O(n), where n is the number of edges. 2.2 HAMILTONIAN CYCLE In graphs, a Hamiltonian cycle of a graph G is a sub graph such that each vertex is traversed exactly once, except the ones at the edge of the cycle, and all the vertices in the graph are covered. The sub graph marked in the red color is a Hamiltonian cycle for the given graph. There may be many other cycles existing in the graph. Trivial solution to this problem is an exponential time one with a complexity O(n!). Using a decision box, this complexity can be brought down to polynomial time. Similar to Hamilton path problem, we below present a polynomial-time algorithm to compute the Hamilton Cycle, given a decision algorithm for Hamilton Cycle. Algorithm using Decision Box: Let V(G) be the set of vertices of graph G and let the set of edges be E(G). As the vertices are traversed exactly once in the graph (leaving the ones at the edges), exactly n edges are present in the Hamiltonian cycle. Pass G to decision box and if this returns yes, there is a Hamiltonian cycle for this problem. If no, then no such cycle exists.
  • 7. RESEARCH INTERNSHIP REPORT 7 If yes, remove the first edge, say e1, and let the new graph be G1, and pass G1 to the decision box. If yes, it means that there is a Hamiltonian cycle which does not include e1. If no, it means that the edge is a must in the Hamiltonian cycle. Proceed this until all the edges are checked in the similar way. The sub graph that is finally left is the Hamiltonian cycle for the given graph G. Although, multiple Hamiltonian cycles are existing for the given graph, this algorithm returns only one. This algorithm runs with a complexity O(n), where n is the number of edges. 2.3 3 VERTEX COLORING In graph theory, graph coloring is a special case of graph labelling. It is an assignment of labels traditionally called "colors" to elements of a graph subject to certain constraints. In its simplest form, it is a way of coloring the vertices of a graph such that no two adjacent vertices share the same color. This is called a vertex coloring. In the above fig., it can be observed that the graph has been colored using exactly 3 colors. This belongs to the category of 3 vertex coloring as the vertices are colored in this graph and that too using exactly 3 colors. The trivial solution to solve this coloring problem runs typically with a complexity O(2n ). So, it is necessary to find a polynomial time algorithm to solve this and this can be done only using a decision algorithm. This is an NP-Complete problem in theoretical computer science. Algorithm using Decision Box: Let G be the graph with vertex set V(G) and color set {c1, c2, c3}.
  • 8. RESEARCH INTERNSHIP REPORT 8 Pass G to the decision box which checks if the graph can be colored using only 3 colors or less. If yes, proceed forward and if otherwise no 3 color graph exists for the given one and if yes, proceed to next step of coloring the vertices of the graph with the given 3 colors. Color vertex v1 from the set V(G) with c1 and let the new graph be G1 and then, pass G1 to decision box. If it gives yes, leave the vertex colored. Otherwise, change the color to c2 and again pass G1 to decision box. Similarly, do upto we get a yes or all 3 colors are used up. Repeat the procedure for all the vertices and this must finally leave a graph colored with 3 colors given in the color set. Let there be a total of n vertices in the graph. So, the total complexity of coloring is O(3*n) in the worst case. So, the above algorithm runs in polynomial time using a decision box. 2.4 3 EDGE COLORING In graph theory, an edge coloring of a graph is an assignment of “colors” to the edges of the graph so that no two adjacent edges have the same color. For example, the figure to the right shows an edge coloring of a graph by the colors red, blue, and green. Edge colorings are one of several different types of graph coloring. The edge-coloring problem asks whether it is possible to color the edges of a given graph using at most k different colors, for a given value of k, or with the fewest possible colors. The minimum required number of colors for the edges of a given graph is called the chromatic index of the graph. For example, the edges of the graph in the illustration can be colored by three colors but cannot be colored by two colors, so the graph shown has chromatic index three.
  • 9. RESEARCH INTERNSHIP REPORT 9 By Vizing's theorem, the number of colors needed to edge color a simple graph is either its maximum degree Δ or Δ+1. For some graphs, such as bipartite graphs and high-degree planar graphs, the number of colors is always Δ, and for multigraphs, the number of colors may be as large as 3Δ/2. There are polynomial time algorithms that construct optimal colorings of bipartite graphs, and colorings of non-bipartite simple graphs that use at most Δ+1 colors; however, the general problem of finding an optimal edge coloring is NP-complete and the fastest known algorithms for it take exponential time. Algorithm using Decision Box: Let G be the graph with edge set E(G) and color set {c1, c2, c3}. Pass G to the decision box which checks if the graph can be colored using only 3 colors or less. If yes, proceed forward and if otherwise no 3 color graph exists for the given one and if yes, proceed to next step of coloring the edges of the graph with the given 3 colors. Color edge e1 from the set E(G) with c1 and let the new graph be G1 and then, pass G1 to decision box. If it gives yes, leave the edge colored. Otherwise, change the color to c2 and again pass G1 to decision box. Similarly, do upto we get a yes or all 3 colors are used up. Repeat the procedure for all the edges and this must finally leave a graph colored with 3 colors given the color set. Let there be a total of m edges in the graph. So, the total complexity of coloring is O(3*m) in the worst case. So, the above algorithm runs in polynomial time using a decision box.
  • 10. RESEARCH INTERNSHIP REPORT 10 SUBSET PROBLEMS 3.1 MINIMIZATION 3.1.1 VERTEX COVER A vertex cover of a graph G is a set C of vertices such that each edge of G is incident to at least one vertex in C. The set C is said to cover the edges of G. A minimum vertex cover of a graph is the set of minimum possible no. of vertices that cover all the edges in the graph. As we can see in the above two images that both the graphs have vertex covers in both figures but the VCs given the below one are minimum ones. The vertices coloured in red are the ones present in VC. Vertex cover of a complete graph is n-1. Vertex cover problem belongs to the class of NP-Complete ones. No successful polynomial time algorithm has been designed till today to find an optimum solution to this problem. Approximation algorithm: 1. Sort the vertices in descending order of the degree of vertices. 2. Pick the one with max degree and remove all the edges that are connected to this vertex. 3. Pick max from the remaining set. 4. Repeat this till the set of edges in the graph becomes zero. This algorithm definitely gives a VC but it cannot be proved that it always gives an optimum solution. So let’s say that it gives a solution OPT+K for some positive integer K. This algorithm also definitely runs in polynomial time. But this is not the solution that we need. Now, for an optimum solution with a non-deterministic Turing machine with 2n processors, we just need to spend a unit time to generate all the possible solutions
  • 11. RESEARCH INTERNSHIP REPORT 11 and test each one of them with one processor. So, this is solved in non- deterministic polynomial time. But this is an ideal and impractical case. For some practicality, let’s say a decision algorithm is given to us that just gives a yes/no output for some input. The working time and complexity of this decision box is not of importance and using this a polynomial time algorithm can be generated that produces an optimum solution for vertex cover problem for any graph. Decision box here is simply a black box to us and its working is not a matter of concern for us. Algo using decision box: Let the total no of vertices be ‘n’ and set be V(G) in graph G and let the set of edges be E(G). Now, is known that V(G) is itself a VC with cardinality n. Pass G, n to the decision box that tests if there exists a vertex cover of size n in graph G and returns yes if present otherwise no. If yes, pass G, n-1 and continue this until a first no appears. Say G, k is yes and G, k-1 is no. So, k is the cardinality of the minimum vertex cover. So, this runs with a complexity O(n). Claim 1: k is the size of the minimum VC if a first no appears at G, k-1. Now, remove a vertex v1 from the graph G and say its G1 and pass G1, k to decision box and see if the min VC changes. If it says it doesn’t change, the vertex v1 is not present in the VC and if it changes, that means this vertex v1 is a part of VC and add this to the set of VC. Add this back and now remove v2 and check similarly. This will finally generate the min VC for the graph G. This part runs with a complexity of O(n). So, total complexity is twice O(n) which is polynomial time. Claim 2: when the above algo terminates, the VC generated is a min VC. If we can prove claims 1 and 2, it will be clear that a VC algo that runs in polynomial time exists using a decision box. Proof for claim 1: V(G) will always be a vertex cover because this is the total set of vertices connecting all the edges in the graph and in this way all edges are covered.
  • 12. RESEARCH INTERNSHIP REPORT 12 Now in the above process, we get a first no at k-1. This means that no vertex cover exists that is of size k-1 for the graph G. for now say that k is the min VC. Let’s assume that there is an m < k-1 and G, m is true. So, by hypothesis, m is the size of the min VC. Now, let’s add (k-1-m) random no of vertices to this VC and this must give a VC of size k-1. But it is given that G, k-1 is false which is a contradiction. This means that no such m < k-1 exists and k is the cardinality of min VC. Proof for claim 2: From claim 1, it is clear that the cardinality of this set of VC is k. Now, lets assume that there is some edge uv which is not in this VC. So, add either u or v to this set which makes the cardinality of the min VC k+1 but this is a contradiction to the hypothesis. So, our assumption is false. Hence, the set VC generated after the algorithm is the minimum vertex cover. As both the claims are proved, it is clear that the algorithm gives a minimum vertex cover using a decision box, running in a polynomial time. 3.1.2 STEINER TREE Geometric Steiner tree problem states that, given N points in the plane, the goal is to connect them by lines of minimum total length in such a way that any two points may be interconnected by line segments either directly or via other points and line segments. The Steiner tree problem is superficially similar to the minimum spanning tree problem: given a set V of points (vertices), interconnect them by a network (graph) of shortest length, where the length is the sum of the lengths of all edges. The difference between the Steiner tree problem and the minimum spanning tree problem is that, in the Steiner tree problem, extra intermediate vertices and edges may be added to the graph in order to reduce the length of the spanning tree. These new vertices introduced to decrease the total length of connection are known as Steiner points or Steiner vertices. It has been proved that the resulting connection is a tree, known as the Steiner tree. There may be several Steiner trees for a given set of initial vertices.
  • 13. RESEARCH INTERNSHIP REPORT 13 The above figure clearly shows multiple Steiner trees for a given set of vertices (bold ones) for the given graph. The problem of Steiner tree is an NP-Hard type one and no polynomial time solution has been found yet. Algorithm using Decision Box: Let G be the given graph with vertex set V(G) and R be the set of vertices given that must be present in the Steiner tree. k is an integer given such that the maximum number of edges that can be used to connect the vertices in R is k. So, the minimum number of edges needed is |R| - 1 for |R| vertices in the set. Now pass G, |R|-1 to Decision box which checks if there is some possibility in the graph such that vertices in R may be connected using exactly |R|-1 number of vertices. If yes, proceed forward or else increase the number of edges passed by 1 and pass to decision box until k is reached in similar manner i.e., G, i is passed where I ranges from |R|-1 to k. Even if G, k gives a no, solution does not exist for the given set for that problem. If a first yes is obtained at some position for the problem, then it is the minimum number of edges needed to obtain a Steiner tree. Claim 1: The number of edges obtained from above procedure, say l, is the min one for a Steiner tree to be generated. After obtaining the min number of edges, say l, we must generate the tree itself. Remove an edge say e1 from the graph and let the new graph be G1. Pass G1, l
  • 14. RESEARCH INTERNSHIP REPORT 14 to decision box to see if it gives yes or not. Go on like this removing it the edges as long as the graph says yes and on obtaining no, restore the removed edge and this means that it is present in the min Steiner tree. This runs with complexity of O(n). Claim 2: The part of graph left at the end is the minimum Steiner tree. If both the above 2 claims are proved, it will be clear that this algorithm helps in generating the minimum Steiner tree. Proof for Claim 1: We know that G, l-1 is false from the hypothesis. So, let’s assume that there is some p<l-1 for which G, p is true. So, if we add l-1-p edges to this set, then the tree obtained must still be a Steiner tree but from the hypothesis, G, l-1 is never true. This is a contradiction and hence, our assumption is false. So, l is the number of edges in the min Steiner tree. Proof for Claim 2: From the above proof, we obtained that l is the number of edges in the minimum Steiner tree i.e. the cardinality of the Steiner tree is l. Let us assume that the tree obtained after the above algo is not the min Steiner tree. Let there be an uncovered vertex u in the set R. So, in order to cover this vertex, another edge say (u,v) must be added to the Steiner tree which makes the cardinality l+1 and this is a contradiction. So, our assumption that the set obtained is not a min Steiner tree is wrong. Hence, both the claims are proved and this shows that the algorithm generates a minimum Steiner tree. 3.1.3 DOMINATING SET In graph theory, a dominating set for a graph G = (V, E) is a subset DS of V such that every vertex not in DS is adjacent to at least one member of DS. It is also one of the NP-Complete decision problems in Computer Science. Minimum Dominating set is the smallest possible dominating set for a graph G. A minimal dominating set is one, which on removal of any of its elements, no longer remains a dominating set. It may not always be a minimum DS. All
  • 15. RESEARCH INTERNSHIP REPORT 15 minimum DSs are minimal but the converse is not always true. More than one minimum and minimal dominating sets may exist for a given graph G. The vertices in red represent the ones belonging to the dominating set. In fig. (a), the DS is of cardinality 3 which is not minimum as we have 2 elements each in fig. (b) and (c). But, all 3 of the above given figures are minimal dominating sets. For a complete graph, size of the minimum DS is 1. Algorithm: Trivial solution for the DS problem is that generate all possible subsets of V(G) and check for the smallest DS. But this takes O(2n) time. No polynomial time approximation algorithm has been discovered till date. In a non-deterministic frame, we may get the solution with a complexity O(n). Algorithm using decision box: Let n be the total number of vertices in graph G. The vertex set V(G) is a dominating set of size n. So, continuously pass G, i to decision box until we get a false such that i starts from n and ends at 1, reducing in steps of 1. Suppose we get first false at k-1. Then k is the cardinality of the min DS. Claim 1: k obtained in the above part is the size of min DS. Proof for claim 1: We know that G, k is true and G, k-1 is false. Assume that there is some m<k-1 for which G, m is true. So, it means that there is a dominating set of size m, which is less than k. After adding a few vertices to this set, it should still remain a DS. Say we add k- 1-m number of vertices to this set which makes its cardinality k-1 and it’s a DS.
  • 16. RESEARCH INTERNSHIP REPORT 16 But as per hypothesis, no DS of size k-1 exists. This is a contradiction. So, our assumption that there exists some m<k-1 for which G, m is true is not correct. Hence our claim that k is the size of the min DS is proved. 3.2 MAXIMIZATION 3.2.1 CLIQUE A clique in an undirected graph G is a subset of its vertices such that every two vertices in the subset are connected by an edge. In the above fig., sets {2, 3}, {4, 5}, {5, 2} are all cliques of size 2 as a vertex in the set is connected to every other vertex in that set. Maximum clique of a graph G is defined as the clique of largest cardinality possible for the given graph G. For eg., in the above fig, {1, 2, 5} is also a clique as every vertex in the set is connected to every other one and it is the largest one possible for that graph. The concept of maximal clique also plays a role in clique problems. Maximal clique is a set of vertices so that if other vertex in the graph can be added to, it will no longer remain a clique. Maximal cliques may be of very small size. For eg., {4, 5} is a maximal clique whereas {2, 5} is not because 1 can be added and the set still remains a clique. Every maximum clique is a maximal clique but the converse is not always true. For a complete graph, size of the maximum clique is ‘n’ and for all the rest of the graphs, it is always < n. Algorithm: Trivial solution for the clique problem is that generate all possible subsets of V(G) and check for the largest clique. But this takes O(2n ) time.
  • 17. RESEARCH INTERNSHIP REPORT 17 No polynomial time approximation algorithm has been discovered till date. In a non-deterministic frame, we may get the solution with a complexity O(n). Algorithm using decision box: Every single vertex is a clique. So, start passing G, i to decision box where, G is the graph and 1<= i <=n. Stop at the point where G, i is false for the first time. That means that no clique exists of size i. Hence, i-1 is the size of the largest clique. Let this be k. Claim 1: k obtained in the above algo is the size of the largest clique. Now, remove the vertex v1 from the graph and pass the new graph G1, k to the decision box and see if it is true. If it is true, remove that vertex. Now check for v2. If it is false, add it back or else remove it also. Similarly continue and the graph left finally is the maximum clique. Claim 2: The set obtained after the above algorithm is a maximum clique. If we are able to prove the above two claims, it will be proved that this algorithm will give a maximum clique. The complexity can be seen to be twice of O(n), which is very much a polynomial time running one. Proof for claim 1: Let there be some m > k+1 for which G, m is true in the decision box. So, size of the clique is m. Even if we remove a few vertices and their corresponding edges, it must still be a clique. Remove m-(k+1) vertices randomly from the clique set. Now, we have a clique of cardinality k+1 but it is given that G, k+1 is false which is a contradiction. Hence, our assumption is false. Hence, k is the size of the maximum clique. So, the claim has been proved. Proof for claim 2: From the above claim, it is clear that the cardinality of the maximum clique is k. Let us assume that there some vertex u, which is connected to each and every vertex in the clique set obtained from the algorithm. This vertex u is not included in the clique set.
  • 18. RESEARCH INTERNSHIP REPORT 18 So add this but this makes the cardinality of the set k+1. But the hypothesis says that the size of the max clique is k. This is a contradiction. Hence, our assumption that the set obtained is not the maximum clique is false. Hence, the claim is proved. 3.2.2 INDEPENDENT SET In graph theory, an independent set or stable set is a set of vertices in a graph G, no two of which are adjacent. That is, it is a set of vertices such that for every two vertices in IS, there is no edge connecting the two. Equivalently, each edge in the graph has at most one endpoint in the IS. Independent set can be simply said to be the complement of a Vertex Cover (problem 3.1.1). Because VC has all the edges covered with atleast one vertex present in the set and this means that all the left out vertices are disconnected and they can be said to me an IS. Maximum IS is the largest set possible for a graph G so that all the vertices in it are disjoint. Max IS is the complement of min VC for a given graph G. So, if we can obtain min VC with a polynomial time complexity using a decision algorithm, the max IS is also obtained, obviously, with the same complexity. A maximal IS is one, which on addition of any of the other vertices in GIS, no longer remains an IS. All maximum IS are maximal but the converse is not always true. In the above fig., the vertices in blue are the ones in IS. It is clearly visible that all of them are disconnected mutually.
  • 19. RESEARCH INTERNSHIP REPORT 19 3.3 SATISFIABILITY PROBLEM In computer science, satisfiability is the problem of determining if there exists an interpretation that satisfies a given Boolean formula. In other words, it establishes if the variables of a given Boolean formula can be assigned in such a way as to make the formula evaluate to TRUE. Equally important is to determine whether no such assignments exist, which would imply that the function expressed by the formula is identically FALSE for all possible variable assignments. In this latter case, we would say that the function is unsatisfiable; otherwise it is satisfiable. For example, the formula a AND b is satisfiable because one can find the values a = TRUE and b = TRUE, which make (a AND b) = TRUE. SAT was the first known example of an NP-complete problem. That briefly means that there is no known algorithm that efficiently solves all instances of SAT, and it is generally believed (but not proven) that no such algorithm can exists. Algorithm using a decision box: Say that C is the CNF form of all the given clauses, say c1 to cm. Let the variables be from x1 to xn. Pass C, x1 to the decision box which assigns True to x1 and checks for a combination of rest of all the variables so that C may return True. If such an assignment exists, x1 = 1 is in the solution set or else x1 = 0 is in the solution set. Now, similarly test for x2 to xn. If any of the variable and its complement are present in a single clause ci, solution to the problem does not exist. Or if any of the clauses is false by the part of solution we obtained for all combinations of rest of variables, no solution exists in that case as well. 3.4 EXACT 3 COVER In mathematics, given a collection S of subsets of a set X, an exact cover is a sub collection S* of S such that each element in X is contained in exactly one subset in S*. One says that each element in X is covered by exactly one subset in S*. An exact cover is a kind of cover. In computer science, the exact cover problem is a decision problem to find an exact cover or else determine none exists. The exact cover problem is NP-
  • 20. RESEARCH INTERNSHIP REPORT 20 complete and is one of Karp's 21 NP-complete problems. The exact cover problem is a kind of constraint satisfaction problem. The trivial algorithm to solve this problem is exponential time with a complexity O(2n ). Algorithm using Decision Box: Let X = {x1, x2, x3,…, x3q } be the variables arranged into sets of 3 element clauses C = {c1, c2, c3,…, cn } where n>=q. The problem is mainly described as selecting any q clauses from the clause set so that ci ∩ cj = ɸ for all ci, cj ∈ C and ⋃ 𝑐 𝑞 = X. Let S be the final set of clauses. Initially, S = ɸ. Add c1 to S and pass S, q-1 to decision box. It searches for any q-1 clauses combination from the set C and gives out yes if any such combination exists. In this case, leave c1 in S and remove it from C. Otherwise, remove c1 from both C and S. Add c2 to S obtained from above procedure and check in the same way as described. Repeat this process until required number of clauses reduces to 0 or all the clauses have been visited once. Finally the set S obtained is the exact 3 cover for the set of given clauses and variables.
  • 21. RESEARCH INTERNSHIP REPORT 21 POLYNOMIAL-TIME REDUCTIONS In computational complexity theory, a polynomial-time reduction is a reduction which is computable by a deterministic Turing machine in polynomial time. If it is a many-one reduction, it is called a polynomial-time many-one reduction, polynomial transformation, or Karp reduction. If it is a Turing reduction, it is called a polynomial-time Turing reduction or Cook reduction. Polynomial-time reductions are important and widely used because they are powerful enough to perform many transformations between important problems, but still weak enough that polynomial-time reductions from problems in NP or co-NP to problems in P are considered unlikely to exist. This notion of reducibility is used in the standard definitions of several complete complexity classes, such as NP-complete, PSPACE-complete and EXPTIME-complete. 4.1 3-SAT TO CLIQUE Let F be a 3-Conjunctive Normal Form formula C1, C2, C3,…, Ck are Clauses in F Xj,1, Xj,2, Xj,3 are the literals in Cj For this reduction to be possible, there must be an instance of 3-SAT which must be polynomial time reducible to Clique and also an instance of Clique that can be reduced to 3-SAT in polynomial time. Construction: For each literal Xj,q in F, create a distinct vertex in graph G representing it. G contains all the edges except – the edges that connect vertices in same clause and the edges that connect vertices which are negation of one another. This construction will generate something like this This construction will generate a graph G and reduction is possible if we can prove that F is satisfiable ↔ G has a K-Clique
  • 22. RESEARCH INTERNSHIP REPORT 22 →: If F is true, we need to show that G has a K-clique. For F to be satisfiable, atleast one literal must be true in each and every clause. So, all such literals are connected in the graph that was constructed. So, atleast K such literals are present, all clauses combined. Hence, it is clear that such a K combination is a K-Clique. So, the forward direction is true. ←: If there is a K-Clique in graph G, it is needed to be proved that F is satisfiable. Graph G has a K-Clique means that each and every edge in the clique is between the literals in different clauses because, from the construction, edges don’t exist between literals in same clause. So, every one of the K-Clauses has one true instance of one of the literals. So, the formula F is satisfiable. As we have proved that the statement is true for both forward and backward directions, the statement is proved. So 3-SAT is polynomial time reducible to Clique.
  • 23. RESEARCH INTERNSHIP REPORT 23 4.2 CLIQUE TO INDEPENDENT SET The input is graph G = (V, E) and integer k≤|V|. Does the graph contain a clique of j vertices; i.e. is there a subset S⊂V , where |S|≤j, such that every pair of vertices in S defines an edge of G? For example, the graph in Figure above contains a clique of five vertices. In the independent set problem, we looked for a subset S with no edges between two vertices of S. However, for a clique, we insist that there always be an edge between two vertices. A reduction between these problems results by reversing the roles of edges and non-edges, an operation known as complementing the graph: Independent Set (G, k) Construct a graph G = (V', E') where V'=V, and For all (i, j) not in E, add (i, j) to E' Return the answer to Clique (G', k) These last two reductions provide a chain linking three different problems. The hardness of independent set is implied by the hardness of the clique, which is implied by the hardness of 3-SAT. By constructing reductions in a chain, we link together pairs of problems in implications of hardness. Our work is done as soon as all these chains begin with a single problem that is accepted as hard. Satisfiability is the problem that serves as the first link in this chain. Thus, an instance of a K-Clique is reduced in polynomial number of steps to an instance of independent set. The reduction is hence successful.
  • 24. RESEARCH INTERNSHIP REPORT 24 4.3 INDEPENDENT SET TO VERTEX COVER Let G be a given graph with vertices V(G) and edges E(G). Let VC be the vertex cover of the graph G. So, each and every edge in E has atleast one end point in VC. If we remove VC from V, no edge remains in the graph. So, the graph is totally disconnected and this means that it is an independent set. In the above figure, the vertices marked in red are the VC and the ones in blue belong to independent set. The vertex cover is of size 3 and Independent set is of size 4 and the total number of vertices are 7. Both VC and IS do not have any common vertex. It is clearly visible that independent set is the complement of the vertex cover with respect to the vertices present in it. So, V’ = V-VC is the independent set. It is possible to reduce Independent set into a vertex cover in polynomial time. Hence, the reduction is true. Also, we obtained that Independent set is an NP-Complete problem ( by reduction from another NPC). Now, Vertex cover is obtained by reduction from Independent set, which is an NPC. So, Vertex Cover also is an NP-Complete problem.
  • 25. RESEARCH INTERNSHIP REPORT 25 4.4 VERTEX COVER TO HAMILTON CYCLE For every edge in the Minimum Vertex Cover problem, we must reduce it to a contraption in the Hamiltonian Cycle Problem as explained the figure below. An edge (u, v) must be transformed into a fig with 12 vertices in the following way. There are only three possible ways that a cycle can include all of the vertices in this contraption. These are depicted in the figures below. All components that represent edges connected to u are strung together into a chain. If there are n vertices, then we will have n of these chains, all interwoven. The only other changes we need to make are at the ends of the chains.
  • 26. RESEARCH INTERNSHIP REPORT 26 In this way, after making all the changes as described in the above process, the graph given below is transformed in the following way. If we want to know if it’s possible to cover the original graph using only k vertices, this would be the same as seeing if we can include all of the vertices using only k chains. How can we include exactly k chains in the Hamiltonian Cycle problem using the vertex cover is the problem of concern for us now. If it is reducible in polynomial time, then our reduction from vertex cover to Hamiltonian cycle is true. To solve this, we must add k extra vertices and connect each of them to the beginning and end of every chain. Since each vertex can only be included once, this allows k chains in the final cycle. Let the graph be the figure given below and its transformed one initially is given.
  • 27. RESEARCH INTERNSHIP REPORT 27 After applying the above procedure, i.e., adding k vertices to the transformed graph and an edge from these vertices to each and every beginning and end vertex in the transformed graph, the newly generated graph is as shown below. So, these k edges in the final transform correspond to the Hamiltonian cycle obtained for that graph using Vertex cover. As this procedure runs in polynomial number of steps, it is a polynomial time reduction from vertex cover to the Hamiltonian cycle.
  • 28. RESEARCH INTERNSHIP REPORT 28 4.5 HAMILTON CYCLE TO HAMILTON PATH Given instance of Hamiltonian Cycle G, choose an arbitrary node V and split it into two nodes to get graph G’ as shown in the figure below. Now any Hamiltonian Path must start at V’ and end at V’’. For a polynomial time reduction to exist from Hamilton cycle to Hamilton path, it must be proved that HAMILTON CYCLE ↔ HAMILTON PATH 1. If graph G has a Hamilton cycle that includes a vertex, say V, then a Hamilton path must exist in the same cycle after we split up V into V’ and V’’. So, the Hamilton Path starts at V’ and ends at V’’. 2. If graph G has a Hamilton Path staring at V’ and ending at V’’, it is clear that after joining V’ and V’’ to obtain V, the path gets converted into a Hamilton Cycle. So, the converse is also proved. Hence, the reduction from Hamiltonian cycle to Hamiltonian path is existing. The complexity of this reduction is just traversing each vertex in the Hamilton Cycle only once which means it is O(n) i.e., it is a polynomial time complex reduction. 4.6 HAMILTON PATH TO HAMILTON CYCLE To show that HP reduces to HC, we need to show Ham. Path can solved using Ham. Cycle. Let G = (V, E) be the input to HP and G' = (V', E') be the input to HC and let T be the transformation function (reduction function) such that: G' = T(G) and HP(G) = HC(T(G')) Try the following reduction:
  • 29. RESEARCH INTERNSHIP REPORT 29 Assume there is an algorithm HC that takes a graph G' = (V', E') and answers the question whether G' contains a simple cycle. Let v' be a vertex not in G. The reduction is as follows: V' = {V, v'} i.e., G' is G with one extra vertex v' E' = {E, (v', u) for all u in V} i.e., v' has an edge to every other vertex in V 1. This reduction runs in Polynomial Time. Adding one extra vertex takes constant time. Adding edges from v' to all vertices in V takes O(|V|) time. Therefore, the transformation function T runs in Polynomial time. 2. For all strings G, if G is a YES input to HP, then T(G) is a YES input to HC. Assume G is a YES input to HP, meaning graph G contains a simple path. Let the start vertex for that simple path be called s and the end vertex be called t. G' = T(G). G' will contain the simple path from s to t just like G. G' will also contain a vertex v' with two edges (t, v') and (v', s). Now G' must contain a simple cycle s  t  v' s (where s  t is the simple path between s and t found in G). Since G' contains a simple cycle, T(G) is a YES input to HC. 3'. For all strings G, if T(G) is a YES input to HC then G is a YES input to HP. Assume that G' = T(G) is a YES input to HC. Then G' contains a simple cycle that must go through v'. Let C be the name of the simple cycle in G'. C must go through v' and two other adjacent vertices t and s such that edges (t, v') and (v', s) must be in C. Now C can be thought of a simple path between s and t (call it S) and the two edges connecting v' with s and t. So, C = {S, (t, v'), (v', s)}. Cycle C is a simple cycle, which means it does not visit the same vertex twice, so aside from (t, v') and (v', s) C does not contain any edge connecting v' with any other vertex, which means that S does not contain any edges leading to v' which means that S is entirely contained in E. S visits every vertex in V' except for v', so S visits every vertex in V. Since S is a simple path that uses edges in E and visits every vertex in V, S must be a simple path in G. Therefore G contains a simple cycle and G is a YES input to HP. Thus, it is shown that Hamiltonian Path is polynomial time reducible to Hamiltonian cycle.
  • 30. RESEARCH INTERNSHIP REPORT 30 4.7 3-SAT TO EXACT-3-COVER Membership in NP is obvious. Given the guessed cover, we need only verify, by scanning each subset in the cover in turn, that all set elements are covered. We want to reduce 3-SAT to X3C. The first question to address is the representation of a truth assignment. One possible solution is to set up two three-sets for each variable and to ensure that exactly one of the two three-sets is selected in any solution. The latter can be achieved by taking advantage of the requirement that the cover be exact: once a three-set is picked, any other three-set that overlaps with it is automatically excluded. Since a variable may occur in several clauses of the 1in3SAT problem and since each element of the X3C problem may be covered only once, we need several copies of the construct corresponding to a variable (to provide an “attaching point” for each literal). This in turn raises the issue of consistency: all copies must be “set” to the same value. Let an instance of Positive 1in3SAT have n variables and k clauses. For each clause, c = {x, y, z}, we set up six elements, xc, yc, zc, tc, f ′c , and f ′′c. The first three will represent the three literals, while the other three will distinguish the true literal from the two false literals. For each variable, we construct a component with two attaching points (one corresponding to true, the other to false) for each of its occurrences, as illustrated in Figure and described below. Let variable x occur nx times (we assume that each variable considered occurs at least once). We set up 4nx elements, of which 2nx will be used as attaching points while the others will ensure consistency. Call the attaching points Xt i and Xf i, for 1 ≤ i ≤ nx ; Call the other points pi x , for 1≤ i ≤ 2nx . Now we construct three sets. The component associated with variable x has 2nx sets: • {p2i-1x, p2i x, Xt i} for 1 ≤ i ≤ nx, • {p2i x, p2i+1 x, Xf i} for 1 ≤ i < nx, and • {p2nx x, p1 x, Xf nx}.
  • 31. RESEARCH INTERNSHIP REPORT 31 Each clause c = {x, y, z} gives rise to nine three-sets, three for each literal. The first of these sets, if picked for the cover, indicates that the associated literal is the one set to true in the clause; for literal x in clause c, this set is {xc, tc, Xt i } for some attaching point i . If one of the other two is picked, the associated literal is set to false; for our literal, these sets are {xc, f′c, Xf i} and {xc, f′′c, Xf i}. Overall, our transformation produces an instance of X3C with 18k elements and 15k three- sets and is easily carried out in polynomial time. Now notice that, for each variable x, the element p1 x can be covered only by one of two sets: {p1 x, p2 x, Xt 1} or {p2nx x, p1 x, Xf nx}. If the first is chosen, then the second cannot be chosen too, so that the element p2nx x must be covered by the only other three-set in which it appears, namely {p2nx-1 x, p2nx x, Xtn x}. Continuing this chain of reasoning, we see that the choice of cover for p1 x entirely determines the cover for all pi x, in the process covering either (i) all of the Xf i and none of the Xt i or (ii) The converse. Thus a covering of the components associated with variables corresponds to a legal truth assignment, where the uncovered elements correspond to literal values. Turning to the components associated with the clauses, notice that exactly three
  • 32. RESEARCH INTERNSHIP REPORT 32 of the nine sets must be selected for the cover. Whichever set is selected to cover the element tc must include a true literal, thereby ensuring that at least one literal per clause is true. The other two sets chosen cover f′c and f′′c and thus must contain one false literal each, ensuring that at most one literal per clause is true. Our conclusion follows. From this reduction and the preceding ones, we see that a typical reduction from a satisfiability problem to another problem uses a construction with three distinct components. We often transform an asymmetric satisfiability problem into a symmetric problem in order to take advantage of the rigidity of 1in3SAT. In such cases, we must provide an indication of which part of the solution is meant to represent true and which false. This is often done by means of enforcers (in the terminology of Garey and Johnson). The following proof presents a simple example of the use of enforcers; it also illustrates another important technique: creating exponentially large numbers out of sets. 4.8 VERTEX COVER TO DOMINATING SET Given a potential dominating set S, we can check in polynomial time that every vertex is either in S, or adjacent to a vertex in S. Note that we can assume there are no isolated vertices in G, because a graph G with l isolated vertices has a dominating set of size k iff the graph with those isolated vertices removed has a dominating set of size k −l, since each isolated vertex must be in every dominating set. Now, we reduce VC to DS and show that it is NP-complete. Given an instance of VC, with graph G = (V, E) and parameter k, construct a new graph G’. First add all vertices and edges of G to G’. Then, for each edge e = (u, v) ∈ E, add a node we to V’, and add edges (u, we) and (v, we) to E’. Note that we can assume the vertex cover instance has no isolated vertices since removing those vertices will exactly preserve the set of feasible solutions. There is a vertex cover of size k in G iff there is a dominating set of size k in G’. I. If we have a vertex cover S of size k in G, then the claim is that S is a dominating set for G’ as well.
  • 33. RESEARCH INTERNSHIP REPORT 33 Consider any node v ∈ V’. We must show that either v ∈ S or there is some adjacent node which is in S. There are two cases. Case 1: v is an original node from V. Since there are no isolated vertices in G, there is some edge (u, v) ∈ E. Since S is a feasible vertex cover, one of u and v must be in S. Thus, either v ∈ S, or an adjacent node is in S. Case 2: v = we is a new node added to V’, where e ∈ E. By the previous argument, if e = (i, j), then either i ∈ S or j ∈ S. But we know that the edges (i, we) and (j, we) are both in E’. So, we is adjacent to a node in S. Thus, we have that S is a dominating set in G’ of size k. II. Assume we have a dominating set S in G’ of size k. So, claim is that S is a VC of size k with respect to graph G. If there are any nodes we in S, with e = (u, v), we can replace we by either u or v, and we will still have a dominating set, since removing we can only potentially un-cover nodes u and v, and (u, v) ∈ E’. If u and v are both in S, then we can replace we by any arbitrary vertex to maintain that the set has size k. After this procedure has finished, we have a set S’ which only consists of vertices in V. The claim is that this set S’ is a vertex cover for G. Consider any edge e = (u, v) ∈ E. Since S’ is a dominating set in G’, either we ∈ S’, or some node adjacent to we is in S’. But we constructed S’ from vertices in V, so it must be the case that some node adjacent to we is in S’. But the only nodes adjacent to we in G’ are u and v, so one of them is in S’. Thus, every edge e ∈ E is adjacent to some node in S’, so it is a feasible vertex cover.
  • 34. RESEARCH INTERNSHIP REPORT 34 CONCLUSION The report clearly depicts the fact that Subset Problems and Permutation Problems of theoretical Computer Science are solved in Polynomial time using different decision algorithms, based on the problem. If a decision algorithm is not used, these problems can’t be designed in polynomial time. Instead, a non- deterministic algorithm may be used but it is not practically feasible to solve that way. The permutation problems solved are Hamiltonian Path, Hamiltonian Cycle, Vertex Coloring, 3-Edge Coloring and the problems of Subset category are Steiner Tree, Dominating Set, Minimum Vertex Cover, Maximum Independent Set, Maximum Clique, Exact-3-Cover and Satisfiability. A problem is NP-Complete if it belongs to the class of NP problems and it must be reducible to each and every other problem in NP class Or the problem must be reduced in polynomial time from another NP-Complete problem. SAT is an NPC (NP-Complete) and it is proven. Hence, it is considered NPC in this document by default. 3-SAT can be reduced from SAT. Clique is reduced from 3-SAT in polynomial time. Then, Independent set is reduced from Clique and Vertex cover is reduced from Independent Set. Hamiltonian Cycle is reduced from Vertex Cover. Similarly, other reductions are clearly proved in this report. Date: 16-07-2013 Signature ( Dr. N Sadagopan )