Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quiz 20210602 #15

Open
stevengogogo opened this issue Jun 2, 2021 · 0 comments
Open

Quiz 20210602 #15

stevengogogo opened this issue Jun 2, 2021 · 0 comments

Comments

@stevengogogo
Copy link
Owner

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 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant