3 2. 2 1 3 . 1 LO

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Dijkstra’s algorithm computes the least-cost path from one node (the source, which we will refer to as ?u) to all other nodes in the network.  Dijkstra’s algorithm is iterative and has the property that after the k-th iteration of the algorithm, the least-cost paths are known to k destination nodes, and among the least-cost paths to all destination nodes, these k paths will have the k smallest costs.

Let

-      D(v): cost of the least-cost path from the source node to destination ?v as of this iteration of the algorithm.

-      p(v): previous node (neighbor of v) along the current least-cost path from the source to v.

-      N′: a subset of nodes; v is in N′ if the least-cost path from the source to ?v is definitely known.

The centralized routing algorithm consists of an initialization step followed by a loop. The number of times the loop is executed is equal to the number of nodes in the network. Upon termination, the algorithm will have calculated the shortest paths from the source node ?u to every other node in the network.

Algorithm: (in the picture below)

Example: Given the following graph, the shortest paths of to node v,w,x,y, and z from node u in the view point of node u are computed as follows: (in the 2nd picture)

1.    Initialization: the currently known least-cost paths from u to its directly attached neighbors.

2.    Step 1: we look among those nodes not yet added to the set N′ and find that node with the least cost as of the end of the previous iteration. That node is x, with a cost of 1, and thus x is added to the set N′.  Then we determine how to reach every node via x and see if we can improve the cost (get lower cost).  The cost from u to v is unchanged (going to v via x has higher cost compare to go from u to v directly).  The cost from u to w is updated because ?u can reach w via x has lower cost than going from u to w directly.

3.    Step 2 : nodes v and ?y are found to have the least-cost paths (value 2).   Then we add y to the set N′so that N′ now contains u,x and y. The cost to the remaining nodes not yet in N′, that is, nodes v,w and z, are updated

4.    And so on for step 3, 4, 5, until no path to node can be updated or run out of nodes in ?N.

Task: implement Dijkstra’s algorithm and display this table for any node in this graph. 

1 Initialization:
2 N' = {u}
3 for all nodes v
if v is a neighbor of u
c (u,
4
then D(v) = c(u, v)
6.
else D(v) =
00
7
8 Loop
9.
find w not in N’ such that D(w) is a minimum
10
add w to N'
update D(v) for each neighbor v of w and not in N':
D(v) = min (D(v), D(w)+ c(w, v) )
11
12
13
/* new cost to v is either old cost to v or known
14
least path cost to w plus cost from w to v */
15 until N'= N
Transcribed Image Text:1 Initialization: 2 N' = {u} 3 for all nodes v if v is a neighbor of u c (u, 4 then D(v) = c(u, v) 6. else D(v) = 00 7 8 Loop 9. find w not in N’ such that D(w) is a minimum 10 add w to N' update D(v) for each neighbor v of w and not in N': D(v) = min (D(v), D(w)+ c(w, v) ) 11 12 13 /* new cost to v is either old cost to v or known 14 least path cost to w plus cost from w to v */ 15 until N'= N
5
3
2
2
1
3.
1
2.
Transcribed Image Text:5 3 2 2 1 3. 1 2.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY