Design and Analysis of Algorithms

Size: px
Start display at page:

Download "Design and Analysis of Algorithms"

Transcription

1 Design and Analysis of Algorithms CSE 5311 Lecture 22 All-Pairs Shortest Paths Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1

2 All Pairs Shortest Paths (APSP) given : directed graph G = ( V, E ), weight function ω : E R, V = n goal : create an n n matrix D = ( d ij ) of shortest path distances i.e., d ij = δ ( v i, v j ) trivial solution : run a SSSP algorithm n times, one for each vertex as the source. CSE5311 Design and Analysis of Algorithms 2

3 All Pairs Shortest Paths (APSP) all edge weights are nonnegative : use Dijkstra s algorithm PQ = linear array : O ( V 3 + VE ) = O ( V 3 ) PQ = binary heap : O ( V 2 lgv + EVlgV ) = O ( V 3 lgv ) for dense graphs better only for sparse graphs PQ = fibonacci heap : O ( V 2 lgv + EV ) = O ( V 3 ) for dense graphs better only for sparse graphs negative edge weights : use Bellman-Ford algorithm O ( V 2 E ) = O ( V 4 ) on dense graphs CSE5311 Design and Analysis of Algorithms 3

4 Adjacency Matrix Representation of Graphs n x n matrix W = (ω ij ) of edge weights : ω( v i, v j ) if ( v i, v j ) E ω ij = if ( v i, v j ) E assume ω ii = 0 for all v i V, because no neg-weight cycle shortest path to itself has no edge, i.e., δ ( v i,v i ) = 0 CSE5311 Design and Analysis of Algorithms 4

5 Dynamic Programming (1) Characterize the structure of an optimal solution. (2) Recursively define the value of an optimal solution. (3) Compute the value of an optimal solution in a bottom-up manner. (4) Construct an optimal solution from information constructed in (3). CSE5311 Design and Analysis of Algorithms 5

6 Shortest Paths and Matrix Multiplication Assumption : negative edge weights may be present, but no negative weight cycles. (1) Structure of a Shortest Path : Consider a shortest path p ij m from vi to v j such that p ij m m i.e., path p ij m has at most m edges. no negative-weight cycle all shortest paths are simple m is finite m n 1 i = j p ii = 0 & ω(p ii ) = 0 i j decompose path p ij m into pik m-1 & vk v j, where p ik m-1 m - 1 p ik m-1 should be a shortest path from vi to v k by optimal substructure property. Therefore, δ (v i,v j ) = δ (v i,v k ) + ω k j CSE5311 Design and Analysis of Algorithms 6

7 Shortest Paths and Matrix Multiplication (2) A Recursive Solution to All Pairs Shortest Paths Problem : d ij m = minimum weight of any path from v i to v j that contains at most m edges. m = 0 : There exist a shortest path from v i to v j with no edges i = j. 0 if i = j d ij 0 = if i j m 1 : d ij m = min { d ij m-1, min 1 k n Λ k j { d ik m-1 + ω kj }} = min 1 k n {d ik m-1 + ω kj } for all v k V, since ω j j = 0 for all v j V. CSE5311 Design and Analysis of Algorithms 7

8 Shortest Paths and Matrix Multiplication to consider all possible shortest paths with m edges from v i to v j consider shortest path with m -1 edges, from v i to v k, where v k R v i and (v k,v j ) E v k s v i v j note : δ (v i,v j ) = d ij n-1 = d ij n = d ij n+1, since m n -1 = V - 1 CSE5311 Design and Analysis of Algorithms 8

9 Shortest Paths and Matrix Multiplication (3) Computing the shortest-path weights bottom-up : given W = D 1, compute a series of matrices D 2, D 3,..., D n-1, where D m = ( d ij m ) for m = 1, 2,..., n-1 final matrix D n-1 contains actual shortest path weights, i.e., d ij n-1 = δ (v i,v j ) SLOW-APSP( W ) D 1 W for m 2 to n-1 do D m EXTEND( D m-1, W ) return D n-1 CSE5311 Design and Analysis of Algorithms 9

10 Shortest Paths and Matrix Multiplication EXTEND ( D, W ) D = ( d ij ) is an n x n matrix for i 1 to n do for j 1 to n do d ij for k 1 to n do d ij min{d ij, d ik + ω k j } return D MATRIX-MULT ( A, B ) C = ( c ij ) is an n x n result matrix for i 1 to n do for j 1 to n do c ij 0 for k 1 to n do c ij c ij + a ik x b k j return C CSE5311 Design and Analysis of Algorithms 10

11 Shortest Paths and Matrix Multiplication relation to matrix multiplication C = A B : c ij = 1 k n a ik x b k j, D m-1 A & W B & D m C min t & t x & 0 Thus, we compute the sequence of matrix products D 1 = D 0 x W = W ; note D 0 = identity matrix, 0 if i = j D 2 = D 1 x W = W 2 i.e., d 0 ij = D 3 = D 2 x W = W 3 if i j D n-1 = D n-2 x W = W n-1 running time : Θ( n 4 ) = Θ( V 4 ) each matrix product : Θ( n 3 ) number of matrix products : n-1 CSE5311 Design and Analysis of Algorithms 11

12 Shortest Paths and Matrix Multiplication Example CSE5311 Design and Analysis of Algorithms 12

13 Shortest Paths and Matrix Multiplication D 1 = D 0 W CSE5311 Design and Analysis of Algorithms 13

14 Shortest Paths and Matrix Multiplication D 2 = D 1 W CSE5311 Design and Analysis of Algorithms 14

15 Shortest Paths and Matrix Multiplication D 3 = D 2 W CSE5311 Design and Analysis of Algorithms 15

16 Shortest Paths and Matrix Multiplication D 4 = D 3 W CSE5311 Design and Analysis of Algorithms 16

17 SSSP and Matrix-Vector Multiplication relation of APSP to one step of matrix multiplication c j c j r i d m ij = k r i k D m C D m-1 A W B CSE5311 Design and Analysis of Algorithms 17

18 SSSP and Matrix-Vector Multiplication d ij n-1 at row r i and column c j of product matrix = δ ( v i =s, v j ) for j = 1, 2, 3,..., n row r i of the product matrix = solution to singlesource shortest path problem for s = v i. r i of C = matrix B multiplied by r i of A D i m = D i m-1 x W CSE5311 Design and Analysis of Algorithms 18

