GRAPHS AND DIGRAPHS II STUDY GUIDE


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.

Topological sort.

Important graph problems.   You should be familiar with the following problems.

You should know how to solve the first five—not necessarily because these problems are so important, but because you should have at least a few examples of how to use DFS or BFS to solve problems. For the last four, it's good scholarship to be know whether the problem is tractable (polynomial time) and whether there exists an easy to understand tractable algorithm. We may even ask you how these things on an exam. You do not need to be familiar with the details of the best known algorithm for their solution.

One important meta-point is that there is no easy way to determine the complexity of a graph problem. For example, finding an Euler cycle is solvable in Θ(E + V) time (and the algorithm is non-trivial but not hideously complex). By contrast, finding a Hamilton cycle is an intractable problem. Planarity can be solved in Θ(E + V) time, but all known algorithms are extremely complex. Graph isomorphism is particularly notable since its tractability has remained elusive despite decades of research.

Recommended Problems

C level

  1. Spring 2012 final, #3b
  2. Fall 2017 Final, #5b

B level

  1. Fall 2017 Final, #5c
  2. Fall 2019 Final, #4c
  3. Textbook: 4.2.10, 4.2.20
  4. What is the running time for BFS if we use the adjacency-matrix representation (instead of the adjacency-lists representation)?

A level

  1. 4.2.19, 4.2.22
  2. 4.2.27
  3. 4.2.40

Just for fun

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