CS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya

Size: px
Start display at page:

Download "CS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya"

Transcription

1 CS60020: Foundations of Algorithm Design and Machine Learning Sourangshu Bhattacharya

2 Graphs (review) Definition. A directed graph (digraph) G = (V, E) is an ordered pair consisting of a set V of vertices (singular: vertex), a set E Í V V of edges. In an undirected graph G = (V, E), the edge set E consists of unordered pairs of vertices. In either case, we have E = O(V 2 ). Moreover, if G is connected, then E ³ V 1, which implies that lg E = Q(lgV). (Review CLRS, Appendix B.) November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.2

3 Adjacency-matrix representation The adjacency matrix of a graph G = (V, E), where V = {1, 2,, n}, is the matrix A[1.. n, 1.. n] given by 1 if (i, j) Î E, A[i, j] = 0 if (i, j) Ï E. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.3

4 Adjacency-matrix representation The adjacency matrix of a graph G = (V, E), where V = {1, 2,, n}, is the matrix A[1.. n, 1.. n] given by 1 if (i, j) Î E, A[i, j] = 0 if (i, j) Ï E A Q(V 2 ) storage Þ dense representation. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.4

5 Adjacency-list representation An adjacency list of a vertex v Î V is the list Adj[v] of vertices adjacent to v Adj[1] = {2, 3} Adj[2] = {3} Adj[3] = {} Adj[4] = {3} November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.5

6 Adjacency-list representation An adjacency list of a vertex v Î V is the list Adj[v] of vertices adjacent to v Adj[1] = {2, 3} Adj[2] = {3} Adj[3] = {} Adj[4] = {3} For undirected graphs, Adj[v] = degree(v). For digraphs, Adj[v] = out-degree(v). November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.6

7 Adjacency-list representation An adjacency list of a vertex v Î V is the list Adj[v] of vertices adjacent to v Adj[1] = {2, 3} Adj[2] = {3} Adj[3] = {} Adj[4] = {3} For undirected graphs, Adj[v] = degree(v). For digraphs, Adj[v] = out-degree(v). Handshaking Lemma: å vîv = 2 E for undirected graphs Þ adjacency lists use Q(V + E) storage a sparse representation (for either type of graph). November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.7

8 Minimum spanning trees Input: A connected, undirected graph G = (V, E) with weight function w : E R. For simplicity, assume that all edge weights are distinct. (CLRS covers the general case.) November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.8

9 Minimum spanning trees Input: A connected, undirected graph G = (V, E) with weight function w : E R. For simplicity, assume that all edge weights are distinct. (CLRS covers the general case.) Output: A spanning tree T a tree that connects all vertices of minimum weight: w(t )= å w(u,v). (u,v)ît November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.9

10 Example of MST November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.10

11 Example of MST November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.11

12 Optimal substructure MST T: (Other edges of G are not shown.) November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.12

13 Optimal substructure MST T: (Other edges of G are not shown.) Remove any edge (u, v) Î T. u v November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.13

14 Optimal substructure MST T: (Other edges of G are not shown.) Remove any edge (u, v) Î T. u v November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.14

15 Optimal substructure MST T: (Other edges of G are not shown.) u T 2 T 1 Remove any edge (u, v) Î T. Then, T is partitioned into two subtrees T 1 and T 2. v November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.15

16 Optimal substructure MST T: (Other edges of G are not shown.) u T 2 T 1 Remove any edge (u, v) Î T. Then, T is partitioned into two subtrees T 1 and T 2. Theorem. The subtree T 1 is an MST of G 1 = (V 1, E 1 ), the subgraph of G induced by the vertices of T 1 : V 1 = vertices of T 1, E 1 = {(x, y) Î E : x, y Î V 1 }. Similarly for T 2. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.16 v

17 Proof of optimal substructure Proof. Cut and paste: w(t) = w(u, v) + w(t 1 ) + w(t 2 ). If T 1 were a lower-weight spanning tree than T 1 for G 1, then T = {(u, v)} È T 1 È T 2 would bea lower-weight spanning tree than T for G. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.17

