Minimum Spanning Trees
|
|
- Bryan Atkins
- 6 years ago
- Views:
Transcription
1 Minimum Spanning Trees
2 Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and no more) roads such that 1. everyone stays connected: can reach every house from all other houses, and 2. total repair cost is minimum.
3 Model as a graph: Undirected graph G = (V, E). Weight w(u, v) on each edge (u, v) E. Find T E such that 1. T connects all vertices (T is a spanning tree), and 2. w(t ) = w(u, v) is minimized. (u,v) T A spanning tree whose weight is minimum over all spanning trees is called a minimum spanning tree, or MST. Example of such a graph [edges in MST are shaded] : a b c 8 8 d 7 e f 5 6 g h i In this example, there is more than one MST. Replace edge (e, f ) by (c, e). Get a different spanning tree with the same weight.
4 Some properties of an MST: It has V 1 edges. It has no cycles. It might not be unique. 8 8 b d g a 9 e 9 i c f h 1 6 In this example, there is more than one MST.
5 Growing a minimum spanning tree Building up the solution We will build a set A of edges. Initially, A has no edges. As we add edges to A, maintain a loop invariant: Loop invariant: A is a subset of some MST. Add only edges that maintain the invariant. If A is a subset of some MST, an edge (u, v) is safe for A if and only if A {(u, v)} is also a subset of some MST. So we will add only safe edges.
6 Generic MST algorithm GENERIC-MST(G, w) A while A is not a spanning tree do find an edge (u, v) that is safe for A A A {(u, v)} return A
7 Finding a safe edge How do we find safe edges? Let s look at the example. Edge (c, f ) has the lowest weight of any edge in the graph. Is it safe for A =? Intuitively: Let S V be any set of vertices that includes c but not f (so that 8 8 b d g a 9 e 9 i c f h 1 6 In this example, there is more than one MST.
8 Cuts and light edges A cut (S, V S) is a partition of vertices into disjoint sets V and S V. Edge (u, v) E crosses cut (S, V S) if one endpoint is in S and the other is in V S. A cut respects A if and only if no edge in A crosses the cut. An edge is a light edge crossing a cut if and only if its weight is minimum over all edges crossing the cut. For a given cut, there can be > 1 light edge crossing it.
9 Kruskal s algorithm
10
11
12
13
14
15
16
17
18
19
20
21
22
23 KRUSKAL(V, E, w) A for each vertex v V do MAKE-SET(v) sort E into nondecreasing order by weight w for each (u, v) taken from the sorted list do if FIND-SET(u) = FIND-SET(v) then A A {(u, v)} UNION(u, v) return A
24 Prim s algorithm Builds one tree, so A is always a tree. Starts from an arbitrary root r. At each step, find a light edge crossing cut (V A, V V A ), where V A = vertices that A is incident on. Add this edge to A. V A light edge
25
26
27
28
29
30
31
32
33
34 PRIM(V, E, w, r) Q for each u V do key[u] π[u] NIL INSERT(Q, u) DECREASE-KEY(Q, r, 0) key[r] 0 while Q = do u EXTRACT-MIN(Q) for each v Adj[u] do if v Q and w(u, v) < key[v] then π[v] u DECREASE-KEY(Q, v, w(u, v)) Do example from previous graph. [Let a student pick the root.]
35 Single-Source Shortest Path
36 Shortest paths How to find the shortest route between two points on a map. Input: Directed graph G = (V, E) Weight function w : E R Weight of path p = v 0, v 1,..., v k k = w(v i 1, v i ) i=1 = sum of edge weights on path p. Shortest-path weight u to v: { { p δ(u, v) = min w(p) : u v } if there exists a path u v, otherwise. Shortest path u to v is any path p such that w( p) = δ(u, v).
37 Example: shortest paths from s s t x y z s t x y z This example shows that the shortest path might not be unique. It also shows that when we look at shortest paths from one vertex to all o
38 Negative-weight edges OK, as long as no negative-weight cycles are reachable from the source. If we have a negative-weight cycle, we can just keep going around it, and get w(s, v) = for all v on the cycle. But OK if the negative-weight cycle is not reachable from the source. Some algorithms work only if there are no negative-weight edges in the graph. We ll be clear when they re allowed and not allowed.
39 Output of single-source shortest-path algorithm For each vertex v V : d[v] = δ(s, v). Initially, d[v] =. Reduces as algorithms progress. But always maintain d[v] δ(s, v). Call d[v] a shortest-path estimate. π[v] = predecessor of v on a shortest path from s. If no predecessor, π[v] = NIL. π induces a tree shortest-path tree. We won t prove properties of π in lecture see text.
40 Initialization All the shortest-paths algorithms start with INIT-SINGLE-SOURCE. INIT-SINGLE-SOURCE(V, s) for each v V do d[v] π[v] NIL d[s] 0
41 Relaxing an edge (u, v) Can we improve the shortest-path estimate for v by going through u and taking (u, v)?
42 Relaxing an edge (u, v) Can we improve the shortest-path estimate for v by going through u and taking (u, v)? RELAX(u, v, w) if d[v] > d[u] + w(u, v) then d[v] d[u] + w(u, v) π[v] u u v RELAX 4 7 RELAX 4 6
43 The Bellman-Ford algorithm
44 BELLMAN-FORD(V, E, w, s) INIT-SINGLE-SOURCE(V, s) for i 1 to V 1 do for each edge (u, v) E do RELAX(u, v, w) for each edge (u, v) E do if d[v] > d[u] + w(u, v) then return FALSE return TRUE
45
46
47
48
49
50 The Bellman-Ford algorithm Allows negative-weight edges. Computes d[v] and π[v] for all v V. Returns TRUE if no negative-weight cycles reachable from s, FALSE otherwise. Core: The first for loop relaxes all edges V 1 times. Time: (V E).
51 The Bellman-Ford algorithm guaranteed to converge after V 1 passes, assuming no negative-weight les. cycles. Proof Use path-relaxation property. Let v be reachable from s, and let p = v 0, v 1,..., v k be a shortest path from s to v, where v 0 = s and v k = v. Since p is acyclic, it has V 1 edges, so k V 1. Each iteration of the for loop relaxes all edges: First iteration relaxes (v 0, v 1 ). Second iteration relaxes (v 1, v 2 ). kth iteration relaxes (v k 1, v k ). By the path-relaxation property, d[v] = d[v k ] = δ(s, v k ) = δ(s, v).
52 Dijkstra s algorithm No negative-weight edges. Essentially a weighted version of breadth-first search. Instead of a FIFO queue, uses a priority queue. Keys are shortest-path weights (d[v]). Have two sets of vertices: S = vertices whose final shortest-path weights are determined, Q = priority queue = V S. D V E s
53 = = DIJKSTRA(V, E, w, s) INIT-SINGLE-SOURCE(V, s) S Q V i.e., insert all vertices into Q while Q = do u EXTRACT-MIN(Q) S S {u} for each vertex v Adj[u] do RELAX(u, v, w) Looks a lot like Prim s algorithm, but compu
54
55
56
57
58
59
60 Single-source shortest paths in a directed acyclic graph Since a dag, we re guaranteed no negative-weight cycles. DAG-SHORTEST-PATHS(V, E, w, s) topologically sort the vertices INIT-SINGLE-SOURCE(V, s) for each vertex u, taken in topologically sorted order do for each vertex v Adj[u] do RELAX(u, v, w) Example: 6 1 s t x y z Time: (V + E).
61 All-Pairs Shortest Paths
62 Given a directed graph G = (V, E), weight function w : E R, V = n. Goal: create an n n matrix of shortest-path distances δ(u, v). Could run BELLMAN-FORD once from each vertex: O(V 2 E) which is O(V 4 ) if the graph is dense (E = (V 2 )). If no negative-weight edges, could run Dijkstra s algorithm once from each vertex: O(V E lg V ) with binary heap O(V 3 lg V ) if dense, O(V 2 lg V + V E) with Fibonacci heap O(V 3 ) if dense. We ll see how to do in O(V 3 ) in all cases, with no fancy data structure.
63 Shortest paths a Assume that G is given as adjacency matrix of weights: W = (w ij ), with vertices numbered 1 to n. 0 if i = j, w ij = weight of (i, j) if i = j, (i, j) E, if i = j, (i, j) / E. Output is matrix =, where =. Won t worry about predeces- Optimal substructure: Recall: subpaths of shortest paths are shortest paths. m =
64 Floyd-Warshall algorithm
65 Floyd-Warshall algorithm A different dynamic-programming approach. For path p = v 1, v 2,..., v l, an intermediate vertex is any vertex of p other than v 1 or v l. Let d (k) i j = shortest-path weight of any path i j with all intermediate vertices in {1, 2,..., k}. p Consider a shortest path i j with all intermediate vertices in {1, 2,..., k}: If k is not an intermediate vertex, then all intermediate vertices of p are in {1, 2,..., k 1}. If k is an intermediate vertex: p 1 p 2 i k j all intermediate vertices in {1, 2,..., k 1}
66 p 1 p 2 i k j all intermediate vertices in {1, 2,..., k 1} Recursive formulation { d (k) wij if k = 0, ij = min ( d (k 1) ij, d (k 1) ik + d (k 1) ) kj if k 1. (Have d (0) ij Want D (n) = ( d (n) ij = w ij because can t have intermediate vertices 1 edge.) ), since all vertices numbered n.
67 = ( ) Compute bottom-up Compute in increasing order of k: FLOYD-WARSHALL(W, n) D (0) W for k 1 to n do for i 1 to n return D (n) do for j 1 to n do d (k) ij min ( d (k 1) ij, d (k 1) ik + d (k 1) ) kj
68 = ( ) Compute bottom-up Compute in increasing order of k: FLOYD-WARSHALL(W, n) D (0) W for k 1 to n do for i 1 to n return D (n) do for j 1 to n do d (k) ij min ( d (k 1) ij, d (k 1) ik + d (k 1) ) kj Time: (n 3 ).
69
70
71
72 Transitive closure Given G = (V, = E), directed. Compute G = (V, E ). E = {(i, j) : there is a path i j in G}. Could assign weight of 1 to each edge, then run FLOYD-WARSHALL. If d ij < n, then there is a path i j. Otherwise, d ij = and there is no path.
73 Simpler way: Substitute other values and operators in FLOYD-WARSHALL. Use unweighted adjacency matrix min (OR) + (AND) { t (k) 1 if there is path i j with all intermediate vertices in {1, 2,..., k}, ij = 0 otherwise. { t (0) 0 if i = j and (i, j) / E, ij = 1 if i = j or (i, j) E. t (k) ij = t (k 1) ij ( t (k 1) ik t (k 1) kj ). T -C E n
74 { = ( ) TRANSITIVE-CLOSURE(E, n) for i 1 to n do for j 1 to n do if i = j or (i, j) E[G] then t (0) ij 1 else t (0) ij 0 for k 1 to n do for i 1 to n return T (n) do for j 1 to n do t (k) ij t (k 1) ij ( t (k 1) ik t (k 1) ) kj
75 { = ( ) TRANSITIVE-CLOSURE(E, n) for i 1 to n do for j 1 to n do if i = j or (i, j) E[G] then t (0) ij 1 else t (0) ij 0 for k 1 to n do for i 1 to n do for j 1 to n do t (k) ij t (k 1) ij ( t (k 1) ik return T (n) ( ) t (k 1) ) kj Time: (n 3 ), but simpler operations than FLOYD-WARSHALL.
Lecture Notes for Chapter 23: Minimum Spanning Trees
Lecture Notes for Chapter 23: Minimum Spanning Trees Chapter 23 overview Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting houses u and v has
More informationTaking Stock. Last Time Flows. This Time Review! 1 Characterize the structure of an optimal solution
Taking Stock IE170: Algorithms in Systems Engineering: Lecture 26 Jeff Linderoth Last Time Department of Industrial and Systems Engineering Lehigh University April 2, 2007 This Time Review! Jeff Linderoth
More informationShortest Path Problem
Shortest Path Problem CLRS Chapters 24.1 3, 24.5, 25.2 Shortest path problem Shortest path problem (and variants) Properties of shortest paths Algorithmic framework Bellman-Ford algorithm Shortest paths
More informationMinimum Spanning Trees
Minimum Spanning Trees Overview Problem A town has a set of houses and a set of roads. A road connects and only houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and
More informationTaking Stock. IE170: Algorithms in Systems Engineering: Lecture 20. Example. Shortest Paths Definitions
Taking Stock IE170: Algorithms in Systems Engineering: Lecture 20 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University March 19, 2007 Last Time Minimum Spanning Trees Strongly
More informationShortest path problems
Next... Shortest path problems Single-source shortest paths in weighted graphs Shortest-Path Problems Properties of Shortest Paths, Relaxation Dijkstra s Algorithm Bellman-Ford Algorithm Shortest-Paths
More informationPart VI Graph algorithms. Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths
Part VI Graph algorithms Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths 1 Chapter 22 Elementary Graph Algorithms Representations of graphs
More informationfrom notes written mostly by Dr. Carla Savage: All Rights Reserved
CSC 505, Fall 2000: Week 9 Objectives: learn about various issues related to finding shortest paths in graphs learn algorithms for the single-source shortest-path problem observe the relationship among
More informationSingle Source Shortest Path (SSSP) Problem
Single Source Shortest Path (SSSP) Problem Single Source Shortest Path Problem Input: A directed graph G = (V, E); an edge weight function w : E R, and a start vertex s V. Find: for each vertex u V, δ(s,
More informationComputer Science & Engineering 423/823 Design and Analysis of Algorithms
Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 07 Single-Source Shortest Paths (Chapter 24) Stephen Scott and Vinodchandran N. Variyam sscott@cse.unl.edu 1/36 Introduction
More informationSingle Source Shortest Path
Single Source Shortest Path A directed graph G = (V, E) and a pair of nodes s, d is given. The edges have a real-valued weight W i. This time we are looking for the weight and the shortest path from s
More informationCOMP251: Single source shortest paths
COMP51: Single source shortest paths Jérôme Waldispühl School of Computer Science McGill University Based on (Cormen et al., 00) Problem What is the shortest road to go from one city to another? Eample:
More information4/8/11. Single-Source Shortest Path. Shortest Paths. Shortest Paths. Chapter 24
/8/11 Single-Source Shortest Path Chapter 1 Shortest Paths Finding the shortest path between two nodes comes up in many applications o Transportation problems o Motion planning o Communication problems
More informationLecture 11: Analysis of Algorithms (CS ) 1
Lecture 11: Analysis of Algorithms (CS583-002) 1 Amarda Shehu November 12, 2014 1 Some material adapted from Kevin Wayne s Algorithm Class @ Princeton 1 2 Dynamic Programming Approach Floyd-Warshall Shortest
More informationGreedy Algorithms. At each step in the algorithm, one of several choices can be made.
Greedy Algorithms At each step in the algorithm, one of several choices can be made. Greedy Strategy: make the choice that is the best at the moment. After making a choice, we are left with one subproblem
More information1 Start with each vertex being its own component. 2 Merge two components into one by choosing the light edge
Taking Stock IE170: in Systems Engineering: Lecture 19 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University March 16, 2007 Last Time Minimum This Time More Strongly Connected
More informationUnit 2: Algorithmic Graph Theory
Unit 2: Algorithmic Graph Theory Course contents: Introduction to graph theory Basic graph algorithms Reading Chapter 3 Reference: Cormen, Leiserson, and Rivest, Introduction to Algorithms, 2 nd Ed., McGraw
More informationCOP 4531 Complexity & Analysis of Data Structures & Algorithms
COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 9 Minimum Spanning Trees Thanks to the text authors who contributed to these slides Why Minimum Spanning Trees (MST)? Example 1 A
More information2pt 0em. Computer Science & Engineering 423/823 Design and Analysis of Algorithms. Lecture 04 Minimum-Weight Spanning Trees (Chapter 23)
2pt 0em Computer Science & Engineering 423/823 Design and of s Lecture 04 Minimum-Weight Spanning Trees (Chapter 23) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 18 Given a connected, undirected
More informationOutline. (single-source) shortest path. (all-pairs) shortest path. minimum spanning tree. Dijkstra (Section 4.4) Bellman-Ford (Section 4.
Weighted Graphs 1 Outline (single-source) shortest path Dijkstra (Section 4.4) Bellman-Ford (Section 4.6) (all-pairs) shortest path Floyd-Warshall (Section 6.6) minimum spanning tree Kruskal (Section 5.1.3)
More informationShortest Paths. Nishant Mehta Lectures 10 and 11
Shortest Paths Nishant Mehta Lectures 0 and Communication Speeds in a Computer Network Find fastest way to route a data packet between two computers 6 Kbps 4 0 Mbps 6 6 Kbps 6 Kbps Gbps 00 Mbps 8 6 Kbps
More informationShortest Paths. Nishant Mehta Lectures 10 and 11
Shortest Paths Nishant Mehta Lectures 0 and Finding the Fastest Way to Travel between Two Intersections in Vancouver Granville St and W Hastings St Homer St and W Hastings St 6 Granville St and W Pender
More informationComputer Science & Engineering 423/823 Design and Analysis of Algorithms
Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 05 Minimum-Weight Spanning Trees (Chapter 23) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu Introduction
More informationMinimum Spanning Trees My T. UF
Introduction to Algorithms Minimum Spanning Trees @ UF Problem Find a low cost network connecting a set of locations Any pair of locations are connected There is no cycle Some applications: Communication
More information22 Elementary Graph Algorithms. There are two standard ways to represent a
VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph
More informationLecture 10. Elementary Graph Algorithm Minimum Spanning Trees
Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo
More informationIntroduction to Algorithms. Lecture 11
Introduction to Algorithms Lecture 11 Last Time Optimization Problems Greedy Algorithms Graph Representation & Algorithms Minimum Spanning Tree Prim s Algorithm Kruskal s Algorithm 2 Today s Topics Shortest
More informationMinimum Spanning Trees Ch 23 Traversing graphs
Next: Graph Algorithms Graphs Ch 22 Graph representations adjacency list adjacency matrix Minimum Spanning Trees Ch 23 Traversing graphs Breadth-First Search Depth-First Search 11/30/17 CSE 3101 1 Graphs
More informationAlgorithms. All-Pairs Shortest Paths. Dong Kyue Kim Hanyang University
Algorithms All-Pairs Shortest Paths Dong Kyue Kim Hanyang University dqkim@hanyang.ac.kr Contents Using single source shortest path algorithms Presents O(V 4 )-time algorithm, O(V 3 log V)-time algorithm,
More informationMinimum Spanning Trees
Chapter 23 Minimum Spanning Trees Let G(V, E, ω) be a weighted connected graph. Find out another weighted connected graph T(V, E, ω), E E, such that T has the minimum weight among all such T s. An important
More informationSingle Source Shortest Paths
Single Source Shortest Paths Given a connected weighted directed graph G(V, E), associated with each edge u, v E, there is a weight w(u, v). The single source shortest paths (SSSP) problem is to find a
More information22 Elementary Graph Algorithms. There are two standard ways to represent a
VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph
More informationMinimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem
Minimum Spanning Trees (Forests) Given an undirected graph G=(V,E) with each edge e having a weight w(e) : Find a subgraph T of G of minimum total weight s.t. every pair of vertices connected in G are
More informationGraphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College
Laura Toma Algorithms (csci2200), Bowdoin College Topics Weighted graphs each edge (u, v) has a weight denoted w(u, v) or w uv stored in the adjacency list or adjacency matrix The weight of a path p =
More informationParallel Graph Algorithms
Parallel Graph Algorithms Design and Analysis of Parallel Algorithms 5DV050/VT3 Part I Introduction Overview Graphs definitions & representations Minimal Spanning Tree (MST) Prim s algorithm Single Source
More informationCS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019
CS 341: Algorithms Douglas R. Stinson David R. Cheriton School of Computer Science University of Waterloo February 26, 2019 D.R. Stinson (SCS) CS 341 February 26, 2019 1 / 296 1 Course Information 2 Introduction
More informationIntroduction. I Given a weighted, directed graph G =(V, E) with weight function
ntroduction Computer Science & Engineering 2/82 Design and Analysis of Algorithms Lecture 06 Single-Source Shortest Paths (Chapter 2) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu
More informationMinimum Spanning Trees
Minimum Spanning Trees 1 Minimum- Spanning Trees 1. Concrete example: computer connection. Definition of a Minimum- Spanning Tree Concrete example Imagine: You wish to connect all the computers in an office
More information1 Summation Formulae, Induction and Bounding. 2 How to compare functions: o, ω, O, Ω, Θ. 3 How to count the running time of algorithms
What We ve Learned Part One IE170: Algorithms in Systems Engineering: Lecture 33 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University April 25, 2007 1 Summation Formulae, Induction
More informationAlgorithms on Graphs: Part III. Shortest Path Problems. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..
.. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar.. Shortest Path Problems Algorithms on Graphs: Part III Path in a graph. Let G = V,E be a graph. A path p = e 1,...,e k, e i E,
More informationCS420/520 Algorithm Analysis Spring 2009 Lecture 14
CS420/520 Algorithm Analysis Spring 2009 Lecture 14 "A Computational Analysis of Alternative Algorithms for Labeling Techniques for Finding Shortest Path Trees", Dial, Glover, Karney, and Klingman, Networks
More informationWeek 11: Minimum Spanning trees
Week 11: Minimum Spanning trees Agenda: Minimum Spanning Trees Prim s Algorithm Reading: Textbook : 61-7 1 Week 11: Minimum Spanning trees Minimum spanning tree (MST) problem: Input: edge-weighted (simple,
More informationIntroduction to Algorithms
Introduction to Algorithms 6.046J/18.401J LECTURE 13 Graph algorithms Graph representation Minimum spanning trees Greedy algorithms Optimal substructure Greedy choice Prim s greedy MST algorithm Prof.
More informationCOT 6405 Introduction to Theory of Algorithms
COT 6405 Introduction to Theory of Algorithms Topic 16. Single source shortest path 11/18/2015 1 Problem definition Problem: given a weighted directed graph G, find the minimum-weight path from a given
More informationLecture 10: Analysis of Algorithms (CS ) 1
Lecture 10: Analysis of Algorithms (CS583-002) 1 Amarda Shehu November 05, 2014 1 Some material adapted from Kevin Wayne s Algorithm Class @ Princeton 1 Topological Sort Strongly Connected Components 2
More informationAnalysis of Algorithms, I
Analysis of Algorithms, I CSOR W4231.002 Eleni Drinea Computer Science Department Columbia University Thursday, March 8, 2016 Outline 1 Recap Single-source shortest paths in graphs with real edge weights:
More informationDecreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, )
Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 1. if >. 2. error new key is greater than current key 3.. 4.. 5. if NIL and.
More informationIntroduction. I Given a weighted, directed graph G =(V, E) with weight function
ntroduction Computer Science & Engineering 2/82 Design and Analysis of Algorithms Lecture 05 Single-Source Shortest Paths (Chapter 2) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu
More informationParallel Graph Algorithms
Parallel Graph Algorithms Design and Analysis of Parallel Algorithms 5DV050 Spring 202 Part I Introduction Overview Graphsdenitions, properties, representation Minimal spanning tree Prim's algorithm Shortest
More informationWeek 12: Minimum Spanning trees and Shortest Paths
Agenda: Week 12: Minimum Spanning trees and Shortest Paths Kruskal s Algorithm Single-source shortest paths Dijkstra s algorithm for non-negatively weighted case Reading: Textbook : 61-7, 80-87, 9-601
More informationFundamental Algorithms CSCI-GA /Summer Solution to Homework 8
Fundamental Algorithms CSCI-GA.70-00/Summer 206 Solution to Homework 8 Problem (CLRS 23.-6). ( point) Show that a graph has a unique minimum spanning tree if, for every cut of the graph, there is a unique
More information5.4 Shortest Paths. Jacobs University Visualization and Computer Graphics Lab. CH : Algorithms and Data Structures 456
5.4 Shortest Paths CH08-320201: Algorithms and Data Structures 456 Definitions: Path Consider a directed graph G=(V,E), where each edge e є E is assigned a non-negative weight w: E -> R +. A path is a
More informationArtificial Intelligence
Artificial Intelligence Shortest Path Problem G. Guérard Department of Nouvelles Energies Ecole Supérieur d Ingénieurs Léonard de Vinci Lecture 3 GG A.I. 1/42 Outline 1 The Shortest Path Problem Introduction
More informationMA 252: Data Structures and Algorithms Lecture 36. Partha Sarathi Mandal. Dept. of Mathematics, IIT Guwahati
MA 252: Data Structures and Algorithms Lecture 36 http://www.iitg.ernet.in/psm/indexing_ma252/y12/index.html Partha Sarathi Mandal Dept. of Mathematics, IIT Guwahati The All-Pairs Shortest Paths Problem
More informationDijkstra s Shortest Path Algorithm
Dijkstra s Shortest Path Algorithm DPV 4.4, CLRS 24.3 Revised, October 23, 2014 Outline of this Lecture Recalling the BFS solution of the shortest path problem for unweighted (di)graphs. The shortest path
More informationUnit 5F: Layout Compaction
Course contents Unit 5F: Layout Compaction Design rules Symbolic layout Constraint-graph compaction Readings: Chapter 6 Unit 5F 1 Design rules: restrictions on the mask patterns to increase the probability
More informationUnit 3: Layout Compaction
Unit 3: Layout Compaction Course contents Design rules Symbolic layout Constraint-graph compaction Readings: Chapter 6 Unit 3 1 Design rules: restrictions on the mask patterns to increase the probability
More informationMinimum spanning trees
Minimum spanning trees [We re following the book very closely.] One of the most famous greedy algorithms (actually rather family of greedy algorithms). Given undirected graph G = (V, E), connected Weight
More informationChapter 25: All-Pairs Shortest-Paths
Chapter : All-Pairs Shortest-Paths When no negative edges Some Algorithms Using Dijkstra s algorithm: O(V ) Using Binary heap implementation: O(VE lg V) Using Fibonacci heap: O(VE + V log V) When no negative
More informationCSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li
CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast
More informationIntroduction to Algorithms
Introduction to Algorithms 6.046J/18.401J LECTURE 16 Greedy Algorithms (and Graphs) Graph representation Minimum spanning trees Optimal substructure Greedy choice Prim s greedy MST algorithm Prof. Charles
More informationDesign and Analysis of Algorithms 演算法設計與分析. Lecture 13 December 18, 2013 洪國寶
Design and Analysis of Algorithms 演算法設計與分析 Lecture 13 December 18, 2013 洪國寶 1 Homework #10 1. 24.1-1 (p. 591 / p. 654) 2. 24.1-6 (p. 592 / p. 655) 3. 24.3-2 (p. 600 / p. 663) 4. 24.3-8 (p. 601) / 24.3-10
More informationCSE 431/531: Analysis of Algorithms. Greedy Algorithms. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo
CSE 431/531: Analysis of Algorithms Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast algorithms to solve
More informationAnnouncements Problem Set 5 is out (today)!
CSC263 Week 10 Announcements Problem Set is out (today)! Due Tuesday (Dec 1) Minimum Spanning Trees The Graph of interest today A connected undirected weighted graph G = (V, E) with weights w(e) for each
More informationSample Solutions to Homework #4
National Taiwan University Handout #25 Department of Electrical Engineering January 02, 207 Algorithms, Fall 206 TA: Zhi-Wen Lin and Yen-Chun Liu Sample Solutions to Homework #4. (0) (a) Both of the answers
More informationChapter 23. Minimum Spanning Trees
Chapter 23. Minimum Spanning Trees We are given a connected, weighted, undirected graph G = (V,E;w), where each edge (u,v) E has a non-negative weight (often called length) w(u,v). The Minimum Spanning
More informationCS 561, Lecture 9. Jared Saia University of New Mexico
CS 561, Lecture 9 Jared Saia University of New Mexico Today s Outline Minimum Spanning Trees Safe Edge Theorem Kruskal and Prim s algorithms Graph Representation 1 Graph Definition A graph is a pair of
More informationLecture I: Shortest Path Algorithms
Lecture I: Shortest Path Algorithms Dr Kieran T. Herley Department of Computer Science University College Cork October 201 KH (21/10/1) Lecture I: Shortest Path Algorithms October 201 1 / 28 Background
More informationG205 Fundamentals of Computer Engineering. CLASS 21, Mon. Nov Stefano Basagni Fall 2004 M-W, 1:30pm-3:10pm
G205 Fundamentals of Computer Engineering CLASS 21, Mon. Nov. 22 2004 Stefano Basagni Fall 2004 M-W, 1:30pm-3:10pm Greedy Algorithms, 1 Algorithms for Optimization Problems Sequence of steps Choices at
More information6.006 Introduction to Algorithms Spring 2008
MIT OpenCourseWare http://ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Introduction to Algorithms:
More informationIntroduction to Algorithms
Introduction to Algorithms, Lecture 1 /1/200 Introduction to Algorithms.04J/1.401J LECTURE 11 Graphs, MST, Greedy, Prim Graph representation Minimum spanning trees Greedy algorithms hallmarks. Greedy choice
More informationModule 5 Graph Algorithms
Module 5 Graph lgorithms Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 97 E-mail: natarajan.meghanathan@jsums.edu 5. Graph Traversal lgorithms Depth First
More informationLecture 18 Graph-Based Algorithms. CSE373: Design and Analysis of Algorithms
Lecture 18 Graph-Baed Algorithm CSE: Deign and Anali of Algorithm Shortet Path Problem Modeling problem a graph problem: Road map i a weighted graph: vertice = citie edge = road egment between citie edge
More informationLecture 6 Basic Graph Algorithms
CS 491 CAP Intro to Competitive Algorithmic Programming Lecture 6 Basic Graph Algorithms Uttam Thakore University of Illinois at Urbana-Champaign September 30, 2015 Updates ICPC Regionals teams will be
More informationAlgorithm Design and Analysis
Algorithm Design and Analysis LECTURE 6 Greedy Graph Algorithms Shortest paths Adam Smith 9/8/14 The (Algorithm) Design Process 1. Work out the answer for some examples. Look for a general principle Does
More informationMinimum Spanning Trees and Prim s Algorithm
Minimum Spanning Trees and Prim s Algorithm Version of October 3, 014 Version of October 3, 014 Minimum Spanning Trees and Prim s Algorithm 1 / 3 Outline Spanning trees and minimum spanning trees (MST).
More informationMinimum Spanning Trees
CSMPS 2200 Fall Minimum Spanning Trees Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk 11/6/ CMPS 2200 Intro. to Algorithms 1 Minimum spanning trees Input: A
More informationObject-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018
Object-oriented programming and data-structures CS/ENGRD 20 SUMMER 208 Lecture 3: Shortest Path http://courses.cs.cornell.edu/cs20/208su Graph Algorithms Search Depth-first search Breadth-first search
More informationMinimum Spanning Tree
Minimum Spanning Tree 1 Minimum Spanning Tree G=(V,E) is an undirected graph, where V is a set of nodes and E is a set of possible interconnections between pairs of nodes. For each edge (u,v) in E, we
More informationTitle. Ferienakademie im Sarntal Course 2 Distance Problems: Theory and Praxis. Nesrine Damak. Fakultät für Informatik TU München. 20.
Title Ferienakademie im Sarntal Course 2 Distance Problems: Theory and Praxis Nesrine Damak Fakultät für Informatik TU München 20. September 2010 Nesrine Damak: Classical Shortest-Path Algorithms 1/ 35
More informationAdvanced Algorithm Design and Analysis (Lecture 5) SW5 fall 2007 Simonas Šaltenis
Advanced Algorithm Design and Analysis (Lecture 5) SW5 fall 2007 Simonas Šaltenis 3.2.12 simas@cs.aau.dk All-pairs shortest paths Main goals of the lecture: to go through one more example of dynamic programming
More informationCS161 - Minimum Spanning Trees and Single Source Shortest Paths
CS161 - Minimum Spanning Trees and Single Source Shortest Paths David Kauchak Single Source Shortest Paths Given a graph G and two vertices s, t what is the shortest path from s to t? For an unweighted
More informationCS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya
CS60020: Foundations of Algorithm Design and Machine Learning Sourangshu Bhattacharya Graphs (review) Definition. A directed graph (digraph) G = (V, E) is an ordered pair consisting of a set V of vertices
More informationTIE Graph algorithms
TIE-20106 1 1 Graph algorithms This chapter discusses the data structure that is a collection of points (called nodes or vertices) and connections between them (called edges or arcs) a graph. The common
More informationShortest Path Algorithms
Shortest Path Algorithms Andreas Klappenecker [based on slides by Prof. Welch] 1 Single Source Shortest Path Given: a directed or undirected graph G = (V,E) a source node s in V a weight function w: E
More informationCSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Dan Grossman Fall 2013
CSE373: Data Structures & Algorithms Lecture 7: Minimum Spanning Trees Dan Grossman Fall 03 Spanning Trees A simple problem: Given a connected undirected graph G=(V,E), find a minimal subset of edges such
More informationCSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms
CSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms Professor Henry Carter Fall 2016 Recap Greedy algorithms iterate locally optimal choices to construct a globally optimal solution
More informationCHAPTER 13 GRAPH ALGORITHMS
CHAPTER 13 GRAPH ALGORITHMS SFO LAX ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND MOUNT (WILEY 00) AND SLIDES FROM NANCY
More informationChapter 24. Shortest path problems. Chapter 24. Shortest path problems. 24. Various shortest path problems. Chapter 24. Shortest path problems
Chapter 24. Shortest path problems We are given a directed graph G = (V,E) with each directed edge (u,v) E having a weight, also called a length, w(u,v) that may or may not be negative. A shortest path
More informationCHAPTER 23. Minimum Spanning Trees
CHAPTER 23 Minimum Spanning Trees In the design of electronic circuitry, it is often necessary to make the pins of several components electrically equivalent by wiring them together. To interconnect a
More informationClassical Shortest-Path Algorithms
DISTANCE PROBLEMS IN NETWORKS - THEORY AND PRACTICE Classical Shortest-Path Algorithms Nesrine Damak October 10, 2010 Abstract In this work, we present four algorithms for the shortest path problem. The
More informationCS521 \ Notes for the Final Exam
CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )
More informationIntroductory Computer Programming: Shortest Path Algorithms
Introductory Computer Programming: 2017-18 Shortest Path Algorithms Soumik Purkayastha MD-1710 Contents 1 Project Proposal 1 2 Report 3 2.1 Introduction........................................ 3 2.2 Basic
More informationChapter 22. Elementary Graph Algorithms
Graph Algorithms - Spring 2011 Set 7. Lecturer: Huilan Chang Reference: (1) Cormen, Leiserson, Rivest, and Stein, Introduction to Algorithms, 2nd Edition, The MIT Press. (2) Lecture notes from C. Y. Chen
More informationCOL 702 : Assignment 1 solutions
COL 70 : Assignment 1 solutions 1(a ( n T (n = T + bn log n ( n = T + b n ( n log + bn log n ( n = T + b n ( n 8 log + b n log ( n + bn log n = bn log n + b n log n + bn log n +... log n terms = nb [(log
More informationAlgorithm Design and Analysis
Algorithm Design and Analysis LECTURE 10 Implementing MST Algorithms Adam Smith Minimum spanning tree (MST) Input: A connected undirected graph G = (V, E) with weight function w : E R. For now, assume
More informationSolving problems on graph algorithms
Solving problems on graph algorithms Workshop Organized by: ACM Unit, Indian Statistical Institute, Kolkata. Tutorial-3 Date: 06.07.2017 Let G = (V, E) be an undirected graph. For a vertex v V, G {v} is
More informationThe Shortest Path Problem. The Shortest Path Problem. Mathematical Model. Integer Programming Formulation
The Shortest Path Problem jla,jc@imm.dtu.dk Department of Management Engineering Technical University of Denmark The Shortest Path Problem Given a directed network G = (V,E,w) for which the underlying
More informationTutorial. Question There are no forward edges. 4. For each back edge u, v, we have 0 d[v] d[u].
Tutorial Question 1 A depth-first forest classifies the edges of a graph into tree, back, forward, and cross edges. A breadth-first tree can also be used to classify the edges reachable from the source
More informationAlgorithms for Data Science
Algorithms for Data Science CSOR W4246 Eleni Drinea Computer Science Department Columbia University Shortest paths in weighted graphs (Bellman-Ford, Floyd-Warshall) Outline 1 Shortest paths in graphs with
More information