You are given an undirected chart with n vertices and m edges. Additionally, you are given an integer k.    Find either a faction of size k or a non-void subset of vertices to such an extent that every vertex of this subset has essentially k neighbors in the subset. In case there

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.

You are given an undirected chart with n vertices and m edges. Additionally, you are given an integer k. 

 

Find either a faction of size k or a non-void subset of vertices to such an extent that every vertex of this subset has essentially k neighbors in the subset. In case there are no such inner circles and subsets report about it. 

 

A subset of vertices is known as a faction of size k if its size is k and there exists an edge between each two vertices from the subset. A vertex is known as a neighbor of the other vertex if there exists an edge between them. 

 

Input 

 

The primary line contains a solitary integer t (1≤t≤105) — the number of experiments. The following lines contain portrayals of experiments. 

 

The principal line of the depiction of each experiment contains three integers n, m, k (1≤n,m,k≤105, k≤n). 

 

Every one of the following m lines contains two integers u,v (1≤u,v≤n,u≠v), indicating an edge between vertices u and v. 

 

It is ensured that there are no self-circles or various edges. It is ensured that the amount of n for all experiments and the amount of m for all experiments doesn't surpass 2⋅105. 

 

Output 

 

For each experiment: 

 

In the event that you found a subset of vertices to such an extent that every vertex of this subset has basically k neighbors in the subset in the main line output 1 and the size of the subset. On the subsequent line output the vertices of the subset in any request. 

 

In the event that you tracked down a coterie of size k, in the primary line output 2 and in the subsequent line output the vertices of the faction in any request. 

 

In case there are no necessary subsets and factions print −1. 

 

In the event that there exists numerous potential answers you can print any of them

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Depth First Search
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education