18 Proof of optimal substructure Proof. Cut and paste: w(t) = w(u, v) + w(t 1 ) + w(t 2 ). If T 1 were a lower-weight spanning tree than T 1 for G 1, then T = {(u, v)} È T 1 È T 2 would bea lower-weight spanning tree than T for G. Do we also have overlapping subproblems? Yes. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.18

19 Proof of optimal substructure Proof. Cut and paste: w(t) = w(u, v) + w(t 1 ) + w(t 2 ). If T 1 were a lower-weight spanning tree than T 1 for G 1, then T = {(u, v)} È T 1 È T 2 would bea lower-weight spanning tree than T for G. Do we also have overlapping subproblems? Yes. Great, then dynamic programming may work! Yes, but MST exhibits another powerful property which leads to an even more efficient algorithm. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.19

20 Hallmark for greedy algorithms Greedy-choice property A locally optimal choice is globally optimal. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.20

21 Hallmark for greedy algorithms Greedy-choice property A locally optimal choice is globally optimal. Theorem. Let T be the MST of G = (V, E), and let A Í V. Suppose that (u, v) Î E is the least-weight edge connecting A to V A. Then, (u, v) Î T. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.21

22 Proof of theorem Proof. Suppose (u, v) Ï T. Cut and paste. T: v Î A Î V A u (u, v) = least-weight edge connecting A to V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.22

23 Proof of theorem Proof. Suppose (u, v) Ï T. Cut and paste. T: v Î A Î V A u (u, v) = least-weight edge connecting A to V A Consider the unique simple path from u to v in T. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.23

24 Proof of theorem Proof. Suppose (u, v) Ï T. Cut and paste. T: v Î A Î V A u (u, v) = least-weight edge connecting A to V A Consider the unique simple path from u to v in T. Swap (u, v) with the first edge on this path that connects a vertex in A to a vertex in V A. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.24

25 Proof of theorem Proof. Suppose (u, v) Ï T. Cut and paste. T : v Î A Î V A u (u, v) = least-weight edge connecting A to V A Consider the unique simple path from u to v in T. Swap (u, v) with the first edge on this path that connects a vertex in A to a vertex in V A. A lighter-weight spanning tree than T results. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.25

26 Kruskal s Algorithm

27 Prim s algorithm IDEA: Maintain V A as a priority queue Q. Key each vertex in Q with the weight of the leastweight edge connecting it to a vertex in A. Q V key[v] for all v Î V key[s] 0 for some arbitrary s Î V while Q ¹ Æ do u EXTRACT-MIN(Q) for each v Î Adj[u] do if v Î Q and w(u, v) < key[v] then key[v] w(u, v) p[v] u At the end, {(v, p[v])} forms the MST. November 9, 2005 DECREASE-KEY Copyright by Erik D. Demaine and Charles E. Leiserson L16.26

28 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.27

29 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.28

30 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.29

31 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.30

32 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.31

33 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.32

34 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.33

35 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.34

36 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.35

37 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.36

38 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.37

39 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.38

40 Example of Prim s algorithm Î A Î V A November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.39

41 Analysis of Prim Q V key[v] for all v Î V key[s] 0 for some arbitrary s Î V while Q ¹ Æ do u EXTRACT-MIN(Q) for each v Î Adj[u] do if v Î Q and w(u, v) < key[v] then key[v] w(u, v) p[v] u November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.40

42 Analysis of Prim Q(V) total Q V key[v] for all v Î V key[s] 0 for some arbitrary s Î V while Q ¹ Æ do u EXTRACT-MIN(Q) for each v Î Adj[u] do if v Î Q and w(u, v) < key[v] then key[v] w(u, v) p[v] u November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.41

