?? p273.cpp
字號:
#include "iostream.h"
#include "p271.cpp"
template <class NameType, class DistType>
void Graph<NameType, DistType>::Components ( ) { //確定圖的連通分量
int *visited = new int[NumVertices]; // visited記錄頂點是否訪問過
for ( int i=0; i<NumVertices; i++ ) visited[i] = 0; //初始化, 表示所有頂點未訪問過
for ( i=0; i<NumVertices; i++ ) //順序掃描所有頂點
if ( !visited[i] ) { //若沒有訪問過, 則訪問這個連通分量
DFS ( i, visited ); //從頂點i開始訪問
OutputNewComponent ( ); //輸出這個連通分量
}
delete [ ] visited;
}
void OutputNewComponent()
{
cout<<endl<<"The nodes above is of a part."<<endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -