Shortest paths and spanning trees
1.[2p] What does relaxing the edge of weight do?
What does relaxing the edge of weight do?
2.[3p] In the undirected graph with edges AB 4, AC 2, BC 1, BD 5, CD 8, CE 10, DE 2, DF 6, EF 3, what is the shortest distance from A to F?
In the undirected graph with edges AB 4, AC 2, BC 1, BD 5, CD 8, CE 10, DE 2, DF 6, EF 3, what is the shortest distance from A to F?
3.[2p] In that same graph, what is the shortest distance from A to D?
In that same graph, what is the shortest distance from A to D?
4.[3p] Dijkstra's correctness argument fails with a negative edge because
Dijkstra's correctness argument fails with a negative edge because
5.[2p] Adding a large constant to every edge weight makes a graph with negative edges safe for Dijkstra.
Adding a large constant to every edge weight makes a graph with negative edges safe for Dijkstra.
6.[2p] Bellman-Ford makes passes over the whole edge set. On a graph with 50 vertices and 200 edges, how many edge relaxations is that?
Bellman-Ford makes passes over the whole edge set. On a graph with 50 vertices and 200 edges, how many edge relaxations is that?
7.[3p] Run Kruskal on the graph with edges PQ 7, PR 5, QR 8, QS 9, RS 15, RT 6, ST 8, SU 5, TU 11. What is the total weight of the minimum spanning tree?
Run Kruskal on the graph with edges PQ 7, PR 5, QR 8, QS 9, RS 15, RT 6, ST 8, SU 5, TU 11. What is the total weight of the minimum spanning tree?
8.[3p] The cut property says that
The cut property says that
9.[3p] Match each algorithm to what it takes at each step.
Match each algorithm to what it takes at each step.
Dijkstra
Prim
Kruskal
Bellman-Ford
the vertex with the smallest distance estimate
the cheapest edge leaving the tree so far
no choice at all, every edge each pass
the cheapest remaining edge joining two components
Show the answer
Dijkstra: the vertex with the smallest distance estimate Prim: the cheapest edge leaving the tree so far Kruskal: the cheapest remaining edge joining two components Bellman-Ford: no choice at all, every edge each pass