Lecture 18 - Problems

  1. Execute Dijkstra on the following graph starting at node S and maintaining backpointers. Give the final table of d-values and backpointers, and also list the nodes in the order they are added to the frontier set.

    image-20200902185310977

  2. Here’s a weighted graph unlike any of the examples we’ve seen so far:

    image-20200902210503421

    What problem do you encounter when you try to determine the shortest path between node A and B (not using Dijkstra’s algorithm)? What happens if you run Dijkstra’s algorithm?

  3. Generally, in cases like we saw in the prior problem, we say that no shortest path exists. Here’s a graph where shortest paths are well-defined:

    image-20200902211225237

    First, decide what you think the shortest path length from A to D should be. Then, run Dijkstra’s algorithm. Does Dijkstra agree with you?

  4. It turns out that Dijkstra’s algorithm doesn’t always give the correct result if negative edge weights are present in the graph. One might get clever and try subtracting the minimum edge weight from all edges to ensure that no edge weights are negative. This works in the graph from the previous problem (try it!), but turns out not to work in general. Find a counterexample and explain the intuition for why this doesn’t work.