Imperial College London – Department of Computing
MSc in Computing Science
580: Algorithms
Tutorial: Graph Algorithms
1. Compute a minimum spanning tree for the graph below using Kruskal’s algorithm. List
the edges in the order they are added to the tree, and the weight of the tree after each
iteration. Whenever there is a choice of edges, pick the edge {u, v} that contains the
lowest vertex id.
2. Compute a minimum spanning tree for the same graph using Prim’s algorithm, starting
at vertex 5. List the vertices in the order they are added to the tree, and the weight of
the tree after each iteration. Whenever there is a choice of vertices, pick the one with the
lowest id.
3. Compute the shortest (lowest weight) path from A to each vertex of the graph below using
the Bellman–Ford algorithm. In each pass through the graph, use the order B, C, D, E,
A to determine the next vertex u for which all edges (u, v) should be relaxed. List the
estimated distance and the parent for each vertex after each pass.
4. Compute the shortest (lowest weight) path from A to each vertex of the same graph using
Dijkstra’s algorithm. List the estimated distance and the parent for each vertex after each
iteration of the algorithm.
1