• Nenhum resultado encontrado

Dijkstra's Shortest Path Algorithm

N/A
N/A
Protected

Academic year: 2022

Share "Dijkstra's Shortest Path Algorithm"

Copied!
20
0
0

Texto

(1)

Dijkstra's Shortest Path Algorithm

Find shortest path from s to t.

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

(2)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

∞ ∞

0

distance label

S = { }

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

(3)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

∞ ∞

0

distance label

S = { }

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

delmin

(4)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15

9

14

0

distance label

S = { s }

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

decrease key

X

X

X

(5)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15

9

14

0

distance label

S = { s }

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

X

X

X

delmin

(6)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15

9

14

0

S = { s, 2 }

PQ = { 3, 4, 5, 6, 7, t }

X

X

X

(7)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15

9

14

0

S = { s, 2 }

PQ = { 3, 4, 5, 6, 7, t }

X

X

X

decrease key X 33

(8)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15

9

14

0

S = { s, 2 }

PQ = { 3, 4, 5, 6, 7, t }

X

X

X

X 33 delmin

(9)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15

9

14

0

S = { s, 2, 6 }

PQ = { 3, 4, 5, 7, t }

X

X

X

X 33

44X

X 32

(10)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

S = { s, 2, 6 }

PQ = { 3, 4, 5, 7, t }

X

X

X

44X

delmin

X 33X 32

(11)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

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

X

X

X

44XX 35

59 X

24

X 33X 32

(12)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

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

X

X

X

44XX 35

59 X delmin

X 33X 32

(13)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

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

X

X

X

44XX 35

59X X 51

X 34

X 33X 32

(14)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

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

X

X

X

44XX 35

59X X 51

X 34

delmin

X 33X 32

24

(15)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

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

X

X

X

44XX 35

59X X 51

X 34

24

50 X 45 X

X 33X 32

(16)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

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

X

X

X

44XX 35

59X X 51

X 34

24

50 X 45 X

delmin

X 33X 32

(17)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

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

X

X

X

44XX 35

59X X 51

X 34

24

50 X 45 X

X 33X 32

(18)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

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

X

X

X

44XX 35

59X X 51

X 34

50 X 45 X

delmin

X 33X 32

24

(19)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

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

X

X

X

44XX 35

59X X 51

X 34

50 X 45 X

X 33X 32

(20)

Dijkstra's Shortest Path Algorithm

s

3

t 2

6

7

4 5

24

18

2 9

14

15 5

30

20

44

16 11

6

19

6

15 9

14

0

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

X

X

X

44XX 35

59X X 51

X 34

50 X 45 X

X 33X 32

Referências

Documentos relacionados

Sérgio P. By using the Data Envelopment Analysis technique and focusing on the performance of 223 Portuguese first instance courts during the period of 2007 to

5.1 Descrição do processo O arco submerso é um processo de soldagem no qual a energia é fornecida por um arco elétrico desenvolvido entre o metal base e um arame eletrodo

permite que se “evalúe, se analizen los problemas, se reflexiona y se buscan alternativas entre todos para continuar en la dirección que queríamos desde el

Portanto, este estudo teve como objetivo realizar uma revisão sistemática sobre os estudos que investigaram estimativas e/ou fatores associados aos estágios de mudança de

O cálculo das duas retas é automático e alterando os valores da nossa amos- tra (presentes na folha de cálculo do GeoGebra) permite visualizar a consequente alteração

Este trabajo presenta resultados preliminares en cuanto a la caracterización de marcadores funcionales en piel sana en respuesta a cambios externos (es decir,

Observa-se nas estruturas da atorvastatina e da rosuvastatina que estas possuem interações adicionais como as ligações de hidrogénio, são as estatinas de segunda

Aussi, Echenoz, comme tous ces jeunes écrivains, reprend le goût du récit et nous trouvons dans ces romans une histoire cohérente, des péripéties, des personnages bien conçus et