Lecture 33 - University at Buffaloerdem/cse331/spring20/lectures/lect33.pdfLecture 33 CSE 331 Apr22,...

5
Lecture 33 CSE 331 Apr 22, 2020

Transcript of Lecture 33 - University at Buffaloerdem/cse331/spring20/lectures/lect33.pdfLecture 33 CSE 331 Apr22,...

Page 1: Lecture 33 - University at Buffaloerdem/cse331/spring20/lectures/lect33.pdfLecture 33 CSE 331 Apr22, 2020. Give feedback! Shortest Path Problem Input: (Directed) Graph G=(V,E)and for

Lecture 33

CSE 331Apr 22, 2020

Page 2: Lecture 33 - University at Buffaloerdem/cse331/spring20/lectures/lect33.pdfLecture 33 CSE 331 Apr22, 2020. Give feedback! Shortest Path Problem Input: (Directed) Graph G=(V,E)and for

Give feedback!

Page 3: Lecture 33 - University at Buffaloerdem/cse331/spring20/lectures/lect33.pdfLecture 33 CSE 331 Apr22, 2020. Give feedback! Shortest Path Problem Input: (Directed) Graph G=(V,E)and for

Shortest Path Problem

Input: (Directed) Graph G=(V,E) and for every edge e has a cost ce (can be <0)

t in V

Output: Shortest path from every s to t

1 1

100

-1000

899

s t

Shortest path has cost negative

infinity

Assume that Ghas no negative

cycle

Page 4: Lecture 33 - University at Buffaloerdem/cse331/spring20/lectures/lect33.pdfLecture 33 CSE 331 Apr22, 2020. Give feedback! Shortest Path Problem Input: (Directed) Graph G=(V,E)and for

When to use Dynamic Programming

There are polynomially many sub-problems

Optimal solution can be computed from solutions to sub-problems

There is an ordering among sub-problem that allows for iterative solution

Richard Bellman

Page 5: Lecture 33 - University at Buffaloerdem/cse331/spring20/lectures/lect33.pdfLecture 33 CSE 331 Apr22, 2020. Give feedback! Shortest Path Problem Input: (Directed) Graph G=(V,E)and for

Today’s agenda

Bellman-Ford algorithm