Verification algorithm for minimum vertex cover? - algorithm

We know that the minimum vertex cover is NP complete, which means that it is in the set of problems that can be verified in polynomial time.
As I understand it, the verification process would require the following:
Verify that the solution is a vertex cover at all
Verify that the solution is the smallest possible subset of the source graph that satisfies condition #1
I'm finding it hard to establish that step #2 can be done in polynomial time. Can anyone explain how it is?

The minimum vertex cover is NP-hard. It is only NP-complete if it is restated as a decision problem which can be verified in polynomial time.
The minimum vertex cover problem is the optimization problem of finding a smallest vertex cover in a given graph.
INSTANCE: Graph G
OUTPUT: Smallest number k such that G has a vertex cover of size k.
If the problem is stated as a decision problem, it is called the vertex cover problem:
INSTANCE: Graph G and positive integer k.
QUESTION: Does G have a vertex cover of size at most k?
Restating a problem as a decision problem is a common way to make problems NP-complete. Basically you turn an open-ended problem of the form "find the smallest solution k" into a yes/no question, "for a given k, does a solution exist?"
For example, for the travelling salesman problem, verifying that a proposed solution the shortest path between all cities is NP-hard. But if the problem is restated as only having to find a solution shorter than k total distance for some k, then verifying a solution is easy. You just find the length of the proposed solution and check that it's less than k.
The decision problem formulation can be easily used to solve the general formulation. To find the shortest path all you have to do is ratchet down the value of k until there are no solutions found.

Related

Proving NP completeness of optimal path cover

This paper solves the optimal path cover problem for block graphs or bipartite permutation graph. In the third line of its introduction it's written that optimal path cover problem is NP-Complete and has given reference to "Computer and intractability: a guide to the theory of NP-completeness by David S. Johnson, Michael R. Garey". But I couldn't find its proof in the book. If anyone knows how to prove NP-Completeness of this problem then share your solution.
Optimal path cover problem:
Given a graph G, find a minimum number of
vertex disjoint paths which together cover all the vertices of the
graph.
Considering the obvious decision variant (ie given k, is there a cover with k paths)
OPC(k=1) detects Hamiltonian paths, so clearly it's NP-hard.
It's also in NP because given the paths, checking whether they're disjoint and covering is easy.

NP-complete to determine vertex cover

Is it right that "it is NP-complete to determine if a graph contains a vertex cover of size 99"???
and
is it right that " it takes linear time to determine if a graph contains a vertex cover of size 99"???
One more, is it right to say that " No NP-complete problem can be solved in polynomial time unless the VERTEX COVER problem admits a polynomial-time algorithm."???
"is it NP-complete to determine if a graph contains a vertex cover of size 99"
Pedantically: no.
This problem can be solved in polynomial time. However, the following algorithm is completely useless in practice.
The approach for a graph with n vertices is simply to test all C(n,99) possible choices of vertex cover. For each choice, we test all edges (at most n*(n-1) edges in the graph) to see if either of their vertices are included.
There are fewer than n^99 ways of choosing the vertex cover, so overall this algorithm has polynomial complexity of n^101.
As noted by j_random_hacker, this answer assumes that the vertex size of 99 is a known constant. If the 99 is meant to be a variable and is part of the input, then the problem become the standard NP-complete vertex cover problem.

Is this bipartite graph optimization task NP-complete?

I have been trying to find out a polynomial-time algorithm to solve this problem, but in vain. I'm not familiar with the NP-complete thing. Just wondering whether this problem is actually NP-complete, and I should not waste any further effort trying to come up with a polynomial-time algorithm.
The problem is easy to describe and understand. Given a bipartite graph, what is the minimum number of vertices you have to select from one vertex set, say A, so that each vertex in B is adjacent to at least one selected vertex.
Unfortunately, this is NP-hard; there's an easy reduction from Set Cover (in fact it's arguably just a different way of expressing the same problem). In Set Cover we're given a ground set F, a collection C of subsets of F, and a number k, and we want to know if we can cover all n ground set elements of F by choosing at most k of the sets in C. To reduce this to your problem: Make a vertex in B for each ground element, and a vertex in A for each set in C, and add an edge uv whenever ground element v is in set u. If there was some algorithm to efficiently solve the problem you describe, it could solve the instance I just described, which would immediately give a solution to the original Set Cover problem (which is known to be NP-hard).
Interestingly, if we are allowed to choose vertices from the entire graph (rather than just from A), the problem is solvable in polynomial time using bipartite maximum matching algorithms, due to KÅ‘nig's Theorem.

