Standard 9: Graph Traversal 3: Shortest Paths


Short description: Apply BFS and Dijkstra’s algorithm; identify complexity and failure points.

Relevant notes: Topic C: Graph Traversal.

Full description

Given a graph, simulate the execution of BFS and Dijkstra's shortest-paths algorithms. Identify the computational complexity of the algorithms and its dependence on the properties of the queue data structure. Identify failures of the algorithms when their assumptions fail.

Example problem

Given the below graph, simulate the execution of Dijkstra's algorithm starting from u. Report, at the beginning of each iteration of the while loop, the state of the priority queue and the distance table, and which vertex is popped from the queue.

A weighted graph.

Sample solution

Sample solution.
Rounddist[u]dist[v]dist[w]dist[x]dist[y]queuevertex popped
10$\infty$$\infty$$\infty$$\infty$u, v, w, x, yu
2037$\infty$$\infty$v, w, x, yv
30375$\infty$x, w, yx
4037514w, yw
5037514yy
6037514$\quad$

Rubric

Rubric.

To pass, a solution must follow the course requirements for writing.

To pass, the solution must be clear, easy to read, and correct at each stage.

The numerical rubric for this problem is: