Feb 24
Next Tues: town meeting day, no class.
Discuss chapters 3 and 4 in Dasgupta: searching graphs, how long, depth-first vs breadth-first, and O(n) operations for various graph properties.
pg 101 :
" three rather different-sounding properties -
acyclicity,
linearizability, and
the absence of back edges during a depth-first search
- are in fact one and the same thing. "
Explain what he's talking about, using the described algorithms.
I have a partially completed implementation of the chap 3 algorithms,
including a graph-generator, in python; see graphs.py, attached.
In class:
- What is a "back edge" and how do we detect it in the python code?
- Does that depend on where we start the search?
- How do the vertices get labeled by DFS() for this directed graph (A -> B -> C), when we start at A? B? C?
- Add a "is cyclic" routine to graphs.py, which should run in O(|V| + |E|).
Do a few problems from the end of the chapter: 3.1, 3.24.
If time allows, discuss chapter 4 topics :
- The question of "shortest path".
- How do we adapt the search to be breadth first?
- Dijkstra’s shortest-path algorithm
- Priority queue ; typically implemented as a "heap"
Homework for chap 3, 4 to be due next Thu - no class Tues.