1 / 70

Dijkstra's Algorithm for Shortest Path Calculation

A step-by-step explanation of Dijkstra's Algorithm for finding the shortest path in a network, using cost data for each link.

Download Presentation

Dijkstra's Algorithm for Shortest Path Calculation

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. Notation: c(x,y): link cost from node x to y; = ∞ if not direct neighbors D(v): current value of cost of path from source to dest. v p(v): predecessor node along path from source to v N': set of nodes whose least cost path definitively known Dijkstra’s Algorithm Data structures: • Path • An ordered sequence of nodes • a cost to reach the end of the path • The sum of each link cost along the path • Candidate paths (CP) • Shortest paths (SP)

  2. Dijsktra’s Algorithm • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop

  3. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Initialization (Steps 2-3) Least costs paths Cost Candidate paths Cost 0 A

  4. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 5 Least costs paths Cost Candidate paths Cost 0 A Entry with least cost

  5. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 6 Least costs paths Cost Candidate paths Cost 0 A 0 A Move entry

  6. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path A’s neighbors are B and D Least costs paths Cost Candidate paths Cost 0 A

  7. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path A’s neighbors are B and D Least costs paths Cost Candidate paths Cost 0 A 0+C(A,B) A,B

  8. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path A’s neighbors are B and D Least costs paths Cost Candidate paths Cost 0 A 0+C(A,B) A,B 0+C(A,D) A,D

  9. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path A’s neighbors are B and D Least costs paths Cost Candidate paths Cost 0 A 0+1=1 0+C(A,B) A,B 0+12=12 0+C(A,D) A,D

  10. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 8: Nothing to do Least costs paths Cost Candidate paths Cost 0 A 1 A,B 12 A,D

  11. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 9: Nothing to do Least costs paths Cost Candidate paths Cost 0 A 1 A,B 12 A,D

  12. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 10: Keep on going Least costs paths Cost Candidate paths Cost 0 A 1 A,B 12 A,D

  13. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 5: A,B has the least cost Least costs paths Cost Candidate paths Cost 0 A 1 A,B 12 A,D

  14. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 6: Move to shortest paths Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 A,B

  15. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path B’s neighbors are A, C, and E Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 A,B

  16. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path B’s neighbors are A, C, and E Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 1+C(B,A) A,B A,B,A

  17. Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path B’s neighbors are A, C, and E Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 1+C(B,A) A,B A,B,A 1+C(B,C) A,B,C

  18. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path B’s neighbors are A, C, and E Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 1+C(B,A) A,B A,B,A 1+C(B,C) A,B,C 1+C(B,E) A,B,E

  19. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have te same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path B’s neighbors are A, C, and E Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 1+C(B,A) A,B A,B,A 2 1+C(B,C) A,B,C 3 7 1+C(B,E) A,B,E

  20. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop. A F 2 12 D E 1 Step 8: Clean up candidate list 1: remove candidate paths with the same end Nothing to do Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 2 A,B A,B,A 3 A,B,C 7 A,B,E

  21. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop. A F 2 12 D E 1 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,A Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 2 A,B A,B,A 3 A,B,C 7 A,B,E

  22. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop. A F 2 12 D E 1 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,A Least costs paths Cost Candidate paths Cost 0 A 12 A,D 3 A,B,C 1 A,B 7 A,B,E

  23. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 10: Keep on going Least costs paths Cost Candidate paths Cost 0 12 A A,D 3 A,B,C 1 A,B 7 A,B,E

  24. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop. A F 2 12 D E 1 Step 5: A,B,C has the lowest costc Least costs paths Cost Candidate paths Cost 0 A 12 A,D 3 A,B,C 1 A,B 7 A,B,E

  25. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 6: Move path to least costs path Least costs paths Cost Candidate paths Cost 0 A 12 A,D 3 A,B,C 1 A,B 7 A,B,E 3 A,B,C

  26. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop. A F 2 12 D E 1 Step 6: Move path to least costs path Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 7 A,B A,B,E 3 A,B,C

  27. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop. A F 2 12 D E 1 Step 7: Extend newly found least cost path C’s neighbors are B, D, and F Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 7 A,B A,B,E 3 A,B,C A,B,C, B 3+C(C,B)

  28. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop. A F 2 12 D E 1 Step 7: Extend newly found least cost path C’s neighbors are B, D, and F Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 7 A,B A,B,E 3 A,B,C A,B,C, B 3+C(C,B) A,B,C, D 3+C(C,D)

  29. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path C’s neighbors are B, D, and F Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 7 A,B A,B,E 3 A,B,C A,B,C, B 3+C(C,B) A,B,C, D 3+C(C,D) A,B,C, F 3+C(C,F)

  30. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop. A F 2 12 D E 1 Step 7: Extend newly found least cost path C’s neighbors are B, D, and F Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 7 A,B A,B,E 3 A,B,C A,B,C, B 3+C(C,B) 5 A,B,C, D 9 3+C(C,D) A,B,C, F 3+C(C,F) 4

  31. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop. A F 2 12 D E 1 Step 8: Clean up candidate list 1: remove candidate paths with the same end A,B,C,D has lower cost than A,D Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 7 A,B A,B,E 3 A,B,C A,B,C, B 5 A,B,C, D 9 A,B,C, F 4

  32. Dijsktra’s Algorithm from A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 8: Clean up candidate list 1: remove candidate paths with the same end A,B,C,D has lower cost than A,D Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, B 5 1 A,B 3 A,B,C A,B,C, D 9 A,B,C, F 4

  33. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,C,B Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, B 5 1 A,B 3 A,B,C A,B,C, D 9 A,B,C, F 4

  34. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,C,B Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, D 1 A,B 9 3 A,B,C A,B,C, F 4

  35. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 10: Keep on going Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, D 9 1 A,B A,B,C, F 3 A,B,C 4

  36. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 5: A,B,C,F has the least cost Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, D 9 A,B 1 A,B,C, F A,B,C 3 4

  37. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 5: A,B,C,F has the least cost Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, D 9 1 A,B A,B,C, F 3 A,B,C 4 A,B,C, F 4

  38. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 5: A,B,C,F has the least cost Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, D 9 1 A,B 3 A,B,C A,B,C, F 4

  39. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path F’s neighbors are C, and E Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, D 9 1 A,B 3 A,B,C A,B,C, F 4

  40. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path F’s neighbors are C, and E Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, D 9 1 A,B A,B,C, F, C 4+C(F,C) 3 A,B,C A,B,C, F 4

  41. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path F’s neighbors are C, and E Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, D 9 1 A,B A,B,C, F, C 4+C(F,C) 3 A,B,C A,B,C, F, E 4+C(F,E) A,B,C, F 4

  42. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 7: Extend newly found least cost path F’s neighbors are C, and E Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, D 9 1 A,B A,B,C, F, C 5 4+C(F,C) 3 A,B,C A,B,C, F, E 6 4+C(F,E) A,B,C, F 4

  43. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 8: Clean up candidate list 1: remove candidate paths with the same end A,B,C,F,E has lower cost than A,B,E Least costs paths Cost Candidate paths Cost 7 A,B,E 0 A A,B,C, D 9 1 A,B A,B,C, F, C 5 3 A,B,C A,B,C, F, E 6 A,B,C, F 4

  44. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 8: Clean up candidate list 1: remove candidate paths with the same end A,B,C,F,E has lower cost than A,B,E Least costs paths Cost Candidate paths Cost A,B,C, D 0 A 9 A,B,C, F, C 5 1 A,B A,B,C, F, E 3 6 A,B,C A,B,C, F 4

  45. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,C,F,C Least costs paths Cost Candidate paths Cost A,B,C, D 0 A 9 A,B,C, F, C 5 1 A,B A,B,C, F, E 3 6 A,B,C A,B,C, F 4

  46. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,C,F,C Least costs paths Cost Candidate paths Cost A,B,C, D 0 A 9 A,B,C, F, E 6 1 A,B 3 A,B,C A,B,C, F 4

  47. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 10: Keep on going Least costs paths Cost Candidate paths Cost A,B,C, D 0 A 9 A,B,C, F, E 6 1 A,B 3 A,B,C A,B,C, F 4

  48. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 5: A, B, C, F, E has the least cost Least costs paths Cost Candidate paths Cost A,B,C, D 0 A 9 A,B,C, F, E 6 1 A,B 3 A,B,C A,B,C, F 4

  49. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 6: Move the newly found least cost path Least costs paths Cost Candidate paths Cost A,B,C, D 0 A 9 A,B,C, F, E 6 1 A,B 3 A,B,C A,B,C, F 4 A,B,C, F, E 6

  50. Dijsktra’s Algorithm from Router A Link Costs C(A,B)=1 C(A,D)=12 C(B,E)=6 C(B,C)=2 C(C,F)=1 C(C,D)=6 C(D,E)=1 C(E,F)=2 2 B C 1 1 6 6 • Let u be the router running this algorithm • 1 Initialization: • Candidate paths CP = [0, {u}] • Least cost paths = empty • Loop • find path [a, {u, …, w}] in CP with the least cost • Move [a, {u, …, w}] to shortest paths • Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] • Clean up candidate paths 1: if there are multiple entries in the list of candidate paths with the same destination, remove the ones with higher cost. If two have the same cost, remove one with more hops, if two have the same number of hops, remove the one with higher next hop IP address • Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths • If candidate paths is empty, then stop A F 2 12 D E 1 Step 6: Move the newly found least cost path Least costs paths Cost Candidate paths Cost A,B,C, D 0 A 9 1 A,B 3 A,B,C A,B,C, F 4 A,B,C, F, E 6

More Related