Prove That Sparse Graph Is Np-Complete


Even with infinite time, there are some computing issues that algorithms cannot resolve. NP-complete problems are those whose solution is unknown. It's intriguing to note that if one NP-complete question can be resolved in polynomial time, subsequently, all others can be resolved.

In this study, we will define a sparse graph, discuss several complexity classes, independent sets, and demonstrate that sparse graphs are NP-complete.

What Is A Sparse Graph?

A sparse graph is one with a limited number of edges. The total number of edges in this situation is significantly fewer than there could be or the highest possible number of edges. A directed graph may only contain n(n-1) edges, wherein n refers to the number of nodes. An undirected graph can only have n(n-1)/2 edges.

The difference between sparse and dense graphs is arbitrary. A sparse graph possesses almost the same number of edges as vertices, whereas a dense graph has approximately the greatest number of edges.

What Are The Many Sorts Of Complexity Classes?

Some problems in computer science have yet to be solved; these problems are classified as Complexity Classes.

It is the field of computing theory that's concerned with the resources needed to solve a task.

The fundamental resources include time and space, which refer to how long an algorithm needs to resolve an issue as well as how large of a memory it requires.

1. P Class

The letter P in the P class refers to polynomial time. P is divided into a collection of decision-based challenges that could be solved or produce the result in polynomial time (questions having either a yes or a no response).

Polynomial Time − We generate an output based on a particular input in a specific time, like a minute or hour. This is referred to as Polynomial time.

Features

  • P issues have a simple answer. 

  • P class consists of resolved and tractable calculating problems. 

  • Issues that can be dealt with theoretically and practically are considered to be tractable. Although intractable problems cannot be solved in practice, they can be addressed in principle.

2. NP Class

The division of NP included the collection of all decision-based problems that cannot be resolved or produced in polynomial time but verification can be performed in polynomial time. There are several subsets of the NP class, including the P class.

Please remember that "NP" does not indicate "not polynomial." The term means "non-deterministic polynomial." It signifies that a certain number of outputs will be created based on a single input.

Since a non-deterministic technology can resolve NP problems, the solutions to this class are difficult to find, although their verification is easy. It is possible to solve NP problems in polynomial time with a Turing machine.

Other Complexity Classes

Complexity Class

Features

NP- Hard

A few NP-hard problems are in NP, and checking them is time-consuming.

NP-complete

An NP-complete problem is both NP and NP-hard.

Co-NP

NO Responses can be verified in polynomial time

Independent Set

An independent vertex set defines a subset of a graph's vertices where no two vertices together create an edge.

An independent set that cannot be considered a legitimate subset of another independent set is known as "maximal independent set".

A "maximum independent set" is a given graph's largest feasible independent set.

How To Prove "Sparse Graphs Are NP-Complete"?

There are two steps needed to prove a problem NP-Complete −

Demonstrate that the given problem falls under the NP Class.

Sparse graph is one of the NP- Hard Issues

It can be challenging to show the NP-completeness of an issue by reducing it to another NP problem. That is why we prove that every existing NP-complete problem can be reduced to that issue over polynomial time.

Sparse Graph falls under NP Class

Considering a G = (V, E) input with a and b (two integer variables).

It requires O(|V|) runtime to check that |S| =a for a specific solution S.

To ensure that the amount of edges connecting each set of nodes in S is no more than b, one must use the O(|V|2) technique.

As a result, verification of a Sparse Graph solution requires maximum O(|V|2), thus being polynomial. Therefore, Sparse Graph falls under the complexity class of NP.

Next, we shall attest that an independent set issue is NP-complete

Verifying the result simply requires that no two vertices in the solution share an edge in order to ensure that they are not adjacent. By using the graph G(V, E) strategy, this can be accomplished in polynomial time.

flag=true
For each u, v pair in the subset V':
   Make certain that both of these do not have an edge between them.
   Set flag to false and break if there is an edge.
If the flag is set to true:
   Correct Answer.
Else:
   Incorrect answer.

A clique problem instance can be created from any version of the independent set issue. As a result, the independent set is NP-Hard.

Input Conversion

An Independent Set will be converted to a Sparse Graph as follows −

"G' = G(V, E); a = k; b = 0" 

This is due to the need to maximize the number of independent sets

This conversion will take O(1) time. As a result, it is polynomial.

Output Conversion

The Sparse Graph solution must be converted into the Independent Set solution.

Since k = a, the set a produced by the sparse graph solution is an Independent Set of dimension k. As a result, Independent Set can use the straight output from a Sparse Graph. Because no conversion is needed, it is polynomial.

Correctness

Consider an Independent Set S in advance. This also refers to a Sparse graph because there aren't any edges across the nodes of S and "|S| = k = a".

Sparse graph solutions are also independent sets (the vertices are connected by zero edges, "|S| = k = a").

Consequently, Sparse Graph is equivalent to Independent Set.

Independent Sets are NP-complete problems. Therefore, polynomial time is required for complete reduction.

Thus, Sparse Graphs also fall into the NP-complete category.

Conclusion

Even engineers can benefit from understanding NP-Completeness. Assume you are requested to create a robust algorithm to tackle a critical problem for your firm. If one understands NP-Completeness and proves that the problem is NP-complete, they can confidently imply that a polynomial-time solution is unlikely. If a polynomial-time solution is possible, it addresses a significant issue in computer science that many people have worked on for years.

Updated on: 09-Oct-2023

131 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements