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.
Here’s a weighted graph unlike any of the examples we’ve seen so far:
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?
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:
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?
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.