19 SSSP and Matrix-Vector Multiplication 0 if i = j let D 0 i = d 0, where d 0 j = otherwise we compute a sequence of n-1 matrix-vector products d 1 i = d 0 i x W d 2 i = d 1 i x W d 3 i = d 2 i x W : d n-1 i = d n-2 i x W CSE5311 Design and Analysis of Algorithms 19

20 SSSP and Matrix-Vector Multiplication this sequence of matrix-vector products same as Bellman-Ford algorithm. vector d i m d values of Bellman-Ford algorithm after m-th relaxation pass. d i m d i m-1 x W m-th relaxation pass over all edges. CSE5311 Design and Analysis of Algorithms 20

21 SSSP and Matrix-Vector Multiplication BELLMAN-FORD ( G, v i ) perform RELAX ( u, v ) for every edge ( u, v ) E for j 1 to n do for k 1 to n do RELAX ( v k, v j ) EXTEND ( d i, W ) d i is an n-vector for j 1 to n do d j for k 1 to n do d j min { d j, d k + ω kj } RELAX ( u, v ) d v = min { d v, d u + ω uv } CSE5311 Design and Analysis of Algorithms 21

22 Improving Running Time Through Repeated Squaring idea : goal is not to compute all D m matrices we are interested only in matrix D n-1 recall : no negative-weight cycles D m = D n-1 for all m n-1 we can compute D n-1 with only lg(n-1) matrix products as D 1 = W D 2 = W 2 = W x W D 4 = W 4 = W 2 x W 2 D 8 = W 8 = W 4 x W 4 D 2 lg(n-1) 2 W lg( n-1) lg( -1) 2 lg( -1) 2 W n -1 W n -1 = = This technique is called repeated squaring. CSE5311 Design and Analysis of Algorithms 22

23 Improving Running Time Through Repeated Squaring FASTER-APSP ( W ) D 1 W m 1 while m < n-1 do D 2m EXTEND ( D m, D m ) m 2m return D m final iteration computes D 2m for some n-1 2m 2n-2 D 2m = D n-1 running time : Θ( n 3 lgn ) = Θ( V 3 lgv ) each matrix product : Θ( n 3 ) # of matrix products : lg( n-1 ) simple code, no complex data structures, small hidden constants in Θ-notation. CSE5311 Design and Analysis of Algorithms 23

24 Idea Behind Repeated Squaring decompose p ij 2m as p ik m & p kj m, where p ij 2m : v i p ik m : v i p kj m : v k v j v k v j v k s v i v j CSE5311 Design and Analysis of Algorithms 24

25 Floyd-Warshall Algorithm assumption : negative-weight edges, but no negative-weight cycles (1) The Structure of a Shortest Path : Definition : intermediate vertex of a path p = < v 1, v 2, v 3,..., v k > any vertex of p other than v 1 or v k. p ij m : a shortest path from vi to v j with all intermediate vertices from V m = { v 1, v 2,..., v m } relationship between p ij m and pij m-1 depends on whether v m is an intermediate vertex of p ij m - case 1: v m is not an intermediate vertex of p ij m all intermediate vertices of p ij m are in Vm -1 p ij m = p ij m-1 CSE5311 Design and Analysis of Algorithms 25

26 Floyd-Warshall Algorithm - case 2 : v m is an intermediate vertex of p ij m - decompose path as v i v m v j p 1 : v i v m & p 2 : v m v j - by opt. structure property both p 1 & p 2 are shortest paths. - v m is not an intermediate vertex of p 1 & p 2 m-1 m-1 p 1 = p im & p 2 = p mj p 1 v m p 2 V m v i v j CSE5311 Design and Analysis of Algorithms 26

27 Floyd-Warshall Algorithm (2) A Recursive Solution to APSP Problem : d ij m = ω(p ij ) : weight of a shortest path from v i to v j with all intermediate vertices from V m = { v 1, v 2,..., v m }. note : d ij n = δ (v i,v j ) since V n = V i.e., all vertices are considered for being intermediate vertices of p ij n. CSE5311 Design and Analysis of Algorithms 27

28 Floyd-Warshall Algorithm compute d m ij in terms of d k ij with smaller k < m m = 0 : V 0 = empty set path from v i to v j with no intermediate vertex. i.e., v i to v j paths with at most one edge d 0 ij = ω i j m 1 : d m ij = min {d m-1 ij, d m-1 im + d m-1 mj } CSE5311 Design and Analysis of Algorithms 28

29 Floyd-Warshall Algorithm (3) Computing Shortest Path Weights Bottom Up : FLOYD-WARSHALL( W ) D 0, D 1,..., D n are n x n matrices for m 1 to n do for i 1 to n do for j 1 to n do d ij m min {d ij m-1, d im m-1 + d mj m-1 } return D n CSE5311 Design and Analysis of Algorithms 29

30 Floyd-Warshall Algorithm FLOYD-WARSHALL ( W ) D is an n x n matrix D W for m 1 to n do for i 1 to n do for j 1 to n do if d ij > d im + d mj then return D d ij d im + d mj CSE5311 Design and Analysis of Algorithms 30

31 Floyd-Warshall Algorithm maintaining n D matrices can be avoided by dropping all superscripts. m-th iteration of outermost for-loop begins with D = D m-1 ends with D = D m computation of d ij m depends on d im m-1 and d mj m-1. no problem if d im & d mj are already updated to d im m & d mj m since d im m = d im m-1 & d mj m = d mj m-1. running time : Θ( n 3 ) = Θ( V 3 ) simple code, no complex data structures, small hidden constants CSE5311 Design and Analysis of Algorithms 31

32 Transitive Closure of a Directed Graph G ' = ( V, E ' ) : transitive closure of G = ( V, E ), where E ' = { (v i, v j ): there exists a path from v i to v j in G } trivial solution : assign W such that 1 if (v i, v j ) E ω ij = otherwise run Floyd-Warshall algorithm on W d ij n < n there exists a path from v i to v j, i.e., (v i, v j ) E ' d ij n = no path from v i to v i, i.e., (v i, v j ) E ' running time : Θ( n 3 ) = Θ( V 3 ) CSE5311 Design and Analysis of Algorithms 32

33 Transitive Closure of a Directed Graph Better Θ( V 3 ) algorithm : saves time and space. 1 if i = j or (v i, v j ) E W = adjacency matrix : ω ij = 0 otherwise run Floyd-Warshall algorithm by replacing min & + define t ij m = 1 if a path from v i to v j with all intermediate vertices from V m 0 otherwise t ij n = 1 (v i, v j ) E ' & t ij n = 0 (v i, v j ) E ' recursive definition for t ij m = t ij m-1 (t im m-1 t mj m-1 ) with t ij 0 = ω ij CSE5311 Design and Analysis of Algorithms 33

34 Transitive Closure of a Directed Graph T-CLOSURE (G ) T = ( t ij ) is an n x n boolean matrix for i 1 to n do for j 1 to n do if i = j or ( v i, v j ) E then t ij 1 else t ij 0 for m 1 to n do for i 1 to n do for j 1 to n do t ij t ij ( t im t mj ) CSE5311 Design and Analysis of Algorithms 34

35 Johnson s Algorithm for Sparse Graphs (1) Preserving shortest paths by edge reweighting : L1 : given G = ( V, E ) with ω : E R let h : V R be any weighting function on the vertex set define ω( ω, h ) : E R as ω( u, v ) = ω( u, v ) + h (u) h (v) let p 0k = < v 0, v 1,..., v k > be a path from v 0 to v k (a) ω( p 0k ) = ω( p 0k ) + h (v 0 ) - h (v k ) (b) ω( p 0k ) = δ(v 0, v k ) in ( G, ω ) ω( p 0k ) = δ(v 0, v k ) in ( G, ω ) (c) ( G, ω ) has a neg-wgt cycle ( G, ω ) has a neg-wgt cycle CSE5311 Design and Analysis of Algorithms 35

36 Johnson s Algorithm for Sparse Graphs (2) Producing nonnegative edge weights by reweighting : given (G, ω) with G = ( V, E ) and ω : E R construct a new graph ( G ', ω ' ) with G ' = ( V ', E ' ) and ω ' = E ' R V ' = V U { s } for some new vertex s V E ' = E U { ( s,v ) : v V } ω ' (u,v) = ω(u,v) (u,v) E and ω ' (s,v) = 0, v V vertex s has no incoming edges s R v for any v in V no shortest paths from u s to v in G ' contains vertex s ( G ', ω ' ) has no neg-wgt cycle (G, ω) has no neg-wgt cycle CSE5311 Design and Analysis of Algorithms 36

37 Johnson s Algorithm for Sparse Graphs suppose that G and G ' have no neg-wgt cycle L2 : if we define h (v) = δ (s,v ) v V in G ' and ω according to L1. we will have ω(u,v) = ω(u,v) + h(u) h(v) 0 v V proof : for every edge (u, v) E δ (s,v ) δ (s, u) + ω(u, v) in G ' due to triangle inequality h (v) h (u) + ω(u, v) 0 ω(u, v) + h(u) h(v) = ω(u, v) CSE5311 Design and Analysis of Algorithms 37

38 Johnson s Algorithm for Sparse Graphs Computing All-Pairs Shortest Paths adjacency list representation of G. returns n x n matrix D = ( d ij ) where d ij = δ ij, or reports the existence of a neg-wgt cycle. CSE5311 Design and Analysis of Algorithms 38

39 Johnson s Algorithm for Sparse Graphs JOHNSON(G,ω) D=(d ij ) is an nxn matrix construct ( G ' = (V ', E ' ), ω ' ) s.t. V ' = V U {s}; E ' = E U { (s,v) : v V } ω ' (u,v) = ω(u,v), (u,v) E & ω ' (s,v) = 0 v V if BELLMAN-FORD(G ', ω ', s) = FALSE then return negative-weight cycle else for each vertex v V ' - {s} = V do h[v] d ' [v] d ' [v] = δ ' (s,v) computed by BELLMAN-FORD(G ', ω ', s) for each edge (u,v) E do ω(u,v) ω(u,v) + h[u] h[v] edge reweighting for each vertex u V do run DIJKSTRA(G, ω, u) to compute d[v] = δ (u,v) for all v in V (G,ω) for each vertex v V do d uv = d[v] ( h[u] h[v] ) return D CSE5311 Design and Analysis of Algorithms 39

40 Johnson s Algorithm for Sparse Graphs running time : O ( V 2 lgv + EV ) edge reweighting BELLMAN-FORD(G ', ω ', s) : O ( EV ) computing ω values : O (E ) V runs of DIJKSTRA : V x O ( VlgV + EV ) = O ( V 2 lgv + EV ); PQ = fibonacci heap CSE5311 Design and Analysis of Algorithms 40

Lecture Notes for Chapter 25: All-Pairs Shortest Paths

Lecture Notes for Chapter 25: All-Pairs Shortest Paths Lecture Notes for Chapter 25: All-Pairs Shortest Paths Chapter 25 overview 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

More information

CMPS 6610 Fall 2018 Shortest Paths Carola Wenk

CMPS 6610 Fall 2018 Shortest Paths Carola Wenk CMPS 6610 Fall 018 Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk Paths in graphs Consider a digraph G = (V, E) with an edge-weight function w

More information

Lecture 11. Single-Source Shortest Paths All-Pairs Shortest Paths

Lecture 11. Single-Source Shortest Paths All-Pairs Shortest Paths Lecture. Single-Source Shortest Paths All-Pairs Shortest Paths T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to, rd Edition, MIT Press, 009 Sungkyunkwan University Hyunseung Choo choo@skku.edu

More information

Single Source Shortest Paths

Single Source Shortest Paths CMPS 00 Fall 017 Single Source Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk Paths in graphs Consider a digraph G = (V, E) with an edge-weight

More information

Analysis of Algorithms I: All-Pairs Shortest Paths

Analysis of Algorithms I: All-Pairs Shortest Paths Analysis of Algorithms I: All-Pairs Shortest Paths Xi Chen Columbia University The All-Pairs Shortest Paths Problem. Input: A directed weighted graph G = (V, E) with an edge-weight function w : E R. Output:

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms CSE 5311 Lecture 21 Single-Source Shortest Paths Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 Single-Source

More information

Shortest Paths. CS 320, Fall Dr. Geri Georg, Instructor 320 ShortestPaths 3

Shortest Paths. CS 320, Fall Dr. Geri Georg, Instructor 320 ShortestPaths 3 Shortest Paths CS 320, Fall 2017 Dr. Geri Georg, Instructor georg@colostate.edu 320 ShortestPaths 3 Preliminaries Weighted, directed graphs Weight function: maps edges to real numbers Shortest path weight:

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms, Lecture 5 // Introduction to Algorithms 6.46J/.4J LECTURE Shortest Paths I Properties o shortest paths Dijkstra s Correctness Analysis Breadth-irst Pro. Manolis Kellis March,

More information

Partha Sarathi Mandal

Partha Sarathi Mandal MA 252: Data Structures and Algorithms Lecture 32 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 information

CSE 431/531: Analysis of Algorithms. Dynamic Programming. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo

CSE 431/531: Analysis of Algorithms. Dynamic Programming. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo CSE 431/531: Analysis of Algorithms Dynamic Programming Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Paradigms for Designing Algorithms Greedy algorithm Make a

More information

All-Pairs Shortest Paths

All-Pairs Shortest Paths All-Pairs Shortest Paths Version of October 28, 2016 Version of October 28, 2016 All-Pairs Shortest Paths 1 / 26 Outline Another example of dynamic programming Will see two different dynamic programming

More information

Slides credited from Hsueh-I Lu & Hsu-Chun Hsiao

Slides credited from Hsueh-I Lu & Hsu-Chun Hsiao Slides credited from Hsueh-I Lu & Hsu-Chun Hsiao Homework 3 released Due on 12/13 (Thur) 14:20 (one week only) Mini-HW 9 released Due on 12/13 (Thur) 14:20 Homework 4 released Due on 1/3 (Thur) 14:20 (four

More information

Analysis of Algorithms. Outline. Single Source Shortest Path. Andres Mendez-Vazquez. November 9, Notes. Notes

Analysis of Algorithms. Outline. Single Source Shortest Path. Andres Mendez-Vazquez. November 9, Notes. Notes Analysis of Algorithms Single Source Shortest Path Andres Mendez-Vazquez November 9, 01 1 / 108 Outline 1 Introduction Introduction and Similar Problems General Results Optimal Substructure Properties

More information

CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms

CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms Professor Henry Carter Fall 2016 Recap Space-time tradeoffs allow for faster algorithms at the cost of space complexity overhead Dynamic

More information

Single Source Shortest Paths

Single Source Shortest Paths CMPS 00 Fall 015 Single Source Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk 1 Paths in graphs Consider a digraph G = (V, E) with an edge-weight

More information

Shortest Path Algorithms

Shortest Path Algorithms Shortest Path Algorithms Andreas Klappenecker [based on slides by Prof. Welch] 1 Single Source Shortest Path 2 Single Source Shortest Path Given: a directed or undirected graph G = (V,E) a source node

More information

A faster algorithm for the single source shortest path problem with few distinct positive lengths

A faster algorithm for the single source shortest path problem with few distinct positive lengths A faster algorithm for the single source shortest path problem with few distinct positive lengths J. B. Orlin, K. Madduri, K. Subramani, and M. Williamson Journal of Discrete Algorithms 8 (2010) 189 198.

More information

Lecture 7: Shortest Paths in Graphs with Negative Arc Lengths. Reading: AM&O Chapter 5

Lecture 7: Shortest Paths in Graphs with Negative Arc Lengths. Reading: AM&O Chapter 5 Lecture 7: Shortest Paths in Graphs with Negative Arc Lengths Reading: AM&O Chapter Label Correcting Methods Assume the network G is allowed to have negative arc lengths but no directed negativelyweighted

More information

Dynamic Programming: Shortest Paths and DFA to Reg Exps

Dynamic Programming: Shortest Paths and DFA to Reg Exps CS 374: Algorithms & Models of Computation, Fall 205 Dynamic Programming: Shortest Paths and DFA to Reg Exps Lecture 7 October 22, 205 Chandra & Manoj (UIUC) CS374 Fall 205 / 54 Part I Shortest Paths with

More information

Dynamic Programming: Shortest Paths and DFA to Reg Exps

Dynamic Programming: Shortest Paths and DFA to Reg Exps CS 374: Algorithms & Models of Computation, Spring 207 Dynamic Programming: Shortest Paths and DFA to Reg Exps Lecture 8 March 28, 207 Chandra Chekuri (UIUC) CS374 Spring 207 / 56 Part I Shortest Paths

More information

CS 4407 Algorithms Lecture: Shortest Path Algorithms

CS 4407 Algorithms Lecture: Shortest Path Algorithms CS 440 Algorithms Lecture: Shortest Path Algorithms Prof. Gregory Provan Department of Computer Science University College Cork 1 Outline Shortest Path Problem General Lemmas and Theorems. Algorithms Bellman-Ford

More information

Shortest paths with negative lengths

Shortest paths with negative lengths Chapter 8 Shortest paths with negative lengths In this chapter we give a linear-space, nearly linear-time algorithm that, given a directed planar graph G with real positive and negative lengths, but no

More information

CS 6301 PROGRAMMING AND DATA STRUCTURE II Dept of CSE/IT UNIT V GRAPHS

CS 6301 PROGRAMMING AND DATA STRUCTURE II Dept of CSE/IT UNIT V GRAPHS UNIT V GRAPHS Representation of Graphs Breadth-first search Depth-first search Topological sort Minimum Spanning Trees Kruskal and Prim algorithm Shortest path algorithm Dijkstra s algorithm Bellman-Ford

More information

Myriad of applications

Myriad of applications Shortet Path Myriad of application Finding hortet ditance between location (Google map, etc.) Internet router protocol: OSPF (Open Shortet Path Firt) i ued to find the hortet path to interchange package

More information

Data Structures and and Algorithm Xiaoqing Zheng

Data Structures and and Algorithm Xiaoqing Zheng Data Structures and Algorithm Xiaoqing Zheng zhengxq@fudan.edu.cn Representations of undirected graph 1 2 1 2 5 / 5 4 3 2 3 4 5 1 3 4 / 2 4 / 2 5 3 / 4 1 / Adjacency-list representation of graph G = (V,

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/8.40J/SMA550 Lecture 7 Prof. Erik Demaine Paths in graphs Consider a digraph G = (V, E) with edge-weight function w : E R. The weight of path p = v v L v k is defined

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401J LECTURE 14 Shortest Paths I Properties of shortest paths Dijkstra s algorithm Correctness Analysis Breadth-first search Prof. Charles E. Leiserson Paths in graphs

More information

CMPS 2200 Fall Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk. 10/8/12 CMPS 2200 Intro.

CMPS 2200 Fall Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk. 10/8/12 CMPS 2200 Intro. CMPS 00 Fall 01 Single Source Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk 1 Paths in graphs Consider a digraph G = (V, E) with edge-weight function

More information

Algorithms Booklet. 1 Graph Searching. 1.1 Breadth First Search

Algorithms Booklet. 1 Graph Searching. 1.1 Breadth First Search Algorithms Booklet 2010 Note: in all algorithms, unless stated otherwise, the input graph G is represented by adjacency lists. 1 Graph Searching 1.1 Breadth First Search Algorithm 1: BFS(G, s) Input: G

More information

Chapter 8 Dynamic Programming

Chapter 8 Dynamic Programming Chapter 8 Dynamic Programming Copyright 007 Pearson Addison-Wesley. All rights reserved. Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by

More information

Dijkstra s Single Source Shortest Path Algorithm. Andreas Klappenecker

Dijkstra s Single Source Shortest Path Algorithm. Andreas Klappenecker Dijkstra s Single Source Shortest Path Algorithm Andreas Klappenecker Single Source Shortest Path Given: a directed or undirected graph G = (V,E) a source node s in V a weight function w: E -> R. Goal:

More information

On the Exponent of the All Pairs Shortest Path Problem

On the Exponent of the All Pairs Shortest Path Problem On the Exponent of the All Pairs Shortest Path Problem Noga Alon Department of Mathematics Sackler Faculty of Exact Sciences Tel Aviv University Zvi Galil Department of Computer Science Sackler Faculty

More information

CS 241 Analysis of Algorithms

CS 241 Analysis of Algorithms CS 241 Analysis of Algorithms Professor Eric Aaron Lecture T Th 9:00am Lecture Meeting Location: OLB 205 Business Grading updates: HW5 back today HW7 due Dec. 10 Reading: Ch. 22.1-22.3, Ch. 25.1-2, Ch.

More information

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

CS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya CS6000: Foundations of Algorithm Design and Machine Learning Sourangshu Bhattacharya Paths in graphs Consider a digraph G = (V, E) with edge-weight function w : E R. The weight of path p = v 1 v L v k

More information

Chapter 8 Dynamic Programming

Chapter 8 Dynamic Programming Chapter 8 Dynamic Programming Copyright 2007 Pearson Addison-Wesley. All rights reserved. Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401J LECTURE 17 Shortest Paths I Properties of shortest paths Dijkstra s algorithm Correctness Analysis Breadth-first search Prof. Erik Demaine November 14, 005 Copyright

More information

Dynamic Programming. p. 1/43

Dynamic Programming. p. 1/43 Dynamic Programming Formalized by Richard Bellman Programming relates to planning/use of tables, rather than computer programming. Solve smaller problems first, record solutions in a table; use solutions

More information

Note that M i,j depends on two entries in row (i 1). If we proceed in a row major order, these two entries will be available when we are ready to comp

Note that M i,j depends on two entries in row (i 1). If we proceed in a row major order, these two entries will be available when we are ready to comp CSE 3500 Algorithms and Complexity Fall 2016 Lecture 18: October 27, 2016 Dynamic Programming Steps involved in a typical dynamic programming algorithm are: 1. Identify a function such that the solution

More information

Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths

Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths Matroids Shortest Paths Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths Marc Uetz University of Twente m.uetz@utwente.nl Lecture 2: sheet 1 / 25 Marc Uetz Discrete Optimization Matroids

More information

Inderjit Dhillon The University of Texas at Austin

Inderjit Dhillon The University of Texas at Austin Inderjit Dhillon The University of Texas at Austin ( Universidad Carlos III de Madrid; 15 th June, 2012) (Based on joint work with J. Brickell, S. Sra, J. Tropp) Introduction 2 / 29 Notion of distance

More information

Introduction to Algorithms

Introduction to Algorithms Introducton to Algorthms 6.046J/8.40J LECTURE 6 Shortest Paths III All-pars shortest paths Matrx-multplcaton algorthm Floyd-Warshall algorthm Johnson s algorthm Prof. Charles E. Leserson Shortest paths

More information

Introduction to Algorithms

Introduction to Algorithms Introducton to Algorthms 6.046J/8.40J/SMA5503 Lecture 9 Prof. Erk Demane Shortest paths Sngle-source shortest paths Nonnegate edge weghts Djkstra s algorthm: OE + V lg V General Bellman-Ford: OVE DAG One

More information

Section Summary. Sequences. Recurrence Relations. Summations Special Integer Sequences (optional)

Section Summary. Sequences. Recurrence Relations. Summations Special Integer Sequences (optional) Section 2.4 Section Summary Sequences. o Examples: Geometric Progression, Arithmetic Progression Recurrence Relations o Example: Fibonacci Sequence Summations Special Integer Sequences (optional) Sequences

More information

CS675: Convex and Combinatorial Optimization Fall 2016 Combinatorial Problems as Linear and Convex Programs. Instructor: Shaddin Dughmi

CS675: Convex and Combinatorial Optimization Fall 2016 Combinatorial Problems as Linear and Convex Programs. Instructor: Shaddin Dughmi CS675: Convex and Combinatorial Optimization Fall 2016 Combinatorial Problems as Linear and Convex Programs Instructor: Shaddin Dughmi Outline 1 Introduction 2 Shortest Path 3 Algorithms for Single-Source

More information

CS 253: Algorithms. Chapter 24. Shortest Paths. Credit: Dr. George Bebis

CS 253: Algorithms. Chapter 24. Shortest Paths. Credit: Dr. George Bebis CS : Algorithms Chapter 4 Shortest Paths Credit: Dr. George Bebis Shortest Path Problems How can we find the shortest route between two points on a road map? Model the problem as a graph problem: Road

More information

CS 470/570 Dynamic Programming. Format of Dynamic Programming algorithms:

CS 470/570 Dynamic Programming. Format of Dynamic Programming algorithms: CS 470/570 Dynamic Programming Format of Dynamic Programming algorithms: Use a recursive formula But recursion can be inefficient because it might repeat the same computations multiple times So use an

More information

Relations Graphical View

Relations Graphical View Introduction Relations Computer Science & Engineering 235: Discrete Mathematics Christopher M. Bourke cbourke@cse.unl.edu Recall that a relation between elements of two sets is a subset of their Cartesian

More information

2 Fundamentals. 2.1 Graph Theory. Ulrik Brandes and Thomas Erlebach

2 Fundamentals. 2.1 Graph Theory. Ulrik Brandes and Thomas Erlebach 2 Fundamentals Ulrik Brandes and Thomas Erlebach In this chapter we discuss basic terminology and notation for graphs, some fundamental algorithms, and a few other mathematical preliminaries. We denote

More information

The Divide-and-Conquer Design Paradigm

The Divide-and-Conquer Design Paradigm CS473- Algorithms I Lecture 4 The Divide-and-Conquer Design Paradigm CS473 Lecture 4 1 The Divide-and-Conquer Design Paradigm 1. Divide the problem (instance) into subproblems. 2. Conquer the subproblems

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401J/SMA5503 Lecture 18 Prof. Erik Demaine Negative-weight cycles Recall: If a graph G = (V, E) contains a negativeweight cycle, then some shortest paths may not exist.

More information

Shortest Paths in Directed Planar Graphs with Negative Lengths: a Linear-Space O(n log 2 n)-time Algorithm

Shortest Paths in Directed Planar Graphs with Negative Lengths: a Linear-Space O(n log 2 n)-time Algorithm Shortest Paths in Directed Planar Graphs with Negative Lengths: a Linear-Space O(n log 2 n)-time Algorithm Philip Klein 1, Shay Mozes 1 and Oren Weimann 2 1 Department of Computer Science, Brown University,

More information

Algorithms: Lecture 12. Chalmers University of Technology

Algorithms: Lecture 12. Chalmers University of Technology Algorithms: Lecture 1 Chalmers University of Technology Today s Topics Shortest Paths Network Flow Algorithms Shortest Path in a Graph Shortest Path Problem Shortest path network. Directed graph G = (V,

More information

Discrete Optimization Lecture 5. M. Pawan Kumar

Discrete Optimization Lecture 5. M. Pawan Kumar Discrete Optimization Lecture 5 M. Pawan Kumar pawan.kumar@ecp.fr Exam Question Type 1 v 1 s v 0 4 2 1 v 4 Q. Find the distance of the shortest path from s=v 0 to all vertices in the graph using Dijkstra

More information

Discrete Wiskunde II. Lecture 5: Shortest Paths & Spanning Trees

Discrete Wiskunde II. Lecture 5: Shortest Paths & Spanning Trees , 2009 Lecture 5: Shortest Paths & Spanning Trees University of Twente m.uetz@utwente.nl wwwhome.math.utwente.nl/~uetzm/dw/ Shortest Path Problem "#$%&'%()*%"()$#+,&- Given directed "#$%&'()*+,%+('-*.#/'01234564'.*,'7+"-%/8',&'5"4'84%#3

More information

Analytic Theory of Power Law Graphs

Analytic Theory of Power Law Graphs Analytic Theory of Power Law Graphs Jeremy Kepner This work is sponsored by the Department of Defense under Air Force Contract FA8721-05-C-0002. Opinions, interpretations, conclusions, and recommendations

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 03 Dynamic Programming (Chapter 15) Stephen Scott and Vinodchandran N. Variyam sscott@cse.unl.edu 1/44 Introduction Dynamic

More information

Generic ǫ-removal and Input ǫ-normalization Algorithms for Weighted Transducers

Generic ǫ-removal and Input ǫ-normalization Algorithms for Weighted Transducers International Journal of Foundations of Computer Science c World Scientific Publishing Company Generic ǫ-removal and Input ǫ-normalization Algorithms for Weighted Transducers Mehryar Mohri mohri@research.att.com

More information

Midterm Exam 2 Solutions

Midterm Exam 2 Solutions Algorithm Design and Analysis November 12, 2010 Pennsylvania State University CSE 565, Fall 2010 Professor Adam Smith Exam 2 Solutions Problem 1 (Miscellaneous). Midterm Exam 2 Solutions (a) Your friend

More information

CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs. Instructor: Shaddin Dughmi

CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs. Instructor: Shaddin Dughmi CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs Instructor: Shaddin Dughmi Outline 1 Introduction 2 Shortest Path 3 Algorithms for Single-Source Shortest

More information

Optimal Tree-decomposition Balancing and Reachability on Low Treewidth Graphs

Optimal Tree-decomposition Balancing and Reachability on Low Treewidth Graphs Optimal Tree-decomposition Balancing and Reachability on Low Treewidth Graphs Krishnendu Chatterjee Rasmus Ibsen-Jensen Andreas Pavlogiannis IST Austria Abstract. We consider graphs with n nodes together

More information

DSP Design Lecture 5. Dr. Fredrik Edman.

DSP Design Lecture 5. Dr. Fredrik Edman. SP esign SP esign Lecture 5 Retiming r. Fredrik Edman fredrik.edman@eit.lth.se Fredrik Edman, ept. of Electrical and Information Technology, Lund University, Sweden-www.eit.lth.se SP esign Repetition Critical

More information

NAME: Be clear and concise. You may use the number of points assigned toeach problem as a rough

NAME: Be clear and concise. You may use the number of points assigned toeach problem as a rough CS170 Second Midterm 28 Oct 1999 NAME: TA: Be clear and concise. You may use the number of points assigned toeach problem as a rough estimate for the number of minutes you want to allocate to the problem.

More information

Introduction to Kleene Algebras

Introduction to Kleene Algebras Introduction to Kleene Algebras Riccardo Pucella Basic Notions Seminar December 1, 2005 Introduction to Kleene Algebras p.1 Idempotent Semirings An idempotent semiring is a structure S = (S, +,, 1, 0)

More information

Chapter 4 Divide-and-Conquer

Chapter 4 Divide-and-Conquer Chapter 4 Divide-and-Conquer 1 About this lecture (1) Recall the divide-and-conquer paradigm, which we used for merge sort: Divide the problem into a number of subproblems that are smaller instances of

More information

Complexity Theory of Polynomial-Time Problems

Complexity Theory of Polynomial-Time Problems Complexity Theory of Polynomial-Time Problems Lecture 5: Subcubic Equivalences Karl Bringmann Reminder: Relations = Reductions transfer hardness of one problem to another one by reductions problem P instance

More information

6. DYNAMIC PROGRAMMING II

6. DYNAMIC PROGRAMMING II 6. DYNAMIC PROGRAMMING II sequence alignment Hirschberg's algorithm Bellman-Ford algorithm distance vector protocols negative cycles in a digraph Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison

More information

Notes. Relations. Introduction. Notes. Relations. Notes. Definition. Example. Slides by Christopher M. Bourke Instructor: Berthe Y.

Notes. Relations. Introduction. Notes. Relations. Notes. Definition. Example. Slides by Christopher M. Bourke Instructor: Berthe Y. Relations Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Spring 2006 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 7.1, 7.3 7.5 of Rosen cse235@cse.unl.edu

More information

Activity selection. Goal: Select the largest possible set of nonoverlapping (mutually compatible) activities.

Activity selection. Goal: Select the largest possible set of nonoverlapping (mutually compatible) activities. Greedy Algorithm 1 Introduction Similar to dynamic programming. Used for optimization problems. Not always yield an optimal solution. Make choice for the one looks best right now. Make a locally optimal

More information

CMPSCI 611 Advanced Algorithms Midterm Exam Fall 2015

CMPSCI 611 Advanced Algorithms Midterm Exam Fall 2015 NAME: CMPSCI 611 Advanced Algorithms Midterm Exam Fall 015 A. McGregor 1 October 015 DIRECTIONS: Do not turn over the page until you are told to do so. This is a closed book exam. No communicating with

More information

Lecture 6 January 21, 2013

Lecture 6 January 21, 2013 UBC CPSC 536N: Sparse Approximations Winter 03 Prof. Nick Harvey Lecture 6 January, 03 Scribe: Zachary Drudi In the previous lecture, we discussed max flow problems. Today, we consider the Travelling Salesman

More information

Linear Algebra and Eigenproblems

Linear Algebra and Eigenproblems Appendix A A Linear Algebra and Eigenproblems A working knowledge of linear algebra is key to understanding many of the issues raised in this work. In particular, many of the discussions of the details

More information

A = , A 32 = n ( 1) i +j a i j det(a i j). (1) j=1

A = , A 32 = n ( 1) i +j a i j det(a i j). (1) j=1 Lecture Notes: Determinant of a Square Matrix Yufei Tao Department of Computer Science and Engineering Chinese University of Hong Kong taoyf@cse.cuhk.edu.hk 1 Determinant Definition Let A [a ij ] be an

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 s Lecture 09 Dynamic Programming (Chapter 15) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 41 Spring 2010 Dynamic programming

More information

CS 410/584, Algorithm Design & Analysis, Lecture Notes 4

CS 410/584, Algorithm Design & Analysis, Lecture Notes 4 CS 0/58,, Biconnectivity Let G = (N,E) be a connected A node a N is an articulation point if there are v and w different from a such that every path from 0 9 8 3 5 7 6 David Maier Biconnected Component

More information

IS 2610: Data Structures

IS 2610: Data Structures IS 2610: Data Structures Graph April 12, 2004 Graph Weighted graph call it networks Shortest path between nodes s and t in a network Directed simple path from s to t with the property that no other such

More information

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright Pearson-Addison Wesley. All rights reserved. 4 4.1 Interval Scheduling Interval Scheduling Interval scheduling. Job j starts at s j and finishes

More information

Dynamic Programming. Prof. S.J. Soni

Dynamic Programming. Prof. S.J. Soni Dynamic Programming Prof. S.J. Soni Idea is Very Simple.. Introduction void calculating the same thing twice, usually by keeping a table of known results that fills up as subinstances are solved. Dynamic

More information

Lecture 22: Counting

Lecture 22: Counting CS 710: Complexity Theory 4/8/2010 Lecture 22: Counting Instructor: Dieter van Melkebeek Scribe: Phil Rydzewski & Chi Man Liu Last time we introduced extractors and discussed two methods to construct them.

More information

iretilp : An efficient incremental algorithm for min-period retiming under general delay model

iretilp : An efficient incremental algorithm for min-period retiming under general delay model iretilp : An efficient incremental algorithm for min-period retiming under general delay model Debasish Das, Jia Wang and Hai Zhou EECS, Northwestern University, Evanston, IL 60201 Place and Route Group,

More information

Dynamic Programming. Data Structures and Algorithms Andrei Bulatov

Dynamic Programming. Data Structures and Algorithms Andrei Bulatov Dynamic Programming Data Structures and Algorithms Andrei Bulatov Algorithms Dynamic Programming 18-2 Weighted Interval Scheduling Weighted interval scheduling problem. Instance A set of n jobs. Job j

More information

Maximum Flow. Reading: CLRS Chapter 26. CSE 6331 Algorithms Steve Lai

Maximum Flow. Reading: CLRS Chapter 26. CSE 6331 Algorithms Steve Lai Maximum Flow Reading: CLRS Chapter 26. CSE 6331 Algorithms Steve Lai Flow Network A low network G ( V, E) is a directed graph with a source node sv, a sink node tv, a capacity unction c. Each edge ( u,

More information

Complexity Theory of Polynomial-Time Problems

Complexity Theory of Polynomial-Time Problems Complexity Theory of Polynomial-Time Problems Lecture 1: Introduction, Easy Examples Karl Bringmann and Sebastian Krinninger Audience no formal requirements, but: NP-hardness, satisfiability problem, how

More information

CS367 Lecture 3 (old lectures 5-6) APSP variants: Node Weights, Earliest Arrivals, Bottlenecks Scribe: Vaggos Chatziafratis Date: October 09, 2015

CS367 Lecture 3 (old lectures 5-6) APSP variants: Node Weights, Earliest Arrivals, Bottlenecks Scribe: Vaggos Chatziafratis Date: October 09, 2015 CS367 Lecture 3 (old lectures 5-6) APSP variants: Node Weights, Earliest Arrivals, Bottlenecks Scribe: Vaggos Chatziafratis Date: October 09, 2015 1 The Distance Product Last time we defined the distance

More information

ne a priority queue for the nodes of G; ile (! PQ.is empty( )) select u PQ with d(u) minimal and remove it; I Informatik 1 Kurt Mehlhorn

ne a priority queue for the nodes of G; ile (! PQ.is empty( )) select u PQ with d(u) minimal and remove it; I Informatik 1 Kurt Mehlhorn n-negative Edge Costs: optimal choice: u U with d(u) minimal. e use a priority queue (de nition on next slide) PQ to maintain the set of pairs, d(u)) ; u U } and obtain Dijkstra s Algorithm: ne a priority

More information

Matrices: 2.1 Operations with Matrices

Matrices: 2.1 Operations with Matrices Goals In this chapter and section we study matrix operations: Define matrix addition Define multiplication of matrix by a scalar, to be called scalar multiplication. Define multiplication of two matrices,

More information

Chapter 9: Relations Relations

Chapter 9: Relations Relations Chapter 9: Relations 9.1 - Relations Definition 1 (Relation). Let A and B be sets. A binary relation from A to B is a subset R A B, i.e., R is a set of ordered pairs where the first element from each pair

More information

BFS Dijkstra. Oct abhi shelat

BFS Dijkstra. Oct abhi shelat 4102 BFS Dijkstra Oct 22 2009 abhi shelat breadth first search bfs(g, a) 1 2 a b 1 2 d c e f g 2 h bfs theorem Theorem 1 (CLRS, p. 599) Let G =(V, E) be a graph and suppose that BFS is run on G from vertex

More information

Introduction to Algorithms 6.046J/18.401J/SMA5503

Introduction to Algorithms 6.046J/18.401J/SMA5503 Introduction to Algorithms 6.046J/8.40J/SMA5503 Lecture 3 Prof. Piotr Indyk The divide-and-conquer design paradigm. Divide the problem (instance) into subproblems. 2. Conquer the subproblems by solving

More information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS4: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by

More information

Tradeoffs between synchronization, communication, and work in parallel linear algebra computations

Tradeoffs between synchronization, communication, and work in parallel linear algebra computations Tradeoffs between synchronization, communication, and work in parallel linear algebra computations Edgar Solomonik, Erin Carson, Nicholas Knight, and James Demmel Department of EECS, UC Berkeley February,

More information

Matrices and Vectors

Matrices and Vectors Matrices and Vectors James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University November 11, 2013 Outline 1 Matrices and Vectors 2 Vector Details 3 Matrix

More information

Max-plus algebra. Max-plus algebra. Monika Molnárová. Technická univerzita Košice. Max-plus algebra.

Max-plus algebra. Max-plus algebra. Monika Molnárová. Technická univerzita Košice. Max-plus algebra. Technická univerzita Košice monika.molnarova@tuke.sk Outline 1 Digraphs Maximum cycle-mean and transitive closures of a matrix Reducible and irreducible matrices Definite matrices Digraphs Complete digraph

More information

AAA616: Program Analysis. Lecture 7 The Octagon Abstract Domain

AAA616: Program Analysis. Lecture 7 The Octagon Abstract Domain AAA616: Program Analysis Lecture 7 The Octagon Abstract Domain Hakjoo Oh 2016 Fall Hakjoo Oh AAA616 2016 Fall, Lecture 7 November 3, 2016 1 / 30 Reference Antoine Miné. The Octagon Abstract Domain. Higher-Order

More information

Discrete Math, Spring Solutions to Problems V

Discrete Math, Spring Solutions to Problems V Discrete Math, Spring 202 - Solutions to Problems V Suppose we have statements P, P 2, P 3,, one for each natural number In other words, we have the collection or set of statements {P n n N} a Suppose

More information

Chapter 0: Preliminaries

Chapter 0: Preliminaries Chapter 0: Preliminaries Adam Sheffer March 28, 2016 1 Notation This chapter briefly surveys some basic concepts and tools that we will use in this class. Graduate students and some undergrads would probably

More information

Lecture 18 Classical Iterative Methods

Lecture 18 Classical Iterative Methods Lecture 18 Classical Iterative Methods MIT 18.335J / 6.337J Introduction to Numerical Methods Per-Olof Persson November 14, 2006 1 Iterative Methods for Linear Systems Direct methods for solving Ax = b,

More information

CSC Linear Programming and Combinatorial Optimization Lecture 12: The Lift and Project Method

CSC Linear Programming and Combinatorial Optimization Lecture 12: The Lift and Project Method CSC2411 - Linear Programming and Combinatorial Optimization Lecture 12: The Lift and Project Method Notes taken by Stefan Mathe April 28, 2007 Summary: Throughout the course, we have seen the importance

More information

Lecture 2. Fundamentals of the Analysis of Algorithm Efficiency

Lecture 2. Fundamentals of the Analysis of Algorithm Efficiency Lecture 2 Fundamentals of the Analysis of Algorithm Efficiency 1 Lecture Contents 1. Analysis Framework 2. Asymptotic Notations and Basic Efficiency Classes 3. Mathematical Analysis of Nonrecursive Algorithms

More information

Mat 3770 Bin Packing or

Mat 3770 Bin Packing or Basic Algithm Spring 2014 Used when a problem can be partitioned into non independent sub problems Basic Algithm Solve each sub problem once; solution is saved f use in other sub problems Combine solutions

More information

Topics in Theoretical Computer Science April 08, Lecture 8

Topics in Theoretical Computer Science April 08, Lecture 8 Topics in Theoretical Computer Science April 08, 204 Lecture 8 Lecturer: Ola Svensson Scribes: David Leydier and Samuel Grütter Introduction In this lecture we will introduce Linear Programming. It was

More information