### DIRECTED GRAPHS STUDY GUIDE

**Using directed graphs vs. undirected graphs.** nbsp;
Know when to use each. This should be fairly natural. For example, you'd use an undirected
graph to represent friend connections between Facebook users, and a directed graph to
represent following connections on Twitter.

**BFS and DFS are directed graph algorithms.**
Many canonical unweighted digraph problems (e.g. shortest paths and reachability) can be
solved using code that is effectively identical to code for solving problems on unweighted
graphs.

**Importan digraph graph traversals.**

- Breadth-first search.
- Depth-first search (including preorder, postorder, and reverse postorder).

**Important digraph problems.**

- Topological sort.
- What is a topological sort?
- Is it unique?
- What are the conditions under which a digraph has a topological sort?
- How do you compute a topological sort?
- What is the running time of that algorithm (using adjacency lists)?

- Strongly-connected components.
- What is a strongly connected component (sometimes called a strong component)?
- How does the Kosaraju-Sharir algorithm work?
- What does the first step of Kosaraju-Sharir provide? An ordering of the vertices that allows
us to find the strong components in the second step.
- What does the second step of Kosaraju-Sharir do? Finds all the strong components
using the ordering provided by the first step.
- What are the steps? 1. Run DFS on G
^{R} to compute reverse postorder
of G^{R}. 2. Start V depth-first-searches (one for each node)
in the order given by first step.
- What is the running time if we use adjacency lists?

### Recommended Problems

#### C level

- Spring 08 Final, #1a, #1b
- Fall 08 Final, #1a, #1b
- Fall 10 Final, #3a
- Spring 12 final, #3a, #3ab

#### B level

- Spring 08 Final, #1c, #1d
- Fall 08 Final, #1c
- Fall 10 Final, #3b
- Fall 10 Final, #2d, #2e
- Textbook: 4.2.10, 4.2.20

#### A level

- Fall 2008, #11
- 4.2.19, 4.2.22 (exam will not require you to know why Kosaraju-Sharir works)
- 4.2.27
- 4.2.40

#### Just for fun

- Write code similar to (or copy) the webcrawler shown in lecture.