generated from stevengogogo/CppProjectTemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
DFS(G)
<img width="358" alt="Screen Shot 2021-06-02 at 10 24 45 PM" src="https://user-images.githubusercontent.com/29009898/120497861-570df800-c3f1-11eb-9b8b-fd0a6a90c8e0.png">
DFS(G)
for each vertex u ∈ G.v
u.color = WHITE
u.pi = NIL
time =0
size_list = []
for each vertex u ∈ G.V
c = 1
if u.color = WHITE
DFS-VISIT(G,u,c)
record c in size_list
DFS-VISIT(G,u, c)
time=time+1
u.d=time
u.color=GRAY
u.d = time
u.color = GRAY
for each v ∈ G.Adj[u]
if v.color = WHITE
v.pi=u
c+=1
DFS-VISIT(G,v)
u.color = BLACK
time=time+1
u.f = time
Metadata
Metadata
Assignees
Labels
No labels