Download presentation
Presentation is loading. Please wait.
Published byJeremy Simpson Modified over 9 years ago
1
Management Science 461 Lecture 2b – Shortest Paths September 16, 2008
2
2 Graph Theory Branch of mathematics “Graph” has a very specific definition: Collection of objects Collection of relationships between objects Both collections can have associated data (costs, weights)
3
3 Physical Abstraction Euler and the Königsberg Bridges - 1736
4
4 Shortest Path Problems Find the shortest (distance, time, cost) path between two nodes (e.g. 1 5) 1 2 3 4 5 8 2 5 4 3 5 9 Node = Vertex Arc = Edge = Link Route = Path Tour = Circuit = Cycle
5
5 Algebraic formulation 1 2 3 4 5 8 2 5 4 3 5 9
6
6 Flow and Integrality Constraints subject to x 12 + x 13 = 1 (node 1) x 12 + x 32 + x 42 = x 23 + x 24 + x 25 (node 2) x 13 + x 23 + x 43 = x 32 + x 34 (node 3) x 34 + x 24 = x 43 + x 42 + x 45 (node 4) x 25 + x 45 = 1(node 5) x ij = 0 or 1 for all i, j 1 2 3 4 5
7
7 Rearranging, we get… subject to - x 12 - x 13 = -1 (node 1) x 12 + x 32 + x 42 - x 23 - x 24 - x 25 = 0 (node 2) x 13 + x 23 + x 43 - x 32 - x 34 = 0 (node 3) x 34 + x 24 - x 43 - x 42 - x 45 = 0 (node 4) x 25 + x 45 = 1(node 5) x ij = 0 or 1 for all i, j 1 2 3 4 5 Flow in = flow out flow in – flow out = 0 Do these -1, 0, 1 values look familiar?
8
8 Shortest Path Problems Solve using Excel’s Solver However, a network with several hundred nodes would be out of reach, even for Premium Solver e.g. Edmonton Efficient algorithms need to be used – like Dijkstra’s algorithm
9
9 Dijkstra’s algorithm “Label-setting” algorithm At each node, keep track of minimum distance from origin to the node, and how we got there Very fast – polynomial time algorithm Time to solve increases polynomially with problem size (not exponential)
10
10 Dijkstra’s Algorithm 8 2 5 4 3 5 9 1 2 3 4 5
11
11 Step 0 – Place Labels 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: Pred: 2 Dist: Pred: 5 Dist: Pred: 4 Dist: Pred: 3
12
12 Step 1 – Choose Minimum Label 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: Pred: 2 Dist: Pred: 5 Dist: Pred: 4 Dist: Pred: 3
13
13 Step 2 – Update Adjacent Labels 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 8 Pred: 1 Dist: Pred: 5 Dist: Pred: 4 Dist: 2 Pred: 1
14
14 Step 2b – Mark Node As Optimal 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 8 Pred: 1 Dist: Pred: 5 Dist: Pred: 4 Dist: 2 Pred: 1
15
15 Step 3 – Choose Next Min Dist 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 8 Pred: 1 Dist: Pred: 5 Dist: Pred: 4 Dist: 2 Pred: 1
16
16 Step 4 – Update Adjacent Labels 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: Pred: 5 Dist: 6 Pred: 3 Dist: 2 Pred: 1
17
17 Step 4b – Mark Node As Optimal 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: Pred: 5 Dist: 6 Pred: 3 Dist: 2 Pred: 1
18
18 Step 5 – Choose Next Min Dist 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: Pred: 5 Dist: 6 Pred: 3 Dist: 2 Pred: 1
19
19 Step 6 – Update Adjacent Labels 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: 15 Pred: 4 Dist: 6 Pred: 3 Dist: 2 Pred: 1
20
20 Step 6b – Mark Node As Optimal 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: 15 Pred: 5 Dist: 6 Pred: 3 Dist: 2 Pred: 1
21
21 Step 7 – Choose Next Min Dist 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: 15 Pred: 5 Dist: 6 Pred: 3 Dist: 2 Pred: 1
22
22 Step 8 – Update Adjacent Labels 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: 12 Pred: 2 Dist: 6 Pred: 3 Dist: 2 Pred: 1
23
23 Step 8b – Mark Node As Optimal 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: 12 Pred: 2 Dist: 6 Pred: 3 Dist: 2 Pred: 1
24
24 Step 9 – Choose Next Min Dist 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: 12 Pred: 2 Dist: 6 Pred: 3 Dist: 2 Pred: 1
25
25 Step 10 – Update Adjacent Labels 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: 12 Pred: 2 Dist: 6 Pred: 3 Dist: 2 Pred: 1
26
26 Step 10b – Mark Node As Optimal 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: 12 Pred: 2 Dist: 6 Pred: 3 Dist: 2 Pred: 1
27
27 Final Solution – Min Dist Tree 8 2 5 4 3 5 9 1 2 3 4 5 Dist: 0 Pred: 1 Dist: 7 Pred: 3 Dist: 12 Pred: 2 Dist: 6 Pred: 3 Dist: 2 Pred: 1
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.