43 Analysis of Prim V times Q(V) total Q V key[v] for all v Î V key[s] 0 for some arbitrary s Î V while Q ¹ Æ do u EXTRACT-MIN(Q) for each v Î Adj[u] do if v Î Q and w(u, v) < key[v] then key[v] w(u, v) p[v] u November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.42

44 Analysis of Prim V times Q(V) total degree(u) times Q V key[v] for all v Î V key[s] 0 for some arbitrary s Î V while Q ¹ Æ do u EXTRACT-MIN(Q) for each v Î Adj[u] do if v Î Q and w(u, v) < key[v] then key[v] w(u, v) p[v] u November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.43

45 V times Analysis of Prim Q(V) total degree(u) times Q V key[v] for all v Î V key[s] 0 for some arbitrary s Î V while Q ¹ Æ do u EXTRACT-MIN(Q) for each v Î Adj[u] do if v Î Q and w(u, v) < key[v] then key[v] w(u, v) p[v] u Handshaking Lemma Þ Q(E) implicit DECREASE-KEY s. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.44

46 V times Analysis of Prim Q(V) total degree(u) times Q V key[v] for all v Î V key[s] 0 for some arbitrary s Î V while Q ¹ Æ do u EXTRACT-MIN(Q) for each v Î Adj[u] do if v Î Q and w(u, v) < key[v] then key[v] w(u, v) p[v] u Handshaking Lemma Þ Q(E) implicit DECREASE-KEY s. Time = Q(V) T EXTRACT -MIN + Q(E) T DECREASE -KEY November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.45

47 Analysis of Prim (continued) Time = Q(V) T EXTRACT -MIN + Q(E) T DECREASE -KEY November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.46

48 Analysis of Prim (continued) Time = Q(V) T EXTRACT -MIN + Q(E) T DECREASE -KEY Q T EXTRACT -MIN T DECREASE -KEY Total November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.47

49 Analysis of Prim (continued) Time = Q(V) T EXTRACT -MIN + Q(E) T DECREASE -KEY Q T EXTRACT -MIN T DECREASE -KEY Total array O(V) O(1) O(V 2 ) November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.48

50 Analysis of Prim (continued) Time = Q(V) T EXTRACT -MIN + Q(E) T DECREASE -KEY Q T EXTRACT -MIN T DECREASE -KEY Total array binary heap O(V) O(1) O(V 2 ) O(lg V) O(lg V) O(E lg V) November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.49

51 Analysis of Prim (continued) Time = Q(V) T EXTRACT -MIN + Q(E) T DECREASE -KEY Q T EXTRACT -MIN T DECREASE -KEY Total array binary heap Fibonacci heap O(V) O(1) O(V 2 ) O(lg V) O(lg V) amortized O(lg V) O(1) amortized O(E lgv) O(E + V lg V) worst case November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.50

52 MST algorithms Kruskal s algorithm (see CLRS): Uses the disjoint-set data structure (Lecture 10). Running time = O(E lgv). November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.51

53 MST algorithms Kruskal s algorithm (see CLRS): Uses the disjoint-set data structure (Lecture 10). Running time = O(E lgv). Best to date: Karger, Klein, and Tarjan [1993]. Randomized algorithm. O(V + E) expected time. November 9, 2005 Copyright by Erik D. Demaine and Charles E. Leiserson L16.52

Introduction to Algorithms

Introduction 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 information

Introduction to Algorithms

Introduction 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 information

Introduction to Algorithms

Introduction 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 information

Minimum Spanning Trees

Minimum 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 information

Minimum Spanning Trees My T. UF

Minimum 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 information

Greedy 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 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 information

Algorithm Design and Analysis

Algorithm 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 information

Minimum Spanning Trees

Minimum 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 information

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Computer 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 information

Week 11: Minimum Spanning trees

Week 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 information

Minimum Spanning Trees

Minimum 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 information

Minimum Spanning Trees Ch 23 Traversing graphs

Minimum 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 information

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees

Lecture 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 information

Minimum Spanning Trees

Minimum 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 information

Lecture Notes for Chapter 23: Minimum Spanning Trees

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 information

