Line Graphs
Time limit5sMemory limit512 MB
Given a simple graph G and k, find the size of a maximum clique in the k-th iterated line graph L_k(G) and count such cliques modulo 1000000007.
- Level
Hard9 of 10
- Topics
- Graph, Combinatorics, Math
- Solved
- No attempts yet
Problem
Last year, Rounddog participated in a contest with a pretty hard problem set and failed in solving the problem about line graphs. So recently he decided to study them deeper.
In the mathematical discipline of graph theory, the line graph of a simple undirected graph is another simple undirected graph that represents the adjacency between every two edges in . Precisely speaking, for an undirected graph without loops or multiple edges, its line graph is a graph such that
- each vertex of represents an edge of ; and
- two vertices of are adjacent if and only if their corresponding edges share a common endpoint in .

Given a simple undirected graph , Rounddog's study aims to find the maximum cliques in its line graph , and he decided to turn some of his findings into a challenge for you.
In this problem, you are given a simple undirected graph and a small positive integer . After finding all maximum cliques in , where and for each positive integer , you need to tell Rounddog the number of vertices in a maximum clique in , and also the number of distinct maximum cliques modulo 1 000 000 007.
Here, a subset of vertices of an undirected graph is called a clique if and only if there is an edge between each pair of vertices in the subset, and a maximum clique is a clique with the largest possible number of vertices.
Input
The input contains several test cases, and the first line contains a single integer (), the number of test cases.
For each test case, the first line contains three integers (), () and (): the number of vertices and edges in the given simple undirected graph and the number of iterations of the line graph operation.
Then lines follow, describing all edges of the graph. Each of them contains two integers and (, ), representing an edge between vertices and .
It is guaranteed that the sum of in all test cases does not exceed 2 000 000, the sum of does not exceed 3 000 000, and the graph in each test case contains no loops and no multiple edges.
Output
For each test case, output a single line with two integers: first the number of vertices in a maximum clique, and then the number of distinct maximum cliques modulo 1 000 000 007.