1 / 18

Shortest Path From 0 in Weighted DiGraph

1. Shortest Path From 0 in Weighted DiGraph. 1. 2. 1. 7. 0. 5. 4. 3. 1. 1. 4. 3. 4. 1. 1. Shortest Path From 0 in Weighted DiGraph. 1. 2. 1. 7. 0. 5. 4. 3. 1. 1. 4. 3. 4. 1. Shortest Path From 0 in Weighted DiGraph. MinPriority Queue e dge, weight:. 1.

lulu
Download Presentation

Shortest Path From 0 in Weighted DiGraph

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 1 Shortest Path From 0 in Weighted DiGraph 1 2 1 7 0 5 4 3 1 1 4 3 4 1

  2. 1 Shortest Path From 0 in Weighted DiGraph 1 2 1 7 0 5 4 3 1 1 4 3 4 1

  3. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v distTo[0] = 0 1 2 1 7 0 5 4 3 1 1 4 3 4 1

  4. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v distTo[0] = 0 1 2 1 0-1, 1 7 0-3, 4 0 5 4 3 1 1 4 3 4 1

  5. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v distTo[0] = 0 1 2 1 0-1, 1 7 distTo[1] = 1 0-3, 4 0 5 4 3 1 1 4 3 4 1 edgeTo[1] = 0 weight(0-1) = 1 distTo[1] = distTo[0] + weight(0-1) = 0 + 1 = 1

  6. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v distTo[0] = 0 1 2 1 7 distTo[1] = 1 0-3, 4 0 5 4 3 1 1 4 3 4 1 edgeTo[1] = 0

  7. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v distTo[0] = 0 1 2 1-2, 1 1 7 distTo[1] = 1 0-3, 4 0 5 4 1-3, 4 3 1 1 4 3 4 1 edgeTo[1] = 0

  8. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v distTo[0] = 0 1 2 1-2, 1 1 7 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 4 1-3, 4 3 1 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1 weight(1-2) = 1 distTo[2] = distTo[1] + weight(1-2) = 1 + 1 = 2

  9. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v distTo[0] = 0 1 2 1 7 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 4 1-3, 4 3 1 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1

  10. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v 2-3, 1 distTo[0] = 0 1 2 1 7 2-4, 3 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 4 1-3, 4 3 1 2-5, 7 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1

  11. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v 2-3, 1 1 2 distTo[0] = 0 1 7 2-4, 3 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 distTo[3] = 3 4 1-3, 4 3 1 2-5, 7 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1 weight(2-3) = 1 edgeTo[3] = 2 distTo[3] = distTo[2] + weight(2-3) = 2 + 1 = 3

  12. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v distTo[0] = 0 1 2 1 7 2-4, 3 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 distTo[3] = 3 4 1-3, 4 3 1 2-5, 7 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1 edgeTo[3] = 2

  13. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v 3-4, 1 distTo[0] = 0 1 2 1 7 2-4, 3 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 distTo[3] = 3 4 1-3, 4 3 1 2-5, 7 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1 edgeTo[3] = 2

  14. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v 3-4, 1 distTo[0] = 0 1 2 1 7 2-4, 3 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 distTo[3] = 3 4 1-3, 4 3 1 distTo[4] = 4 2-5, 7 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1 weight(3-4) = 1 edgeTo[3] = 2 edgeTo[4] = 3 distTo[4] = distTo[3] + weight(3-4) = 3 + 1 = 4

  15. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v distTo[0] = 0 1 2 1 7 2-4, 3 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 distTo[3] = 3 4 1-3, 4 3 1 distTo[4] = 4 2-5, 7 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1 edgeTo[3] = 2 edgeTo[4] = 2

  16. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v 4-5, 1 distTo[0] = 0 1 2 1 7 2-4, 3 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 distTo[3] = 3 4 1-3, 4 3 1 distTo[4] = 4 2-5, 7 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1 edgeTo[3] = 2 edgeTo[4] = 2

  17. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v 4-5, 1 distTo[0] = 0 1 2 1 7 2-4, 3 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 distTo[3] = 3 4 1-3, 4 3 1 distTo[4] = 4 2-5, 7 distTo[5] = 5 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1 weight(4-5) = 1 edgeTo[3] = 2 edgeTo[4] = 2 distTo[5] = distTo[4] + weight(4-5) = 4 + 1 = 5 edgeTo[5] = 4

  18. Shortest Path From 0 in Weighted DiGraph MinPriority Queue edge, weight: 1 distTo[v]: distance from 0 to v distTo[0] = 0 1 2 1 7 2-4, 3 distTo[1] = 1 distTo[2] = 2 0-3, 4 0 5 distTo[3] = 3 4 1-3, 4 3 1 distTo[4] = 4 2-5, 7 distTo[5] = 5 1 4 3 4 1 edgeTo[1] = 0 edgeTo[2] = 1 edgeTo[3] = 2 edgeTo[4] = 3 edgeTo[5] = 4

More Related