- DFS(深度优先搜索)类似于树的先序遍历
 
void DFS(Vertex V){
	visited[V] = true;
	for(V的每个邻接点W)
		if(!Visited[W])
			DFS(W);
}
 
- BFS(广度优先搜索)类似于树的层序遍历
 
void BFS(Vertex V){
	visited[V]=true;
	Enqueue(V,Q);
	while(IsEmpty(Q)){
	V = Dequeue(Q);
	for(V的每个邻接点W)
		if(!visited[W]){
		visited[W] = true;
		Enqueue(W,Q);
		}
	}
}










