20_Shortest_path.pptx

# Vertex visited distance previous a f ø b f ø c f ø

• 148

This preview shows pages 32–45. Sign up to view the full content.

Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F Ø F F Ø G F Ø H F Ø I F Ø J F Ø K F 0 Ø L F Ø

This preview has intentionally blurred sections. Sign up to view the full version.

Example We visit vertex K Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F Ø F F Ø G F Ø H F Ø I F Ø J F Ø K T 0 Ø L F Ø
Example Vertex K has four neighbors: H, I, J and L Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F Ø F F Ø G F Ø H F Ø I F Ø J F Ø K T 0 Ø L F Ø

This preview has intentionally blurred sections. Sign up to view the full version.

Example We have now found at least one path to each of these vertices Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F Ø F F Ø G F Ø H F 8 K I F 12 K J F 17 K K T 0 Ø L F 16 K
Example We’re finished with vertex K To which vertex are we now guaranteed we have the shortest path? Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F Ø F F Ø G F Ø H F 8 K I F 12 K J F 17 K K T 0 Ø L F 16 K

This preview has intentionally blurred sections. Sign up to view the full version.

Example We visit vertex H: the shortest path is (K, H) of length 8 Vertex H has four unvisited neighbors: E, G, I, L Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F Ø F F Ø G F Ø H T 8 K I F 12 K J F 17 K K T 0 Ø L F 16 K
Example Consider these paths: (K, H, E) of length 8 + 6 = 14 (K, H, G) of length 8 + 11 = 19 (K, H, I) of length 8 + 2 = 10 (K, H, L) of length 8 + 9 = 17 Which of these are shorter than any known path? Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F Ø F F Ø G F Ø H T 8 K I F 12 K J F 17 K K T 0 Ø L F 16 K

This preview has intentionally blurred sections. Sign up to view the full version.

Example We already have a shorter path (K, L), but we update the other three Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F 14 H F F Ø G F 19 H H T 8 K I F 10 H J F 17 K K T 0 Ø L F 16 K
Example We are finished with vertex H Which vertex do we visit next? Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F 14 H F F Ø G F 19 H H T 8 K I F 10 H J F 17 K K T 0 Ø L F 16 K

This preview has intentionally blurred sections. Sign up to view the full version.

Example The path (K, H, I) is the shortest path from K to I of length 10 Vertex I has two unvisited neighbors: G and J Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F 14 H F F Ø G F 19 H H T 8 K I T 10 H J F 17 K K T 0 Ø L F 16 K
Example Consider these paths: (K, H, I, G) of length 10 + 3 = 13 (K, H, I, J) of length 10 + 18 = 28 Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F 14 H F F Ø G F 19 H H T 8 K I T 10 H J F 17 K K T 0 Ø L F 16 K

This preview has intentionally blurred sections. Sign up to view the full version.

Example We have discovered a shorter path to vertex G, but (K, J) is still the shortest known path to vertex J Vertex Visited Distance Previous A F Ø B F Ø C F Ø D F Ø E F 14 H F F Ø G F 13 I H T 8 K I T 10 H J F 17 K K T 0 Ø L F 16 K
Example Which vertex can we visit next?

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern