Subgraph Isomorphism Problem: We have two undirected graphs G1 and G2. The problem is to check whether G1 is isomorphic to a subgraph of G2.
Graph Isomorphism: Two graphs A and B are isomorphic to each other if they have the same number of vertices and edges, and the edge connectivity is retained. There is a bijection between the vertex sets of the graphs A and B. Hence, two vertices u, v are adjacent to each other in A if and only if f(u), f(v) are adjacent in B (f is a bijection).
To prove that a problem is NP-Complete, we have to show that it belongs to both NP and NP-Hard Classes. (Since NP-Complete problems are NP-Hard problems which also belong to NP)
The Subgraph Isomorphism Problem belongs to NP - If a problem belongs to the NP class, then it should have polynomial-time verifiability. Given a certificate, we should be able to verify in polynomial time if it is a solution to the problem.
Proof:
The Subgraph Isomorphism Problem belongs to NP - If a problem belongs to the NP class, then it should have polynomial-time verifiability. Given a certificate, we should be able to verify in polynomial time if it is a solution to the problem.
Proof:
- Certificate: Let G be a subgraph of G2. We also know the mapping between the vertices of G1 and G.
- Verification: We have to check if G1 is isomorphic to G or not. (i) Checking if the mapping is a bijection and (ii) Verifying if, for every edge (u, v) in G1, there is an edge (f(u), f(v)) present in G takes polynomial time.