### DIRECTED GRAPHS STUDY GUIDE

**Using directed graphs vs. undirected graphs.**
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).

**Topological sort.**

- What is a topological order?
- When is it unique?
- Under which conditions does a digraph have a topological sort?
- How do you compute a topological order?
- What is the running time of that algorithm (using adjacency lists)?

### Recommended Problems

#### C level

- Fall 2012 Final, #3
- Spring 12 final, #3a, #3b
- Spring 14 Final, #2b

#### B level

- Spring 14 Final, #2a
- Using the previous problem, provide a topological sort that is different than the reverse postorder. If no such sort exists, explain why.
**
Answers**
This graph is not a DAG, and thus there is no topological order.

- Textbook: 4.2.10, 4.2.20

#### A level

- Spring 2012 Final, #12
- 4.2.19, 4.2.22
- 4.2.27
- 4.2.40

#### Just for fun

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