The subgraph-isomorphism problem takes two undirected graphs G1 and G2, andit asks whether G1 is isomorphic to a subgraph of G2. Show that the subgraph-isomorphism problem is NP-complete.
Question
The subgraph-isomorphism problem takes two undirected graphs G1 and G2, andit asks whether G1 is isomorphic to a subgraph of G2. Show that the subgraph-isomorphism problem is NP-complete.
Solution
To show that the subgraph-isomorphism problem is NP-complete, we need to demonstrate two things:
- The problem is in NP.
- The problem is NP-hard.
Step 1: The problem is in NP
To show that the subgraph-isomorphism problem is in NP, we need to demonstrate that a given solution can be verified in polynomial time. Given two graphs and , and a mapping from the vertices of to the vertices of , we can verify whether is an isomorphism from to a subgraph of in polynomial time by checking the following conditions:
- is a bijection between the vertices of and a subset of the vertices of .
- For every edge in , there is an edge in .
Both of these checks can be done in polynomial time, so the subgraph-isomorphism problem is in NP.
Step 2: The problem is NP-hard
To show that the subgraph-isomorphism problem is NP-hard, we need to reduce a known NP-hard problem to it in polynomial time. We will use the clique problem, which is known to be NP-hard.
The clique problem asks whether a given graph contains a complete subgraph (clique) of size . We will reduce this problem to the subgraph-isomorphism problem.
Given an instance of the clique problem, i.e., a graph and an integer , we construct an instance of the subgraph-isomorphism problem as follows:
- Let be the complete graph on vertices.
- Let be the graph .
We need to determine whether (the complete graph on vertices) is isomorphic to a subgraph of . If contains a clique of size , then there exists a subgraph of that is isomorphic to . Conversely, if is isomorphic to a subgraph of , then contains a clique of size .
This reduction can be done in polynomial time, and since the clique problem is NP-hard, the subgraph-isomorphism problem is also NP-hard.
Conclusion
Since we have shown that the subgraph-isomorphism problem is in NP and is NP-hard, we can conclude that the subgraph-isomorphism problem is NP-complete.
Similar Questions
Which of the following statements is not true for isomorphic graphs?a.Number of vertices in both the graphs must be same.b.Number of edges in both the graphs must be same.c.They have n+1 connected componentsd.Degree sequence of both the graphs must be same.
Graph isomorphism is concerned with:A. The number of vertices and edgesB. The degrees of verticesC. The labeling of vertices and edgesD. The structural equivalence of graphs
Define complete graph and complete bipartite graph. Draw a graph which is a complete graph as well asa complete bipartite graph.
SubgraphsProblem DescriptionGiven a graph of N nodes and E bidirectional edges, determine how many disjoint subgraphs there are in the graph. For this case, a portion of a graph is considered a subgraph if any 2 node in the portion are connected directly or indirectly. A node without any edges are also considered as a subgraph. Two disjoint subgraph will not have any edges in between any node of the first subgraph and any node of the second subgraph.The nodes are labelled from 0 to N - 1 and there will not be 2 edges between any 2 pairs of nodes.Input2 integers, N then EE lines consisting of 2 integers each, A and B. 0 ≤ A < B < N.OutputA single integer, which is the number of disjoint subgraphs.LimitsSubtask 1 (45%): N = 1000, 0 ≤ E ≤ 10000.Subtask 2 (55%): N = 1000000, 0 ≤ E ≤ 1000000.Subtask 3 (0%): As per sample testcasesSample Testcase 1Input:5 31 23 44 0Output:2Explanation:The graph above contains 2 disjoint subgraphs: {1, 2} and {0, 3, 4}Sample Testcase 2Input:5 40 11 22 33 4Output:1
A graph that is both bipartite and complete is:A. PlanarB. TreeC. CycleD. Complete bipartite graph
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.