- 23. Shortest Paths
Motivation, Dijkstra’s algorithm on distance graphs, Bellman-Ford Algorithm, Floyd-Warshall Algorithm [Ottman/Widmayer, Kap. 9.5 Cormen et al, Kap. 24.1-24.3, 25.2-25.3]
644
23. Shortest Paths Motivation, Dijkstras algorithm on distance - - PowerPoint PPT Presentation
23. Shortest Paths Motivation, Dijkstras algorithm on distance graphs, Bellman-Ford Algorithm, Floyd-Warshall Algorithm [Ottman/Widmayer, Kap. 9.5 Cormen et al, Kap. 24.1-24.3, 25.2-25.3] 644 River Crossing (Missionaries and Cannibals)
644
K K K M M M B
32There are slight variations of this problem. It is equivalent to the jealous husbands problem. 645
links rechts Missionare 3 Kannibalen 3 Boot x links rechts Missionare 2 1 Kannibalen 2 1 Boot x Überfahrt möglich
6 Personen am linken Ufer 4 Personen am linken Ufer
646
3 3 x 3 2 1 x 3 1 2 x 3 3 x 2 1 2 1 x 1 2 1 2 x 3 1 2 x 3 2 1 x 3 3 x 6 5 4 3 4 2 1 2 3 3 2 1 x 3 1 2 x 3 3 x 2 1 2 1 x 1 2 1 2 x 3 1 2 x 3 2 1 x 3 3 x 3 3 x 5 4 3 4 2 1 2 3
647
648
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 7 8 6 1 2 3 4 5 7 8 6 1 2 3 4 8 5 7 6 1 2 3 4 5 7 8 6 2 4 6 7 5 3 1 8
649
A B C D E F G H I Z
3 1 6 4 1 3 5 7 1 4 5 1 4 1 7 4 3 8 5 10 5
650
S t
651
i=0 c((vi, vi+1)).
Path with weight 9
652
upper bounds Smallest upper bound global minimum!
653
v∈M N +(v) \ M of
s
2 2 5 3 5 2 1 2
654
s t
655
s
2 2 5 3 5 2 1 2
656
657
∞ ∞ ∞ ∞ ∞
2 3
8
658
659
660
661
662
663
664
∞ ∞ ∞ ∞ ∞
2 3
8
4
665
ds(u) ds(v)
666
667
(u,v)∈E(ds[i − 1, u] + c(u, v))
668
s u v w
4 7 −2
669
670
671
33like for the algorithm of the reflexive transitive closure of Warshall 672
673
674
s t u v 1 1 1 1 −1
c→c+2
= ⇒ s’ t’ u’ v’ 3 3 3 3 1
675
676
k
k
k
Thus ˜
Weights of cycles are invariant: ˜
677
678
For a minimal weight d of a path the following triangular inequality holds:
Substitution yields h(v) ≤ h(u) + c(u, v). Therefore
679
680
681