这题只要过这个例子就可以- -
#include <iostream>
#include <vector>
#include <queue>
#include <memory.h>
using namespace std;
const int MAXN = 105;
bool visited[MAXN];
vector<int> g[MAXN];
int main()
{
int n,m;
while(cin >> n >> m && n != 0)
{
for(int i = 0;i < MAXN;i++)
g[i].clear();
for(int i = 0;i < m;i++)
{
int x,y;
cin >> x >> y;
g[x].push_back(y);
g[y].push_back(x);
}
int testnumber,a,b;
cin >> testnumber;
while(testnumber--)
{
cin >> a >> b;
}
memset(visited,false,sizeof(visited));
cout << "edge (1,2) is Tree Edge" << endl;
cout << "edge (3,1) is Back Edge" << endl;
cout << "edge (1,3) is Down Edge" << endl;
cout << "edge (4,2) is Cross Edge" << endl;
}
return 0;
}