# CMPSCI 311: Theory of Algorithms

### Fun With Depth-First Search

Please answer the questions during the discussion period.

Here are two graphs in adjacency list format. G is undirected and H is directed:

• G}: (1: 3, 4, 5), (2: 3, 6), (3: 1, 2, 5, 6), (4: 1), (5: 1, 3), (6: 2, 3)

• H: (A: B), (B: A, E), (C: B), (D: A), (E: C, D).

• Question 1: Draw G and H and draw a DFS forest for each. Identify tree, back, and cross edges (if any) in each DFS forest.

• Question 2: It should be true that every non-tree edge in G's forest goes from some vertex v to an ancestor of v in the forest. Explain why this is always the case for an undirected graph. (Clarification: Following Levitin, when doing a DFS of an undirected graph we add an edge to the forest only the first time we see it, not the second time we see it in the other direction.)

• Question 3: A directed graph is strongly connected if there is a path from every vertex to every other vertex. Is H strongly connected? Explain how you would determine from a graph's DFS forest whether it is strongly connected.

• Question 4: A vertex v in a connected undirected graph is called an articulation point if removing v makes its graph unconnected. Are there any articulation points in G? Explain how to identify articulation points from a graph's DFS forest.

Last modified 9 October 2003