DFS(G)DFS_VISIT(G,u)
- GLOBAL: time← 0
- foreach vertex v ∈(V) do
- color[v] ← WHITE
- π[v] ← NIL
- foreach vertex v ∈(V) do
- if color[v] = WHITE then
- DFS_VISIT(G,v)
- color[u] ← GRAY
- time ← time + 1
- d[u] ← time
- foreach v ∈ adj(u) do
- if color[v] = WHITE then
- π[v] ← u
- DFS_VISIT(G,v)
- color[u] ← BLACK
- f[u] ← time
- time ← time + 1