# 一道acm的题，看了半天，不理解题意，求解释~

0

Problem Description
As a student in computer science, Ant is weak in Graph Theory learning. One day, he comes across a problem. Given a non-directed graph G which is donated by G = {V, E}. V is the set of vertexes and E is the set of undirected edges. You should select some vertexes as key vertexes and each edge should be connected by at least one key vertex. Ant sometimes can select the key vertexes as described above. But now he wants to select least vertexes as key vertexes. Here comes your question, given a graph and tell Ant how many ways are there to select least key vertexes.

Input
The first line of the input contains an integer T which is the number of test case, and then there are T groups of data following. For each group of data, the first line contains two integers. The first integer n is the number of vertexes and the second integer m is the number of edges. The next following m lines describe the edges. Each line contains two integers u, v which indicates there is an undirected edge connected vertex u and vertex v. (0 < n ≤ 20, 0 < m ≤ 300, u ≠ v, 1 ≤ u, v ≤ n)

Output
For each test case, output an integer which is the number of ways that selecting least key vertexes.

Sample Input
1
4 3
1 2
2 3
3 4

Sample Output
3

Hint

For the sample, there are three ways, which are selecting {1, 3}, {2, 4}, {2, 3}

1

1  ---  2

|

4  ---  3

@斗榖於菟: 没仔细想，不过我才从最大度数的结点开始慢慢排除应该可以的。你搞不定可以跟我说下，我有空想想。

@水牛刀刀: 我把点和点连接的情况存在一个二维数组里，点和点之间有连线置为1，否则还是初始值0.我现在的问题是找不到一个算法确定最小点数，和最小点数情况下有几种实现的选择。没有思路...

0

today4king | 园豆：3267 (老鸟四级) | 2012-09-18 15:22

您需要登录以后才能回答，未注册用户请先注册