Download presentation

Presentation is loading. Please wait.

1
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 15, Friday, October 3

2
4.1. Shortest Paths Homework (MATH 310#5F): Read 4.2 and 5.1. Do Exercise 4.2: 1,3,5,7 Volunteers: ____________ Problem: 1. Challenge (up to 5+5 pts.) Exercise 4.2. 16. Challenge (up to 5+5 pts.) Exercise 4.2. 16.

3
A Network A network is a graph in with a positive integer k(e) assigned to each edge e. This usually represents a “lenght” of an edge. N f i m R h c b d eg j k 20 6 3 2 10 4 6 5 12 3 5 2 6 6 4 4 8 2 2 4 5 3

4
Dijkstra’s Algorithm We are looking for a shortest path from vertex a to any other vertex (or to some specific vertx z). At each step of the algorithm the (green) edge e between a labeled vertex p and unlabeled vertex q is selected in such a way, that d(p) + k(e) is minimal. a Labeled vertices Unlabeled vertices p q z e

5
Example 1 Find the shortest path from N to R. N f i m R h c b d eg j k 20 6 3 2 10 4 6 5 12 3 5 2 6 6 4 4 8 2 2 4 5 3

6
Floyd’s Algorithm FOR k Ã 1 TO n DO FOR i Ã 1 TO n DO FOR j Ã 1 TO n DO IF d ik + d kj < d ij THEN d ij Ã d ik + d kj.

7
4.2 Minimal Spanning Trees Minimal spanning tree in a network is a spanning tree whose sum of edge lenghts k(e) is as small as possible. Note: Minimal spanning trees are also called minimum cost spanning trees.

8
Prim’s Algorithm We are looking for a minimal spanning tree startingt at some vertex a. At each step of the algorithm the (green) edge e between a labeled vertex p and unlabeled vertex q is selected in such a way, that k(e) is minimal. a Labeled vertices Unlabeled vertices p q z e

9
Kruskal’s Algorithm Step 1. Sort the edges: k(e 1 ) · k(e 2 ) ·... · k(e m ). Step 2. FOR i Ã 1 TO m DO add e i to T if that does not form a circuit.

Similar presentations

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google