【swust.oj_1066】有向图的邻接矩阵存储强连通判断

假设有向图G采用邻接矩阵存储,设计一个算法,判断图G是否是强连通图。若是则返回yes;否则返回no。
 
第一行为一个整数表示顶点的个数。接下来是为一个整数矩阵,表示图的邻接关系。 

yes(强连通图)或no(非强连通图).。

5
0 1 0 0 0
0 0 1 1 0
0 0 0 1 0
1 0 0 0 1
1 0 0 0 0
-----------------
yes

#include 
#include 
#include 
using namespace std;
int maps[105][105],n,vis[1005]={0};
int main()
{
	int i,j;
	cin>>n;
	for(i=0;i>maps[i][j];
		}
	}
	int flag=0;
	for(i=0;i


你可能感兴趣的:(swust.oj)