Is finding whether k different perfect matchings exist in a bipartite graph co-NP?

Few definitions first. The co-NP problem is a decision problem where the answer "NO" can be verified in polynomial time. The perfect matching in a bipartite graph is a set of pairs of nodes (a pair is an edge in the graph) and where every node occurs in this set exactly once.
I am given an n x n bipartite graph, and I am trying to find out if the problem of finding whether k different perfect matchings exist in the graph, where k= polynomial(n), is a co-NP problem.
Work done so far
To initially simplify the problem, I believe that if k=2, then this is a co-NP problem. I think this is true, because the bipartite graph does not have 2 different perfect matchings, if there does not exist an exchange of neighbors between 2 nodes. I define the exchange of neighbors as the following. Let G1 be the first set in the graph, and G2 be the second set in the graph. The exchange occurs when we have a subset of G1, S1={A,B}, and a second subset of G2, S2={X,Y}, where {(A,X),(A,Y),(B,X),(B,Y)} belongs to the set of edges E. I call it exchange because if A was initially matched with X, and B with Y, then when A gets paired with Y, and B with X, A and B have exchanged their neighbors. I believe that the only way to have 2 different perfect matchings is to have at least one such exchange.
Now, we can verify that no such exchange exist in polynomial time. This is true since getting all the possible subsets S1 and S2 has O(n^4) time complexity. This because we need (n choose 2) from G1 multiplied by (n choose 2) from G2, and this gives us an upper bound of n^4.
I am not sure if this is a co-NP problem, but it is NP for certain. I think you have a little mixed up the definition of "verifying an answer". In complexity theory verify an answer means that you provide a certificate that proves that your answer is correct, and such certificate may be checked (verified) in polynomial time.
For example, in the case of your problem, if you have a set k different perfect matchings, that will be a good certificate, verifying it means checking that it is indeed a set of perfect matchings in your input graph. You can check this in polynomial time by checking that all edges are in you graph and in each matching no two edges share a vertex, and all of them are different. Since the number of edges in a matching is linear, then verifying each matching can be done in polynomial time, then, since k is polynomial, we verify that property for all matchings also in polynomial time. Finaly, checking that all are different can be done in k square times something polynomial on n, yielding a polynomial complexity. So yes, your problem can be verified in polynomial time, and thus it is in NP.
Now, if you can find such certificate in polynomial time that will be proof enough that you problem is in P, and all problems in P are in NP and in co-NP. So I see two possible ways to solve this, you may prove that your problem is in P, that will yield a yes answer to your question, or you may prove that your problem is NP-complete, that will prove that your answer is no, since all NP-complete problems are not in co-NP (unless P = NP).
Any other way of proving that your problem is or is not in co-NP, might be very difficult and confusing, in fact the work you have done so far was moving towards proving that you can decide negative cases in polynomial time which is a different thing as verifying them, that would prove that it is co-NP, but because you proved that it is in P.

Prove NP-Completeness clique + independent set graph

"Prove that it is NP-Complete to determine given input G and k whether G has both a clique of size k and an independent set of size k. Note that this is 1 problem, not 2; the answer is yes if and only if G has both of these subsets."
We were given this problem in my algorithms course and a large group of students could not figure it out. Here is what we have so far...
We know that both the clique and independent set problems are NP-Complete in of themselves. We also know that the verification of this problem, given some "certificate" is in NP.
The problem is somehow performing a reduction on the above problem (which contains both independent sets and cliques) to either a problem consisting entirely of cliques or independent sets (at least that's what we think we need to do). We don't know how to perform this reduction without losing information needed to reduce the reduction back to its original form.
Hint: Reduce CLIQUE to this problem, by adding some vertices.
Thanks to "Moron" and "Rafal Dowgird" for the hints! Based on that I think I've got a solution. Please correct me if I am incorrect:
Since we already know the the clique and independent-set problems are NP-Complete, we can use that as a foundation for proving our problem. Let's call our problem the Combination Clique Independent Set problem (CCIS).
Suppose we are given a graph G which has a clique C of size k. We can reduce this graph into a graph G' (read: G prime) which has both a clique C' of size k' and independent-set I of size k' by attaching k vertices to each vertex in C. This reduction occurs in polynomial time since the addition of the vertices takes O(n*k) time (n vertices in the graph and k vertices attached to each node).
Note that C=C' and k=k'.
Now suppose we are given a graph G' which has a clique C' of size k' and independent-set I of size k' which is determined to be true. The reduction to the clique problem is trivial since we don't need to modify the graph at all to find only a clique.

Resources