判断图是否有环
//判断邻接矩阵是否有环
bool judge(vector<vector<int>> path,int n){
bool index = 0;
while(1){
index = 1;
for(int i=0;i<n;i++){
int sum = 0;
for(int j=0;j<n;j++){
sum+=path[i][j];
}
if(sum==1){
//只连着一条边
index = 0;
for(int j=0;j<n;j++){
path[i][j] = 0;
path[j][i] = 0;
}
}
}
if(index==1) break;
}
int sum = 0;
for(int i=0;i<n;i++) {
for (int j = 0; j < n; j++) {
sum += path[i][j];
}
}
if(sum>0) return true;
else return false;
}