This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 5 do for each vertex v AdjList[head[Q]] 6 do if color[v] is WHITE 7 then color[v] GRAY 8 ENQUEUE (Q,v) 9 color[head[Q]] BLACK 10 DEQUEUE(Q) DFS(G) 1 for each vertex u V[G] 2 do color[u] WHITE 3 for each vertex u V[G] 4 do if color[u] is WHITE 5 then DFS_VISIT(G, u) DFS_VISIT(G, u) 1 color[u] GRAY 2 for each vertex v AdjList[u] 3 do if color[v] is WHITE 4 then DFS_VISIT(G,v) 5 color[u] BLACK Initialize color of each vertex to WHITE Visit every vertex that is reachable from vertex u Go as far down as possible before going across Go as far across as possible before going down...
View Full Document
- Fall '09