Sie sind auf Seite 1von 20

Dijkstra's Shortest Path Algorithm

24

18

14

6
30
15

11

16

20

44

19

t
1

Dijkstra's Shortest Path Algorithm

S={ }
PQ = { s, 2, 3, 4, 5, 6, 7, t }

0
s

24

18

14

30

15

11

16

20

distance label

44

19

Dijkstra's Shortest Path Algorithm

S={ }
PQ = { s, 2, 3, 4, 5, 6, 7, t }

delmin

0
s

24

18

14

30

15

11

16

20

distance label

44

19

Dijkstra's Shortest Path Algorithm

S={s}
PQ = { 2, 3, 4, 5, 6, 7, t }
decrease key

X
9
0
s

24

18

X
14

14

30

11

16

20

7
distance label

X
15

6
15

44

19

Dijkstra's Shortest Path Algorithm

S={s}
PQ = { 2, 3, 4, 5, 6, 7, t }
delmin

X 9

0
s

24

18

X 14

14

30

11

16

20

7
distance label

X
15

6
15

44

19

Dijkstra's Shortest Path Algorithm

S = { s, 2 }
PQ = { 3, 4, 5, 6, 7, t }

X 9

0
s

24

18

X 14

14

30

11

16

20

7
X
15

6
15

44

19

Dijkstra's Shortest Path Algorithm

S = { s, 2 }
PQ = { 3, 4, 5, 6, 7, t }
decrease key
X
33

X 9

0
s

24

18

X 14

14

30

11

16

20

7
X
15

6
15

44

19

Dijkstra's Shortest Path Algorithm

S = { s, 2 }
PQ = { 3, 4, 5, 6, 7, t }

X
33

X 9

0
s

24

delmin
18

X 14

14

30

15

11

16

20

7
X
15

44

19

Dijkstra's Shortest Path Algorithm

S = { s, 2, 6 }
PQ = { 3, 4, 5, 7, t }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X

11

16

20

7
X
15

6
15

44

19

Dijkstra's Shortest Path Algorithm

S = { s, 2, 6 }
PQ = { 3, 4, 5, 7, t }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X

11

16

20

7
X
15

6
15

44

delmin

19

10

Dijkstra's Shortest Path Algorithm

S = { s, 2, 6, 7 }
PQ = { 3, 4, 5, t }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X 35
X

X
15

11

16

20

6
15

44

19

59 X
11

Dijkstra's Shortest Path Algorithm

S = { s, 2, 6, 7 }
PQ = { 3, 4, 5, t }

delmin
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X 35
X

X
15

11

16

20

6
15

44

19

59 X
12

Dijkstra's Shortest Path Algorithm

S = { s, 2, 3, 6, 7 }
PQ = { 4, 5, t }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X 34
X 35
X

X
15

11

16

20

6
15

44

19

t
51 59

X X
13

Dijkstra's Shortest Path Algorithm

S = { s, 2, 3, 6, 7 }
PQ = { 4, 5, t }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

20

7
X
15

44
X 34
X 35
X

6
15

delmin
44

11

16

19

t
51 59

X X
14

Dijkstra's Shortest Path Algorithm

S = { s, 2, 3, 5, 6, 7 }
PQ = { 4, t }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X 34
X 35
X

X
15

11

16

20

6
15

44

45 X

19

t
50 51

X 59
X X
15

Dijkstra's Shortest Path Algorithm

S = { s, 2, 3, 5, 6, 7 }
PQ = { 4, t }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X 34
X 35
X

X
15

11

16

20

6
15

44

45 X

19

delmin
6

t
50 51

X 59
X X
16

Dijkstra's Shortest Path Algorithm

S = { s, 2, 3, 4, 5, 6, 7 }
PQ = { t }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X 34
X 35
X

X
15

11

16

20

6
15

44

45 X

19

t
50 51

X 59
X X
17

Dijkstra's Shortest Path Algorithm

S = { s, 2, 3, 4, 5, 6, 7 }
PQ = { t }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X 34
X 35
X

X
15

11

16

20

6
15

44

45 X

19

t
delmin

50 51

X 59
X X
18

Dijkstra's Shortest Path Algorithm

S = { s, 2, 3, 4, 5, 6, 7, t }
PQ = { }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X 34
X 35
X

X
15

11

16

20

6
15

44

45 X

19

t
50 51

X 59
X X
19

Dijkstra's Shortest Path Algorithm

S = { s, 2, 3, 4, 5, 6, 7, t }
PQ = { }
32
X
33
X

X 9

0
s

24

18

X 14

14

30

44
X 34
X 35
X

X
15

11

16

20

6
15

44

45 X

19

t
50 51

X 59
X X
20