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
This note was uploaded on 02/13/2012 for the course CS 91.404 taught by Professor Dr.karendaniels during the Fall '09 term at UMass Lowell.
 Fall '09
 DR.KARENDANIELS
 Algorithms

Click to edit the document details