Page 1 of 1

procedure dfs (G) for all eV: for all EV: - visited (v) = false if not visited (r): explore (r) procedure explore (G.r)

Posted: Mon Jun 06, 2022 6:51 pm
by answerhappygod
Procedure Dfs G For All Ev For All Ev Visited V False If Not Visited R Explore R Procedure Explore G R 1
Procedure Dfs G For All Ev For All Ev Visited V False If Not Visited R Explore R Procedure Explore G R 1 (517.8 KiB) Viewed 26 times
Procedure Dfs G For All Ev For All Ev Visited V False If Not Visited R Explore R Procedure Explore G R 2
Procedure Dfs G For All Ev For All Ev Visited V False If Not Visited R Explore R Procedure Explore G R 2 (517.8 KiB) Viewed 26 times
Procedure Dfs G For All Ev For All Ev Visited V False If Not Visited R Explore R Procedure Explore G R 3
Procedure Dfs G For All Ev For All Ev Visited V False If Not Visited R Explore R Procedure Explore G R 3 (276.69 KiB) Viewed 26 times
procedure dfs (G) for all eV: for all EV: - visited (v) = false if not visited (r): explore (r) procedure explore (G.r) Input: G=(V.E) is a graph; rel Output: visited (w) is set to true for all nodes « reachable from r visited (r) = true previsit (r) for each edge (r.v) CE: if not visited(): explore() postvisit (2)

procedure dfs (G) for all eV: for all EV: - visited (v) = false if not visited (r): explore (r) procedure explore (G.r) Input: G=(V.E) is a graph; rel Output: visited (w) is set to true for all nodes « reachable from r visited (r) = true previsit (r) for each edge (r.v) CE: if not visited(): explore() postvisit (2)

5. Perform a depth-first search (DFS) on the following graph; whenever there's a choice of vertices, pick the one that is alphabetically first (Choose A as the starting node). Please draw the DFS trees and label post and pre value for each node. (12¹) B procedure dfs (G) for all EV: for all EV: H D visited () = false if not visited (v): explore (r) procedure explore (G,F) Input: G=(V,E) is a graph; rel' Output: visited (w) is visited (r) — true previsit (r) for each edge (.wir E: if not visited (u) = postvisit (e) G set to true for all nodes reachable from e explore (a)