EMIS 8374 Shortest Path Problems: Introduction Updated 9 February 2008 - PowerPoint PPT Presentation

Loading...

PPT – EMIS 8374 Shortest Path Problems: Introduction Updated 9 February 2008 PowerPoint presentation | free to view - id: 260560-ZDc1Z



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

EMIS 8374 Shortest Path Problems: Introduction Updated 9 February 2008

Description:

The network contains a directed path from the source node to every other node in ... Renumber the nodes so that for every arc (i,j), i j. Let k := 1 ... – PowerPoint PPT presentation

Number of Views:13
Avg rating:3.0/5.0
Slides: 25
Provided by: SeaS59
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: EMIS 8374 Shortest Path Problems: Introduction Updated 9 February 2008


1
EMIS 8374 Shortest Path Problems Introduction
Updated 9 February 2008
2
Assumptions
  • All arc costs (cij) are integers.
  • The network contains a directed path from the
    source node to every other node in the network.
  • No negative (directed) cycles

3
A Network with Negative Cycles
3
2
4
1
1
2
1
6
-3
3
-3
3
1
3
5
7
4
Shortest Path Problems
  • Acyclic Networks

5
Topological Ordering
  • Renumber the nodes so that for every arc (i,j), i
    lt j
  • Let k 1
  • Find a node i with in-degree 0
  • If no such node then quit (no T.O.)
  • Else let order(i) k, k k1
  • Remove i and all incident arcs (i,j)
  • Goto Step 2

6
A Network with no Topological Ordering
7
Theorem
  • A network is acyclic if and only if it has a
    topological ordering of its nodes.
  • Complexity of T.O. Algorithm
  • O(m)

8
T.O. Algorithm
2
4
1
6
1
3
5
9
T.O. Algorithm
2
10
T.O. Algorithm
2
4
6
5
3
11
T.O. Algorithm
4
5
2
4
6
6
12
Topological Ordering
4
5
2
4
1
6
1
6
3
5
2
3
13
The Reaching Algorithm Initialization
  • Number the nodes by a topological ordering.
  • Let d(s) 0 d(i) ? for all other nodes.
  • d(i) indicates the length of the shortest path
    found so far from s to i.
  • When d(i) ?, it means we have not yet found a
    path from s to i.
  • Pred(s) 0

14
The Reaching Algorithm Main Loop
  • for i 1 to n do
  • for (i,j) in A(i) do
  • if d(j) gt d(i) cij then
  • begin
  • let d(j) d(i) cij
  • pred(j) i
  • end

15
Reaching Algorithm Example
?
?
2
4
5
7
1
1
6
2
?
0
1
6
5
2
3
-2
?
?
16
Examine A(1)
7
?
?
2
4
5
7
1
1
6
2
?
0
1
6
5
2
3
-2
?
?
5
17
Examine A(2)
7
6
?
2
4
5
7
1
1
6
2
?
0
1
6
5
2
3
-2
?
3
5
18
Examine A(3)
5
6
?
2
4
5
7
1
1
6
2
?
9
0
1
6
5
2
3
-2
3
5
19
Examine A(4)
7
5
?
2
4
5
7
1
1
6
2
9
0
1
6
5
2
3
-2
3
5
20
Examine A(5)
7
5
2
4
5
7
1
1
6
2
9
8
0
1
6
5
2
3
-2
3
5
21
Examine A(5)
7
5
2
4
5
7
1
1
6
2
8
0
1
6
5
2
3
-2
3
5
22
Complexity of the Reaching Algorithm
  • for i 1 to n do
  • for (i,j) in A(i) do
  • if d(j) gt d(i) cij then
  • begin
  • let d(j) d(i) cij
  • pred(j) i
  • end
  • Outer loop (for i i1) executes n times.
  • Examining an arc is O(1).
  • Comparison, updates of d(j) and pred(j) are O(1).
  • Each arc is examined once.
  • O(nm) O(m)

23
Shortest Path Tree
  • We can store a set of shortest paths from s to
    all other nodes in a tree
  • Use the pred(j) label to keep track of the last
    arc (i,j) that sets d(j) d(i) cij

24
Shortest Path Tree
7

6


7
5
?
2
4
5
1
1
6
2
?
8
0

5
2
3
-2
?
5
3
?
About PowerShow.com