step 1 choose a vertex in the graph and make it


Step 1: Choose a vertex in the graph and make it the source vertex & mark it visited.

Step 2: Determine a vertex which is adjacent to the source vertex and begun a new search if it is not already visited.

Step 3: Repeat step 2 via a new source vertex. While all adjacent vertices are visited, return to earlier source vertex and continue search from there.

If n refer to the number of vertices in the graph & the graph is represented through an adjacency matrix, then the total time taken to carry out DFS is O(n2). If G is revel by an adjacency list and the number of edges of G are e, then the time taken to carry out DFS is O(e).

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: step 1 choose a vertex in the graph and make it
Reference No:- TGS0413861

Expected delivery within 24 Hours