bool visited[MAX_VERTEN_NUM];
void BTSTraverse(Graph G, int v) {
for(i = 0;i<G.vernum;i++) {
visited[i] = false;
}
InitQueue(Q);
for(i = 0;i<G.vernum;i++){
if(!visited[i]) {
if(!visited[i]){
BFS(G,i);
}
}
}
void BFS(Graph G, int v) {
visit(v);
visited[v] = true;
EnQueue(Q,v);
while(!QueueEmpty(Q)) {
DeQueue(Q,w);
for(w = FirstNeighbor(G,v);w>=0;w = NextNeighbor(G,v,w)) {
if(!visited[w]) {
visit(w);
visited[w] = true;
EnQueue(Q,w);
}
}
}
}