Introduction to Algorithms. Lecture 11

Introduction 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 information

2pt 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 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 information

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department CS473-Algorithms I Lecture 3-A Graphs Graphs A directed graph (or digraph) G is a pair (V, E), where V is a finite set, and E is a binary relation on V The set V: Vertex set of G The set E: Edge set of

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spanning Trees Minimum Spanning Trees Representation of Weighted Graphs Properties of Minimum Spanning Trees Prim's Algorithm Kruskal's Algorithm Philip Bille Minimum Spanning Trees Minimum Spanning

More information

CS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya

CS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya CS60020: Foundations of Algorithm Design and Machine Learning Sourangshu Bhattacharya Dynamic programming Design technique, like divide-and-conquer. Example: Longest Common Subsequence (LCS) Given two

More information

CS 561, Lecture 9. Jared Saia University of New Mexico

CS 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 information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spanning Trees 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 information

2 A Template for Minimum Spanning Tree Algorithms

2 A Template for Minimum Spanning Tree Algorithms CS, Lecture 5 Minimum Spanning Trees Scribe: Logan Short (05), William Chen (0), Mary Wootters (0) Date: May, 0 Introduction Today we will continue our discussion of greedy algorithms, specifically in

More information

Depth-first Search (DFS)

Depth-first Search (DFS) Depth-first Search (DFS) DFS Strategy: First follow one path all the way to its end, before we step back to follow the next path. (u.d and u.f are start/finish time for vertex processing) CH08-320201:

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

COP 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 information

Minimum Spanning Trees. Minimum Spanning Trees. Minimum Spanning Trees. Minimum Spanning Trees

Minimum Spanning Trees. Minimum Spanning Trees. Minimum Spanning Trees. Minimum Spanning Trees Properties of Properties of Philip Bille 0 0 Graph G Not connected 0 0 Connected and cyclic Connected and acyclic = spanning tree Total weight = + + + + + + = Applications Network design. Computer, road,

More information

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees CSE1 Introduction to Algorithms Lecture 1 Minimum Spanning Trees Antoine Vigneron antoine@unist.ac.kr Ulsan National Institute of Science and Technology July 11, 201 Antoine Vigneron (UNIST) CSE1 Lecture

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 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 information

Decreasing 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(,, ) 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 information

Unit 2: Algorithmic Graph Theory

Unit 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 information

1 Start with each vertex being its own component. 2 Merge two components into one by choosing the light edge

1 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 information

Chapter 23. Minimum Spanning Trees

Chapter 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 information

G205 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 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 information

Week 12: Minimum Spanning trees and Shortest Paths

Week 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 information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 7 Greedy Graph Algorithms Topological sort Shortest paths Adam Smith The (Algorithm) Design Process 1. Work out the answer for some examples. Look for a general principle

More information

Graph Definitions. In a directed graph the edges have directions (ordered pairs). A weighted graph includes a weight function.

Graph Definitions. In a directed graph the edges have directions (ordered pairs). A weighted graph includes a weight function. Graph Definitions Definition 1. (V,E) where An undirected graph G is a pair V is the set of vertices, E V 2 is the set of edges (unordered pairs) E = {(u, v) u, v V }. In a directed graph the edges have

More information

Minimum Spanning Trees and Prim s Algorithm

Minimum 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 information

CSE 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 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 information

Lecture 10: Analysis of Algorithms (CS ) 1

Lecture 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 information

Minimum Spanning Trees Outline: MST

Minimum Spanning Trees Outline: MST Minimm Spanning Trees Otline: MST Minimm Spanning Tree Generic MST Algorithm Krskal s Algorithm (Edge Based) Prim s Algorithm (Vertex Based) Spanning Tree A spanning tree of G is a sbgraph which is tree

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 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 information

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 8 Lecturer: David Wagner February 20, Notes 8 for CS 170

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 8 Lecturer: David Wagner February 20, Notes 8 for CS 170 UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 8 Lecturer: David Wagner February 20, 2003 Notes 8 for CS 170 1 Minimum Spanning Trees A tree is an undirected graph that is connected

