Proof that Path Selection Decision problem is NP-Complete

Prerequisite – NP-Completeness
The decision problem of path selection problem asks if it is possible to select at least k paths from the given paths of a graph such that no two selected paths share any vertex.

To prove that a problem is NP-Complete, we need to show that it is both NP and NP-Hard. We use PSP to denote our path selection decision problem.

The PSP belongs to NP :
We prove this by constructing a polynomial time verifier for the problem. If any problem is in NP, then, given a ‘certificate’ (a solution) to the problem and an instance of the problem (a graph G and a positive integer k, in this case), we will be able to verify (check whether the solution given is correct or not) the certificate in polynomial time.

The certificate for PSP is a set of paths P’. These are independent paths with no common edges. We can check whether there are k paths which are independent for the given a graph G(V, E)) and paths P in the following manner:

Check if P' is a subset of P
If not, the given solution is wrong
The number of paths in P' is at least k
If not, the given solution is wrong

Initialize a list of boolean with length |V|
for each path p in P'
    for each vertex in p
        check if it is marked True in our list
        If so, the given solution is wrong
        Else, marks the vertex as True

Since no vertex was marked twice,
given solution is correct.

The above verifier is polytime since:



  1. Checking P’ is a subset of P can be done in O(|P|).
  2. Checking number of paths in P’ can be done in O(|P’|)
  3. Checking all the paths are disjoint can be done in O(|V|)

Hence, total time complexity :
 O(|P|) + O(|P'|) + O(|V|) = O(|V|) (\text{as}\space |P'|\leq|P|\leq|V|)
Therefore, the PSP has polynomial time verifiability and hence belongs to the NP Class.

The Clique Decision Problem belongs to NP-Hard :
To prove that PSP is NP Hard, we take some problem which has already been proven to be NP Hard (Independent Set in our case), and show that this problem can be reduced to the PSP in polynomial time. Since we know Independent set is NP complete, hence it is also NP hard.

Given a IS instance –

G=(V, E) and k 

We construct the PSP instance in the following manner:

We create a new graph G’. For every vertex vi in G:

  1. We denote a path by Pi for vi.
  2. Let e1, e2, …, er be the edges connected to vi. We introduce a vertex for each such edge in G’. Further, we introduce a pair of vertices in G’ – si, ti.

Thus,
P_i = (s_i, e_1, e_2, · · · e_r, t_i)

We can clearly see that the above reduction is polytime(with complexity = O(|V|+|E|)) as we are essentially iterating over all the vertex and the edges in our initial graph.

Proof :
Proof that the Independent Set problem reduces to the Path Selection Problem. To prove that our reduction is correct we prove the following two arguments.



(i) YES, instance for IS => Yes instance for PSP
We have, YES instance for IS.

  1. For a graph G=(V, E) there exist an independent set of size at least k.
  2. There exist at least k vertices that don’t share any edge.
  3. There exist at least k paths that don’t share any node in the instance of PSP. Since we are defining the vertices of G to be analogous to paths in the instance of PSP and edges of G to be analogous to vertices in those paths. And any of these path sharing nodes would mean that some two vertices in the independent set share a common edge which is never possible.
  4. Yes, instance for PSP.

(ii) YES, instance for PSP => Yes instance for IS
ETP: No instance for IS => No instance for PSP. (Proof by contrapositive.).

We know that whenever there exist an independent set of size at least k, there exist an independent set of size exactly k(This can be done by taking the subset of size k from the bigger set). Hence, the contrapositive is also true. (i.e, Whenever there cannot exist an independent set of size exactly k, there cannot exist an independent set of size at least k).

We have No instance of IS.

  1. For a graph G=(V, E) there cannot exist an independent set of size k.
  2. It is not possible to find k vertices of G that don’t share any edge.
  3. Every set S of vertices of size k would contain vi and vj that share an edge.
  4. Since we are defining the vertices of G to be analogous to paths in the instance of PSP and edges of G to be analogous to vertices in those paths, every k size set of Paths in instance of PSP would share a node.
  5. There cannot exist k paths that don’t share any node in the instance of PSP.
  6. No instance for PSP.

Hence, for a particular instance, the IS problem is reduced to the PSP. Therefore PSP is NP-Hard.

Thus, The Path Selection Decision Problem is NP and NP-Hard. Therefore, the Path Selection Decision problem is NP-Complete.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.