700 likes | 853 Views
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:
E N D
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 lonk cost along the path • Candidate paths (CP) • Shortest paths (SP)
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
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
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
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
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
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
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
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
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
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
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
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
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
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, D, and E Least costs paths Cost Candidate paths Cost 0 A 12 A,D 1 A,B
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
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
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
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
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
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
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
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
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
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
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
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)
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)
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)
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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