18 Graphs Part 4

18 Graphs Part 4 - Graphs, part 4 Minimum Spanning Trees...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
Graphs, part 4 Minimum Spanning Trees 15-211: Fundamental Data Structures and Algorithms Charlie Garrod 25 March 2010
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Announcements HW5 (KevinBacon) is available You must work alone
Background image of page 2
3 Last time: Relax! (shortest paths) For each node v store d[v] , the best-known distance so far An algorithm: PVD BOS JFK ORD LAX SFO DFW BWI MIA 337 2704 1846 1464 1235 2342 802 867 849 740 187 144 1391 184 1121 946 1090 1258 621 While there exists a tense edge Relax some edges Relax(u,v): if (d[v] > d[u] + w u,v ) d[v] = d[u] + w u,v v u w u,v s d[u]
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Relaxing the frontier Suppose we’ve computed the shortest distances for some vertices C , and we’ve relaxed all edges out of C Then d[v] is a shortest distance for some vertex v in the frontier C s s 1 s 2 s 3 s k v 1 v j v 2 v 3 v 0 w 0 w 1 w 2 w 3 w 4 w 5 w 6 w 7 V-C
Background image of page 4
5 Dijkstra’s algorithm If edge weights are non-negative then the smallest d[v] in the frontier is the shortest distance to v C s s 1 s 2 s 3 s k v 1 v j v 2 v 3 v 0 w 0 w 1 w 2 w 3 w 4 w 5 w 6 w 7 V-C
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Bellman-Ford algorithm We don’t know which vertices are in C Relax all edges in the graph We know this adds some vertex to C C s s 1 s 2 s 3 s k v 1 v j v 2 v 3 v 0 w 0 w 1 w 2 w 3 w 4 w 5 w 6 w 7 V-C
Background image of page 6
7 Minimum Spanning Trees (MSTs) Minimum Spanning Trees Algorithms for MSTs The Red Rule Prim’s algorithm Kruskal’s algorithm
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Problem: Laying telephone wire Central office
Background image of page 8
9 Wiring: A naïve approach Central office
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Wiring: A better approach Central office
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 05/10/2011.

Page1 / 33

18 Graphs Part 4 - Graphs, part 4 Minimum Spanning Trees...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online