More information

Partha Sarathi Manal

Partha Sarathi Manal MA 515: Introduction to Algorithms & MA5 : Design and Analysis of Algorithms [-0-0-6] Lecture 20 & 21 http://www.iitg.ernet.in/psm/indexing_ma5/y09/index.html Partha Sarathi Manal psm@iitg.ernet.in Dept.

More information

Shortest path problems

Shortest 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 information

Representations of Weighted Graphs (as Matrices) Algorithms and Data Structures: Minimum Spanning Trees. Weighted Graphs

Representations of Weighted Graphs (as Matrices) Algorithms and Data Structures: Minimum Spanning Trees. Weighted Graphs Representations of Weighted Graphs (as Matrices) A B Algorithms and Data Structures: Minimum Spanning Trees 9.0 F 1.0 6.0 5.0 6.0 G 5.0 I H 3.0 1.0 C 5.0 E 1.0 D 28th Oct, 1st & 4th Nov, 2011 ADS: lects

More information

COS 226 Lecture 19: Minimal Spanning Trees (MSTs) PFS BFS and DFS examples. Classic algorithms for solving a natural problem

COS 226 Lecture 19: Minimal Spanning Trees (MSTs) PFS BFS and DFS examples. Classic algorithms for solving a natural problem COS Lecture 9: Minimal Spanning Trees (MSTs) PFS BFS and DFS examples Classic algorithms for solving a natural problem MINIMAL SPANNING TREE Kruskal s algorithm Prim s algorithm Boruvka s algorithm Long

More information

Context: Weighted, connected, undirected graph, G = (V, E), with w : E R.

Context: Weighted, connected, undirected graph, G = (V, E), with w : E R. Chapter 23: Minimal Spanning Trees. Context: Weighted, connected, undirected graph, G = (V, E), with w : E R. Definition: A selection of edges from T E such that (V, T ) is a tree is called a spanning

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 5 Exploring graphs Adam Smith 9/5/2008 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Puzzles Suppose an undirected graph G is connected.

More information

CHAPTER 23. Minimum Spanning Trees

CHAPTER 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 information

Randomized Graph Algorithms

Randomized Graph Algorithms Randomized Graph Algorithms Vasileios-Orestis Papadigenopoulos School of Electrical and Computer Engineering - NTUA papadigenopoulos orestis@yahoocom July 22, 2014 Vasileios-Orestis Papadigenopoulos (NTUA)

More information

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree Algorithms and Theory of Computation Lecture 5: Minimum Spanning Tree Xiaohui Bei MAS 714 August 31, 2017 Nanyang Technological University MAS 714 August 31, 2017 1 / 30 Minimum Spanning Trees (MST) A

More information

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

Minimum-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 information

Minimum spanning trees

Minimum 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 information

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree Algorithms and Theory of Computation Lecture 5: Minimum Spanning Tree Xiaohui Bei MAS 714 August 31, 2017 Nanyang Technological University MAS 714 August 31, 2017 1 / 30 Minimum Spanning Trees (MST) A

More information

Announcements Problem Set 5 is out (today)!

Announcements 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 information

Analysis of Algorithms, I

Analysis 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 information

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved. Chapter 9 Greedy Technique Copyright 2007 Pearson Addison-Wesley. All rights reserved. Greedy Technique Constructs a solution to an optimization problem piece by piece through a sequence of choices that

More information

CSC 1700 Analysis of Algorithms: Minimum Spanning Tree

CSC 1700 Analysis of Algorithms: Minimum Spanning Tree CSC 1700 Analysis of Algorithms: Minimum Spanning Tree Professor Henry Carter Fall 2016 Recap Space-time tradeoffs allow for faster algorithms at the cost of space complexity overhead Dynamic programming

More information

