Postagens

Mostrando postagens de agosto, 2025

DFS

 Consider the execution of Depth-First Search (DFS) on a graph G. Analyze the following statements: I. The existence of at least one backward edge during the DFS traversal guarantees that G contains at least one cycle. II. In an undirected graph, DFS can generate forward and cross edges if the graph is disconnected. III. After running DFS on a graph, if a backward edge is found, it is still possible to produce a valid topological sort of its vertices. IV. Cross edges alone are sufficient to guarantee that G contains a cycle. Which of the following combinations of statements is true? A) I and III only. B) I and II only. C) Only I. D) II and IV only. E) None of the above. Original idea by: Thiago Laitz