Skip to content

Quiz 20210602 #15

@stevengogogo

Description

@stevengogogo
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">

image

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions