Dijkstra’s Algorithm 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.

Slides:



Advertisements
Similar presentations
DIJKSTRA’s Algorithm. Definition fwd search Find the shortest paths from a given SOURCE node to ALL other nodes, by developing the paths in order of increasing.
Advertisements

Routing - I Important concepts: link state based routing, distance vector based routing.
1 Dijkstra’s Shortest Path Algorithm Gordon College.
Introduction to Networking Bin Lin TA March 3 rd, 2005 Recital 6.
Routing & IP Routing Protocols
Katz, Stoica F04 EECS 122: Introduction to Computer Networks Link State and Distance Vector Routing Computer Science Division Department of Electrical.
Link-State Routing Reading: Sections 4.2 and COS 461: Computer Networks Spring 2011 Mike Freedman
Announcement r Project 2 extended to 2/20 midnight r Project 3 available this weekend r Homework 3 available today, will put it online.
1 EE 122: Shortest Path Routing Ion Stoica TAs: Junda Liu, DK Moon, David Zats (Materials with thanks to Vern.
1 Computer Networks Routing Algorithms. 2 IP Packet Delivery Two Processes are required to accomplish IP packet delivery: –Routing discovering and selecting.
4: Network Layer4a-1 14: Intro to Routing Algorithms Last Modified: 7/12/ :17:44 AM.
1 Shortest Path Algorithms. 2 Routing Algorithms Shortest path routing What is a shortest path? –Minimum number of hops? –Minimum distance? There is a.
Network Layer4-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.5 Routing algorithms m Link state m Distance.
EE 122: Intra-domain routing Ion Stoica September 30, 2002 (* this presentation is based on the on-line slides of J. Kurose & K. Rose)
1 Announcement #1 r Did you all receive homework #1 and #2? r Homework #3 will be available online during the day r Midterm.
Routing Algorithm March 3 rd, Routing Graph abstraction for routing algorithms: graph nodes are routers graph edges are physical links  link cost:
Routing Protocols and the IP Layer CS244A Review Session 2/01/08 Ben Nham Derived from slides by: Paul Tarjan Martin Casado Ari Greenberg.
Network Layer Goals: understand principles behind network layer services: –routing (path selection) –dealing with scale –how a router works –advanced topics:
Lecture Week 10 Link-State Routing Protocols. Objectives Describe the basic features & concepts of link-state routing protocols. List the benefits and.
Using Dijkstra’s Algorithm to Find a Shortest Path from a to z 1.
Review: routing algorithms. –Choose the appropriate paths. –Routing algorithms Flooding Shortest path routing (example). –Dijkstra algorithm. –Bellman-Ford.
Network Layer r Introduction r Datagram networks r IP: Internet Protocol m Datagram format m IPv4 addressing m ICMP r What’s inside a router r Routing.
Link-state routing  each node knows network topology and cost of each link  quasi-centralized: each router periodically broadcasts costs of attached.
Introduction 1 Lecture 21 Network Layer (Routing Activity) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science &
IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface UGH00emd UH10lo0.
Network Layer4-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet.
13 – Routing Algorithms Network Layer.
The Network Layer & Routing
1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts.
Overview of Internet Routing (I) Fall 2004 CS644 Advanced Topics in Networking Sue B. Moon Division of Computer Science Dept. of EECS KAIST.
Routing 1 Network Layer Network Layer goals:  understand principles behind network layer services:  routing (path selection)  how a router works  instantiation.
Introduction 1 Lecture 19 Network Layer (Routing Algorithms) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science.
Routing protocols. Static Routing Routes to destinations are set up manually Route may be up or down but static routes will remain in the routing tables.
Mobile and Wireless Computing Institute for Computer Science, University of Freiburg Western Australian Interactive Virtual Environments Centre (IVEC)
Data Communications and Computer Networks Chapter 4 CS 3830 Lecture 20 Omar Meqdadi Department of Computer Science and Software Engineering University.
Internet Routing r Routing algorithms m Link state m Distance Vector m Hierarchical routing r Routing protocols m RIP m OSPF m BGP.
Transport Layer 3-1 Chapter 4 Network Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley Chapter4_3.
Network Layer4-1 Routing Algorithm Classification Global or decentralized information? Global: r all routers have complete topology, link cost info r “link.
Network Layer4-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet.
4: Network Layer4a-1 Distance Vector Routing Algorithm iterative: r continues until no nodes exchange info. r self-terminating: no “signal” to stop asynchronous:
Spring Routing: Part I Section 4.2 Outline Algorithms Scalability.
Network Layer (2). Review Physical layer: move bits between physically connected stations Data link layer: move frames between physically connected stations.
4: Network Layer4-1 Chapter 4: Network Layer Last time: r Chapter Goals m Understand network layer principles and Internet implementation r Started routing.
CS 6401 Intra-domain Routing Outline Introduction to Routing Distance Vector Algorithm.
CSE 421 Computer Networks. Network Layer 4-2 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside.
IP tutorial - #2 Routing KAIST Dept. of CS NC Lab.
Routing Link-State, Distance-Vector CS168 Section 2.
Network Layer4-1 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol.
Routing algorithms. D(v): the cost from the source node to destination that has currently the least cost. p(v): previous node along current least.
Chapter 4 Network Layer Computer Networking: A Top Down Approach 6th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 CPSC 335 Data Communication.
Chapter 7 Dynamic Routing
Routing Jennifer Rexford.
Dijkstra’s shortest path Algorithm
Routing Protocols and Concepts
COMP 3270 Computer Networks
Link-State Routing Protocols
CS 457 – Lecture 12 Routing Spring 2012.
Routing: Distance Vector Algorithm
Chapter 5 Network Layer.
Road Map I. Introduction II. IP Protocols III. Transport Layer
Link-State Routing Protocols
Graphs Chapter 11 Objectives Upon completion you will be able to:
Dijkstra’s Algorithm Data structures: Notation: Path
Intradomain Routing Outline Introduction to Routing
CS4470 Computer Networking Protocols
Link-State Routing Protocols
Advanced Computer Networks
Brad Karp UCL Computer Science
Chapter 4: Network Layer
EE 122: Intra-domain routing: Link State
Presentation transcript:

Dijkstra’s Algorithm 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 Data structures: r Path m An ordered sequence of nodes m a cost to reach the end of the path The sum of each lonk cost along the path r Candidate paths (CP)  Shortest paths (SP)

Dijsktra’s Algorithm Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop

Dijsktra’s Algorithm from Router A A B E C D F 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 Least costs paths Cost Candidate paths Cost A 0 Initialization (Steps 2-3) Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 Step 5 Entry with least cost Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost Step 6 Move entry A 0 A 0 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost Step 7: Extend newly found least cost path A’s neighbors are B and D A 0 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost Step 7: Extend newly found least cost path A’s neighbors are B and D A 0 A,B 0+C(A,B) Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost Step 7: Extend newly found least cost path A’s neighbors are B and D A 0 A,B 0+C(A,B) A,D 0+C(A,D) Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost Step 7: Extend newly found least cost path A’s neighbors are B and D A 0 A,B 0+1=1 A,D 0+12=12 0+C(A,B) 0+C(A,D) Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost Step 8: Nothing to do A 0 A,B 1 A,D 12 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost Step 9: Nothing to do A 0 A,B 1 A,D 12 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost Step 10: Keep on going A 0 A,B 1 A,D 12 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost Step 5: A,B has the least cost A 0 A,B 1 A,D 12 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost Step 6: Move to shortest paths A 0 A,D 12 A,B 1 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 Step 7: Extend newly found least cost path B’s neighbors are A, C, D, and E Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 Step 7: Extend newly found least cost path B’s neighbors are A, C, and E A,B,A 1+C(B,A) Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 Step 7: Extend newly found least cost path B’s neighbors are A, C, and E A,B,A 1+C(B,A) A,B,C 1+C(B,C)

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 Step 7: Extend newly found least cost path B’s neighbors are A, C, and E A,B,A 1+C(B,A) A,B,C 1+C(B,C) A,B,E 1+C(B,E)

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 Step 7: Extend newly found least cost path B’s neighbors are A, C, and E A,B,A 1+C(B,A) A,B,C 1+C(B,C) A,B,E 1+C(B,E) 2 3 7

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop. Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 Step 8: Clean up candidate list 1: remove candidate paths with the same end Nothing to do A,B,A 2 A,B,C 3 A,B,E 7

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop. Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,A A,B,A 2 A,B,C 3 A,B,E 7

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop. Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,A A,B,C 3 A,B,E 7

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 A,B,C 3 A,B,E 7 Step 10: Keep on going

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop. Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 A,B,C 3 A,B,E 7 Step 5: A,B,C has the lowest costc

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 A,B,C 3 A,B,E 7 Step 6: Move path to least costs path A,B,C 3

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop. Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 A,B,E 7 Step 6: Move path to least costs path A,B,C 3

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop. Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 A,B,E 7 A,B,C 3 Step 7: Extend newly found least cost path C’s neighbors are B, D, and F A,B,C, B 3+C(C,B)

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop. Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 A,B,E 7 A,B,C 3 Step 7: Extend newly found least cost path C’s neighbors are B, D, and F A,B,C, B 3+C(C,B) A,B,C, D 3+C(C,D)

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 A,B,E 7 A,B,C 3 Step 7: Extend newly found least cost path C’s neighbors are B, D, and F 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 A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop. Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 A,B,E 7 A,B,C 3 Step 7: Extend newly found least cost path C’s neighbors are B, D, and F A,B,C, B 3+C(C,B) A,B,C, D 3+C(C,D) A,B,C, F 3+C(C,F) 5 9 4

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop. Least costs paths Cost Candidate paths Cost A 0 A,D 12 A,B 1 A,B,E 7 A,B,C 3 A,B,C, B A,B,C, D A,B,C, F Step 8: Clean up candidate list 1: remove candidate paths with the same end A,B,C,D has lower cost than A,D

Dijsktra’s Algorithm from A A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, B A,B,C, D A,B,C, F Step 8: Clean up candidate list 1: remove candidate paths with the same end A,B,C,D has lower cost than A,D

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, B A,B,C, D A,B,C, F Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,C,B Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, D A,B,C, F 9 4 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,C,B Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, D A,B,C, F 9 4 Step 10: Keep on going Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B1 A,B,E 7 A,B,C3 A,B,C, D A,B,C, F 9 4 Step 5: A,B,C,F has the least cost Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, D A,B,C, F 9 4 Step 5: A,B,C,F has the least cost A,B,C, F 4 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, D9 Step 5: A,B,C,F has the least cost A,B,C, F 4 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, D9 A,B,C, F 4 Step 7: Extend newly found least cost path F’s neighbors are C, and E Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, D 9 A,B,C, F 4 Step 7: Extend newly found least cost path F’s neighbors are C, and E A,B,C, F, C 4+C(F,C) Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, D 9 A,B,C, F 4 Step 7: Extend newly found least cost path F’s neighbors are C, and E A,B,C, F, C 4+C(F,C) A,B,C, F, E 4+C(F,E) Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, D 9 A,B,C, F 4 Step 7: Extend newly found least cost path F’s neighbors are C, and E A,B,C, F, C 4+C(F,C) A,B,C, F, E 4+C(F,E) 5 6 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,E 7 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, C A,B,C, F, E 5 6 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 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, C A,B,C, F, E 5 6 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 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, C A,B,C, F, E 5 6 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 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, E 6 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 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, E 6 Step 10: Keep on going Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, E 6 Step 5: A, B, C, F, E has the least cost Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, E 6 Step 6: Move the newly found least cost path A,B,C, F, E 6 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 Step 6: Move the newly found least cost path A,B,C, F, E 6 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, E 6 Step 7: Extend newly found least cost path F’s neighbors are B, D and F Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, E 6 Step 7: Extend newly found least cost path F’s neighbors are B, D and F A,B,C, F, E, B 6+C(E,B) Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, E 6 Step 7: Extend newly found least cost path F’s neighbors are B, D and F A,B,C, F, E, B 6+C(E,B) A,B,C, F, E, D 6+C(E,D) Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, E 6 Step 7: Extend newly found least cost path F’s neighbors are B, D and F A,B,C, F, E, B 6+C(E,B) A,B,C, F, E, D 6+C(E,D) A,B,C, F, E, F 6+C(E,F) Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, E 6 Step 7: Extend newly found least cost path F’s neighbors are B, D and F A,B,C, F, E, B 6+C(E,B) A,B,C, F, E, D 6+C(E,D) A,B,C, F, E, F6+C(E,F) Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, D 9 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, B A,B,C, F, E, D A,B,C, F, E, F Step 8: Clean up candidate list 1: remove candidate paths with the same end A,B,C,F,E,D has lower cost than A,B, C, D Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, B A,B,C, F, E, D A,B,C, F, E, F Step 8: Clean up candidate list 1: remove candidate paths with the same end A,B,C,F,E,D has lower cost than A,B, C, D Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, B A,B,C, F, E, D A,B,C, F, E, F Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,C,F,E,B and A, B, C, F,E,F Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, D 7 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,C,F,E,B and A, B, C, F,E,F Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, D 7 Step 10: keep on going Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, D 7 Step 5: A,B,C,F,E,D has the least cost Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, D 7 Step 6: move newly found least cost path Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, D 7 Step 6: move newly found least cost path A,B,C, F, E, D 7 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 Step 6: move newly found least cost path A,B,C, F, E, D 7 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, D 7 Step 7: Extend newly found least cost path D’s neighbors are A, C and E A,B,C, F, E, D,A 19 A,B,C, F, E, D,C 13 A,B,C, F, E, D,E 8 Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, D 7 A,B,C, F, E, D,A 19 A,B,C, F, E, D,C 13 A,B,C, F, E, D,E 8 Step 8: Clean up candidate list 1: Nothing to do Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, D 7 A,B,C, F, E, D,A 19 A,B,C, F, E, D,C 13 A,B,C, F, E, D,E 8 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,C,F,E,D,A, A, B, C, F,E,D,C and A,B,C,F,E,D,E Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, D 7 Step 9: Clean up candidate list 2: remove candidate paths with the same ends already in least cost paths Remove A,B,C,F,E,D,A, A, B, C, F,E,D,C and A,B,C,F,E,D,E Dijsktra’s Algorithm from Router A

A B E C D F 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 Let u be the router running this algorithm 1 Initialization: 2Candidate paths CP = [0, {u}] 3Least cost paths = empty 4Loop 5find path [a, {u, …, w}] in CP with the least cost 6Move [a, {u, …, w}] to shortest paths 7Extend w and place extensions in CP: For each neighbor v of w make new candidate path [a+c(w,v), {u,…, w,v}] 8Clean 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 9Clean up candidate paths 2: Remove candidate paths that have a destination that is already in the list of shortest paths 10If candidate paths is empty, then stop Least costs paths Cost Candidate paths Cost A 0 A,B 1 A,B,C 3 A,B,C, F 4 A,B,C, F, E 6 A,B,C, F, E, D 7 Step 10: DONE! Dijsktra’s Algorithm from Router A

Dijkstra’s algorithm, discussion Algorithm complexity: n nodes r each iteration: m Need to check all entries in candidate list, at most N comparisons m Need to extend best path, at most N extensions m Need to compare each entry to all entries in the candidate list (at most N) m Need to compare each entry in candidate list to each entry in shortest paths (N/2) r 3.5N each iteration, so 3.5N^2 ~ O(N^2) r more efficient implementations possible: O(nlogn) Oscillations possible: r e.g., link cost = amount of carried traffic A D C B 1 1+e e 0 e A D C B 2+e e 1 A D C B 0 2+e 1+e A D C B 2+e 0 e 0 1+e 1 initially … recompute routing … recompute