Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DSA
  • Algorithms
  • Analysis of Algorithms
  • Sorting
  • Searching
  • Greedy
  • Recursion
  • Backtracking
  • Dynamic Programming
  • Divide and Conquer
  • Geometric Algorithms
  • Mathematical Algorithms
  • Pattern Searching
  • Bitwise Algorithms
  • Branch & Bound
  • Randomized Algorithms
Open In App
Next Article:
Prove that Dense Subgraph is NP Complete by Generalisation
Next article icon

Prove that Dense Subgraph is NP Complete by Generalisation

Last Updated : 17 Apr, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Prerequisites: NP-Completeness, NP Class, Dense Subgraph 

Problem: Given graph G = (V, E) and two integers a and b. A set of a number of vertices of G such that there are at least b edges between them is known as the Dense Subgraph of graph G.

Explanation: To prove the Dense Subgraph problem as NP-completeness by generalization, we are going to prove that it is a generalization of the known NP-complete problem. In this case, we are going to take Clique as the known problem which is already known to be NP-complete, and explained in Proof of Clique Is an NP-Complete and we need to show the reduction from Clique → Dense Subgraph.

Clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent.

Proof:

1. Input Conversion: We need to convert the input from Clique to the input of the Dense Subgraph.

Clique Input:  An undirected graph G(V, E) and integer k.
Dense Subgraph Input : An undirected graph G'(V, E) and two integers a and b.

We are going to transform the input from Clique for Dense Subgraph such that 

  1. G' = G(V, E) 
  2. a = k
  3. b = (k * (k - 1))/2

This conversion is going to take O(1) time so it's polynomial in nature.

2. Output Conversion: We need to convert the solution from Dense Graph to the solution for the Clique problem.

Solution of Dense Graph will result in a set a which would be a Clique of size k as k = a. So direct output from Dense Graph can be used by Clique. Since no conversion is required so it's again polynomial in nature.

3. Correctness: We have restricted the range of input value b such that (k¦2) with value as (k * (k - 1))/2. 

Now we are looking for a subgraph having k vertices and are connected by at least (k * (k - 1))/2 edges. 

  • Since in a complete graph, n vertices can have at most (n * (n - 1))/2 edges between them so we can say that we need to find a subgraph of k vertices that have exactly (k * (k - 1))/2 edges which means output graph should have an edge between each pair of vertices which is nothing but Clique of k vertices. 
  • Similarly, a Clique of k vertices on a graph G(V, E) must have (k * (k - 1))/2 edges which is nothing but the Dense-Subgraph of graph G(V, E)
Red Edges and Vertices denotes a Dense-Subgraph with a = 4 and b = 5 

So, this means Dense-Subgraph has a solution↔ Clique has a solution.
The complete reduction takes polynomial time and Clique is NP complete so Dense Subgraph is also NP complete.

Conclusion:

Hence we can conclude that Dense-Subgraph is NP Complete
 

For more details, please refer: Design and Analysis of Algorithms.


Next Article
Prove that Dense Subgraph is NP Complete by Generalisation

S

surbhi
Improve
Article Tags :
  • Analysis of Algorithms
  • DSA

Similar Reads

    P, NP, CoNP, NP hard and NP complete | Complexity Classes
    In computer science, problems are divided into classes known as Complexity Classes. In complexity theory, a Complexity Class is a set of problems with related complexity. With the help of complexity theory, we try to cover the following.Problems that cannot be solved by computers.Problems that can b
    5 min read
    Introduction to NP-Complete Complexity Classes
    NP-complete problems are a subset of the larger class of NP (nondeterministic polynomial time) problems. NP problems are a class of computational problems that can be solved in polynomial time by a non-deterministic machine and can be verified in polynomial time by a deterministic Machine. A problem
    5 min read
    NP-Hard Class
    A 'P' problem is said to be NP-Hard when all 'Q' belonging in NP can be reduced in polynomial time (n^k where k is some constant) to 'P' assuming a solution for 'P' takes 1 unit time. NP-Hard is a computational complexity theory that acts as a defining property for the class of problems that are "at
    2 min read
    Difference between NP hard and NP complete problem
    All NP Complete Problems are NP-Hard but vice versa is not true. NP-Complete problems are subset of NP Problems. NP Problems : NP problems are a class of computational problems that can be solved in polynomial time by a non-deterministic machine and can be verified in polynomial time by a determinis
    2 min read

    NP-Complete Complexity Proofs

    Proof that Clique Decision problem is NP-Complete
    Prerequisite: NP-Completeness A clique is a subgraph of a graph such that all the vertices in this subgraph are connected with each other that is the subgraph is a complete graph. The Maximal Clique Problem is to find the maximum sized clique of a given graph G, that is a complete graph which is a s
    4 min read
    Proof that Independent Set in Graph theory is NP Complete
    Prerequisite: NP-Completeness, Independent set. An Independent Set S of graph G = (V, E) is a set of vertices such that no two vertices in S are adjacent to each other. It consists of non- adjacent vertices. Problem: Given a graph G(V, E) and an integer k, the problem is to determine if the graph co
    5 min read
    Prove that a problem consisting of Clique and Independent Set is NP Complete
    Prerequisite: NP-Completeness, NP Class, Clique, Independent Set Problem: Given an undirected graph G = (V, E) and an integer K, determine if a clique of size K as well as an independent set (IS) of size K, exists. Demonstrate that it is an NP Complete. Explanation: A Clique is a subgraph of a graph
    6 min read
    Prove that Dense Subgraph is NP Complete by Generalisation
    Prerequisites: NP-Completeness, NP Class, Dense Subgraph  Problem: Given graph G = (V, E) and two integers a and b. A set of a number of vertices of G such that there are at least b edges between them is known as the Dense Subgraph of graph G. Explanation: To prove the Dense Subgraph problem as NP-c
    3 min read
    Prove that Sparse Graph is NP-Complete
    Prerequisite: NP-Completeness, NP Class, Sparse Graph, Independent Set Problem: Given graph G = (V, E) and two integers a and b. A set of a number of vertices of G such that there are at most b edges between them is known as the Sparse Subgraph of graph G. Explanation: Sparse Subgraph problem is def
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences