180 likes | 356 Vues
This guide explores the Directed Depth First Search (DFS) algorithm using adjacency lists to efficiently traverse graphs. We detail the concepts of node states such as Undiscovered, Marked, Active, and Finished, and illustrate the function call stacks during the DFS process. The step-by-step traversal of nodes A, B, C, D, E, F, and G will be discussed, showcasing how DFS operates in directed graphs. This resource is valuable for computer science students and professionals seeking to enhance their understanding of graph algorithms.
E N D
Directed Depth First Search A Adjacency Lists A: F GB: A HC: A DD: C FE: C D GF: E:G: :H: B:I: H: B H C G I D E F
Directed Depth First Search A B H C G I D E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A B H C G I D visit(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A dfs(D) D-C D-F dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A dfs(D) D-C D-F dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A dfs(D) D-C D-F dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A dfs(G) B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A B H C G I D dfs(F) F-E E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A B H C G I D E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A B H C G I D E F dfs(A) A-F A-G Undiscovered Marked Active Finished Function call stack:
Directed Depth First Search A B H C G I D E F Undiscovered Marked Active Finished Function call stack: