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
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
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)