Algorithms and Data Structures: Minimum Spanning Trees I and II - Prim s Algorithm. ADS: lects 14 & 15 slide 1

Algorithms and Data Structures: Minimum Spanning Trees I and II - Prim s Algorithm. ADS: lects 14 & 15 slide 1 Algorithms and Data Structures: Minimum Spanning Trees I and II - Prim s Algorithm ADS: lects 14 & 15 slide 1 Weighted Graphs Definition 1 A weighted (directed or undirected graph) is a pair (G, W ) consisting

More information

Algorithms. Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES

Algorithms. Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES Announcements Algorithms ROBERT SEDGEWICK KEVIN WAYNE Exam Regrades Due by Wednesday s lecture. Teaching Experiment: Dynamic Deadlines (WordNet) Right now, WordNet is due at PM on April 8th. Starting Tuesday

More information

Graphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs

Graphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs Graphs and Network Flows ISE 411 Lecture 7 Dr. Ted Ralphs ISE 411 Lecture 7 1 References for Today s Lecture Required reading Chapter 20 References AMO Chapter 13 CLRS Chapter 23 ISE 411 Lecture 7 2 Minimum

More information

CSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms

CSC 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 information

Greedy Algorithms CSE 6331

Greedy Algorithms CSE 6331 Greedy Algorithms CSE 6331 Reading: Sections 16.1, 16.2, 16.3, Chapter 23. 1 Introduction Optimization Problem: Construct a sequence or a set of elements {x 1,..., x k } that satisfies given constraints

More information

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 20. Example. Shortest Paths Definitions

Taking 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 information

Introduction: (Edge-)Weighted Graph

Introduction: (Edge-)Weighted Graph Introduction: (Edge-)Weighted Graph c 8 7 a b 7 i d 9 e 8 h 6 f 0 g These are computers and costs of direct connections. What is a cheapest way to network them? / 8 (Edge-)Weighted Graph Many useful graphs

More information

CS 4407 Algorithms Lecture 5: Graphs an Introduction

CS 4407 Algorithms Lecture 5: Graphs an Introduction CS 4407 Algorithms Lecture 5: Graphs an Introduction Prof. Gregory Provan Department of Computer Science University College Cork 1 Outline Motivation Importance of graphs for algorithm design applications

More information

Graph Algorithms Using Depth First Search

Graph Algorithms Using Depth First Search Graph Algorithms Using Depth First Search Analysis of Algorithms Week 8, Lecture 1 Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Graph Algorithms Using Depth

More information

Shortest Path Algorithms

Shortest 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 information

Algorithms for Minimum Spanning Trees

Algorithms for Minimum Spanning Trees Algorithms & Models of Computation CS/ECE, Fall Algorithms for Minimum Spanning Trees Lecture Thursday, November, Part I Algorithms for Minimum Spanning Tree Sariel Har-Peled (UIUC) CS Fall / 6 Sariel

More information

CIS 121 Data Structures and Algorithms Minimum Spanning Trees

CIS 121 Data Structures and Algorithms Minimum Spanning Trees CIS 121 Data Structures and Algorithms Minimum Spanning Trees March 19, 2019 Introduction and Background Consider a very natural problem: we are given a set of locations V = {v 1, v 2,..., v n }. We want

More information

23.2 Minimum Spanning Trees

23.2 Minimum Spanning Trees 23.2 Minimum Spanning Trees Kruskal s algorithm: Kruskal s algorithm solves the Minimum Spanning Tree problem in O( E log V ) time. It employs the disjoint-set data structure that is similarly used for

More information

Undirected Graphs. DSA - lecture 6 - T.U.Cluj-Napoca - M. Joldos 1

Undirected Graphs. DSA - lecture 6 - T.U.Cluj-Napoca - M. Joldos 1 Undirected Graphs Terminology. Free Trees. Representations. Minimum Spanning Trees (algorithms: Prim, Kruskal). Graph Traversals (dfs, bfs). Articulation points & Biconnected Components. Graph Matching

More information

CSC 8301 Design & Analysis of Algorithms: Warshall s, Floyd s, and Prim s algorithms

CSC 8301 Design & Analysis of Algorithms: Warshall s, Floyd s, and Prim s algorithms CSC 8301 Design & Analysis of Algorithms: Warshall s, Floyd s, and Prim s algorithms Professor Henry Carter Fall 2016 Recap Space-time tradeoffs allow for faster algorithms at the cost of space complexity

More information

Outline. Computer Science 331. Analysis of Prim's Algorithm

Outline. Computer Science 331. Analysis of Prim's Algorithm Outline Computer Science 331 Analysis of Prim's Algorithm Mike Jacobson Department of Computer Science University of Calgary Lecture #34 1 Introduction 2, Concluded 3 4 Additional Comments and References

More information

CS 5321: Advanced Algorithms Minimum Spanning Trees. Acknowledgement. Minimum Spanning Trees

CS 5321: Advanced Algorithms Minimum Spanning Trees. Acknowledgement. Minimum Spanning Trees CS : Advanced Algorithms Minimum Spanning Trees Ali Ebnenasir Department of Computer Science Michigan Technological University Acknowledgement Eric Torng Moon Jung Chung Charles Ofria Minimum Spanning

More information

Part 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 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 information

Graphs. Graph G = (V, E) Types of graphs E = O( V 2 ) V = set of vertices E = set of edges (V V)

Graphs. Graph G = (V, E) Types of graphs E = O( V 2 ) V = set of vertices E = set of edges (V V) Graph Algorithms Graphs Graph G = (V, E) V = set of vertices E = set of edges (V V) Types of graphs Undirected: edge (u, v) = (v, u); for all v, (v, v) E (No self loops.) Directed: (u, v) is edge from

More information

We ve done. Introduction to the greedy method Activity selection problem How to prove that a greedy algorithm works Fractional Knapsack Huffman coding

We ve done. Introduction to the greedy method Activity selection problem How to prove that a greedy algorithm works Fractional Knapsack Huffman coding We ve done Introduction to the greedy method Activity selection problem How to prove that a greedy algorithm works Fractional Knapsack Huffman coding Matroid Theory Now Matroids and weighted matroids Generic

More information

CSE 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 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 information

5.4 Shortest Paths. Jacobs University Visualization and Computer Graphics Lab. CH : Algorithms and Data Structures 456

5.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 information

Data Structures and Algorithms. Werner Nutt

Data Structures and Algorithms. Werner Nutt Data Structures and Algorithms Werner Nutt nutt@inf.unibz.it http://www.inf.unibz/it/~nutt Chapter 10 Academic Year 2012-2013 1 Acknowledgements & Copyright Notice These slides are built on top of slides

More information

Algorithm Analysis Graph algorithm. Chung-Ang University, Jaesung Lee

Algorithm Analysis Graph algorithm. Chung-Ang University, Jaesung Lee Algorithm Analysis Graph algorithm Chung-Ang University, Jaesung Lee Basic definitions Graph = (, ) where is a set of vertices and is a set of edges Directed graph = where consists of ordered pairs

More information

Minimum Spanning Tree (undirected graph)

Minimum Spanning Tree (undirected graph) 1 Minimum Spanning Tree (undirected graph) 2 Path tree vs. spanning tree We have constructed trees in graphs for shortest path to anywhere else (from vertex is the root) Minimum spanning trees instead

More information

COMP251: Single source shortest paths

COMP251: 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 information

2.1 Greedy Algorithms. 2.2 Minimum Spanning Trees. CS125 Lecture 2 Fall 2016

2.1 Greedy Algorithms. 2.2 Minimum Spanning Trees. CS125 Lecture 2 Fall 2016 CS125 Lecture 2 Fall 2016 2.1 Greedy Algorithms We will start talking about methods high-level plans for constructing algorithms. One of the simplest is just to have your algorithm be greedy. Being greedy,

More information

CS583 Lecture 09. Jana Kosecka. Graph Algorithms Topological Sort Strongly Connected Component Minimum Spanning Tree

CS583 Lecture 09. Jana Kosecka. Graph Algorithms Topological Sort Strongly Connected Component Minimum Spanning Tree CS3 Lecture 0 Jana Kosecka Graph Algorithms Topological Sort Strongly Connected Component Minimum Spanning Tree Many slides here are based on E. Demaine, D. Luebke, Kleinberg-Tardos slides Graph Algs.

More information

CS 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 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 information

Minimum Spanning Trees COSC 594: Graph Algorithms Spring By Kevin Chiang and Parker Tooley

Minimum Spanning Trees COSC 594: Graph Algorithms Spring By Kevin Chiang and Parker Tooley Minimum Spanning Trees COSC 594: Graph Algorithms Spring 2017 By Kevin Chiang and Parker Tooley Test Questions 1. What is one NP-Hard problem for which Minimum Spanning Trees is a good approximation for?

More information

6.1 Minimum Spanning Trees

6.1 Minimum Spanning Trees CS124 Lecture 6 Fall 2018 6.1 Minimum Spanning Trees A tree is an undirected graph which is connected and acyclic. It is easy to show that if graph G(V,E) that satisfies any two of the following properties

More information

CS161 - Minimum Spanning Trees and Single Source Shortest Paths

CS161 - 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 information

Graph Representation

Graph Representation Graph Representation Adjacency list representation of G = (V, E) An array of V lists, one for each vertex in V Each list Adj[u] contains all the vertices v such that there is an edge between u and v Adj[u]

More information

CSE 100 Minimum Spanning Trees Prim s and Kruskal

CSE 100 Minimum Spanning Trees Prim s and Kruskal CSE 100 Minimum Spanning Trees Prim s and Kruskal Your Turn The array of vertices, which include dist, prev, and done fields (initialize dist to INFINITY and done to false ): V0: dist= prev= done= adj:

More information

CS420/520 Algorithm Analysis Spring 2009 Lecture 14

CS420/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 information

CSci 231 Final Review

CSci 231 Final Review CSci 231 Final Review Here is a list of topics for the final. Generally you are responsible for anything discussed in class (except topics that appear italicized), and anything appearing on the homeworks.

More information

Dijkstra s Shortest Path Algorithm

Dijkstra 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 information

Jana Kosecka. Red-Black Trees Graph Algorithms. Many slides here are based on E. Demaine, D. Luebke slides

Jana Kosecka. Red-Black Trees Graph Algorithms. Many slides here are based on E. Demaine, D. Luebke slides Jana Kosecka Red-Black Trees Graph Algorithms Many slides here are based on E. Demaine, D. Luebke slides Binary Search Trees (BSTs) are an important data structure for dynamic sets In addition to satellite

More information

The minimum spanning tree problem

The minimum spanning tree problem The minimum spanning tree problem MST is a minimum cost connection problem on graphs The graph can model the connection in a (hydraulic, electric, telecommunication) network: the nodes are the points that

More information

managing an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm

managing an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm Spanning Trees 1 Spanning Trees the minimum spanning tree problem three greedy algorithms analysis of the algorithms 2 The Union-Find Data Structure managing an evolving set of connected components implementing

More information

1 Minimum Spanning Trees: History

1 Minimum Spanning Trees: History -80: Advanced Algorithms CMU, Spring 07 Lecture #: Deterministic MSTs January, 07 Lecturer: Anupam Gupta Scribe: Anshu Bansal, C.J. Argue Minimum Spanning Trees: History The minimum spanning tree problem

More information

Lecture 5: Graph algorithms 1

Lecture 5: Graph algorithms 1 DD2458, Problem Solving and Programming Under Pressure Lecture 5: Graph algorithms 1 Date: 2008-10-01 Scribe(s): Mikael Auno and Magnus Andermo Lecturer: Douglas Wikström This lecture presents some common

More information