Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 10 The Label Correcting Algorithm.

Similar presentations


Presentation on theme: "Lecture 10 The Label Correcting Algorithm."— Presentation transcript:

1 Lecture 10 The Label Correcting Algorithm

2

3

4

5

6

7

8 Label Correcting Algorithm

9 An Example 3 Initialize   d(1) := 0; d(j) :=  for j  1 1 2 4 5 36 7 2 3 3 1 6 -2 3 2 -4 43   0  In next slides: the number inside the node will be d(j). Violating arcs will be in thick lines.

10 An Example 3 Generic Step An arc (i,j) is violating if d(j) > d(i) + c ij. 0      2 3 3 1 6 -2 3 2 -4 43 Pick a violating arc (i,j) and replace d(j) by d(i) + c ij. 3

11 An Example 3 Generic Step An arc (i,j) is violating if d(j) > d(i) + c ij. 0      2 3 3 1 6 -2 3 2 -4 43 Pick a violating arc (i,j) and replace d(j) by d(i) + c ij. 3 6

12 An Example 3 Generic Step An arc (i,j) is violating if d(j) > d(i) + c ij. 0      2 3 3 1 6 -2 3 2 -4 43 Pick a violating arc (i,j) and replace d(j) by d(i) + c ij. 3 6 3

13 An Example 3 Generic Step An arc (i,j) is violating if d(j) > d(i) + c ij. 0      2 3 3 1 6 -2 3 2 -4 43 Pick a violating arc (i,j) and replace d(j) by d(i) + c ij. 3 6 3 5

14 An Example 3 Generic Step An arc (i,j) is violating if d(j) > d(i) + c ij. 0      2 3 3 1 6 -2 3 2 -4 43 Pick a violating arc (i,j) and replace d(j) by d(i) + c ij. 3 6 3 5 4

15 An Example 3 Generic Step An arc (i,j) is violating if d(j) > d(i) + c ij. 0      2 3 3 1 6 -2 3 2 -4 43 Pick a violating arc (i,j) and replace d(j) by d(i) + c ij. 3 6 3 5 4 6

16 An Example 3 Generic Step An arc (i,j) is violating if d(j) > d(i) + c ij. 0      2 3 3 1 6 -2 3 2 -4 43 Pick a violating arc (i,j) and replace d(j) by d(i) + c ij. 3 6 3 5 4 62

17 An Example 3 Generic Step An arc (i,j) is violating if d(j) > d(i) + c ij. 0      2 3 3 1 6 -2 3 2 -4 43 Pick a violating arc (i,j) and replace d(j) by d(i) + c ij. 3 6 3 5 4 62 9

18 An Example 3 Generic Step An arc (i,j) is violating if d(j) > d(i) + c ij. 0      2 3 3 1 6 -2 3 2 -4 43 Pick a violating arc (i,j) and replace d(j) by d(i) + c ij. 3 6 3 5 4 62 9 No arc is violating The distance labels are optimal We now show the predecessor arcs.

19

20

21

22

23

24

25

26

27

28

29

30 Modified Label Correcting Algorithm

31 The Modified Label Correcting Algorithm 3 Initialize   d(1) := 0; d(j) :=  for j  1 1 2 5 4 36 7 2 3 3 1 6 -2 3 2 -4 43   0  In next slides: the number inside the node will be d(j). LIST := {1}

32 An Example 3 Generic Step Take a node i from LIST 0      2 3 3 1 6 -2 3 2 -4 43 Update(i): for each arc (i,j) with d(j) > d(i) + c ij replace d(j) by d(i) + c ij. 3 LIST := {1}LIST := { } 6 LIST := { 2 }LIST := { 2, 3 } 3 LIST := { 2, 3, 4 } 0

33 An Example 3 Take a node i from LIST 0      2 3 3 1 6 -2 3 2 -4 43 Update(i): for each arc (i,j) with d(j) > d(i) + c ij replace d(j) by d(i) + c ij. 3 LIST := {1}LIST := { } 6 LIST := { 2 }LIST := { 2, 3 } 3 LIST := { 2, 3, 4 } 3 LIST := { 3, 4 } 4 5 LIST := { 3, 4, 5 }

34 An Example 3 Take a node i from LIST 0      2 3 3 1 6 -2 3 2 -4 43 Update(i): for each arc (i,j) with d(j) > d(i) + c ij replace d(j) by d(i) + c ij. 3 6 3 4 5 LIST := { 3, 4, 5 } 3 LIST := { 4, 5 }

35 An Example 3 Take a node i from LIST 0      2 3 3 1 6 -2 3 2 -4 43 Update(i): for each arc (i,j) with d(j) > d(i) + c ij replace d(j) by d(i) + c ij. 3 6 3 4 5 LIST := { 3, 4, 5 } LIST := { 4, 5 } 4 LIST := { 5 } 6 LIST := { 5, 6 }

36 An Example 3 Take a node i from LIST 0      2 3 3 1 6 -2 3 2 -4 43 Update(i): for each arc (i,j) with d(j) > d(i) + c ij replace d(j) by d(i) + c ij. 3 6 3 4 5 LIST := { 3, 4, 5 } LIST := { 4, 5 }LIST := { 5 } 6 LIST := { 5, 6 } 5 LIST := { 6 }

37 An Example 3 Take a node i from LIST 0      2 3 3 1 6 -2 3 2 -4 43 Update(i): for each arc (i,j) with d(j) > d(i) + c ij replace d(j) by d(i) + c ij. 3 6 3 4 5 LIST := { 3, 4, 5 } LIST := { 4, 5 }LIST := { 5 } 6 LIST := { 5, 6 }LIST := { 6 } 6 LIST := { } 2 LIST := { 3 } 9 LIST := { 3, 7 }

38 An Example 3 Take a node i from LIST 0      2 3 3 1 6 -2 3 2 -4 43 Update(i): for each arc (i,j) with d(j) > d(i) + c ij replace d(j) by d(i) + c ij. 3 6 3 4 5 LIST := { 3, 4, 5 } LIST := { 4, 5 }LIST := { 5 } 6 LIST := { 5, 6 }LIST := { 6 }LIST := { } 2 LIST := { 3 } 9 LIST := { 3, 7 } 2 LIST := { 7 }

39 An Example 3 Take a node i from LIST 0      2 3 3 1 6 -2 3 2 -4 43 Update(i): for each arc (i,j) with d(j) > d(i) + c ij replace d(j) by d(i) + c ij. 3 6 3 4 5 LIST := { 3, 4, 5 } LIST := { 4, 5 }LIST := { 5 } 6 LIST := { 5, 6 }LIST := { 6 }LIST := { } 2 LIST := { 3 } 9 LIST := { 3, 7 }LIST := { 7 } 9 LIST := { }

40 An Example 3 LIST is empty. The distance labels are optimal 0      2 3 3 1 6 -2 3 2 -4 43 3 6 3 4 5 LIST := { 3, 4, 5 } LIST := { 4, 5 }LIST := { 5 } 6 LIST := { 5, 6 }LIST := { 6 }LIST := { } 2 LIST := { 3 } 9 LIST := { 3, 7 }LIST := { 7 }LIST := { } Here are the predecessors

41

42

43

44

45

46

47

48

49

50

51


Download ppt "Lecture 10 The Label Correcting Algorithm."

Similar presentations


Ads by Google