22-Elec-B4 Information Technology Networks · December 2015
Question 5 of 5: Shortest-path routing (25 marks)
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
Notes on this paper
Paper format. Professional Engineers of Ontario, Annual Examinations — December 2015, 07-Elec-B4 Information Technology Networks. Three hours, closed book, a PEO-approved non-programmable calculator permitted. Five questions; any four constitute a complete paper worth 100 marks, and marks are printed in the left margin against each sub-part. All five questions are solved here, because the set is a study resource rather than an exam attempt.
Reference texts.
A. Leon-Garcia and I. Widjaja, Communication Networks: Fundamental Concepts and Key Architectures, 2nd ed., McGraw-Hill — the syllabus text for this paper (medium access, transport, routing).
J. F. Kurose and K. W. Ross, Computer Networking: A Top-Down Approach, 8th ed., Pearson — TCP congestion control and link-state routing.
A. S. Tanenbaum and D. J. Wetherall, Computer Networks, 5th ed., Pearson — MAC protocols, 802.11 and Bluetooth.
W. Stallings, Data and Computer Communications, 10th ed., Pearson — LAN standards and framing.
T. S. Rappaport, Wireless Communications: Principles and Practice, 2nd ed., Prentice Hall — the cellular concept, frequency reuse and MIMO fundamentals.
IEEE Std 802.11-2020 and IEEE Std 802.3-2022 for the normative timing parameters quoted below.
Given. An undirected network of seven nodes A to G and ten weighted edges, read from the figure printed with the question:
Given data — edge lengths
Edge
Length
Edge
Length
Edge
Length
A–B
1
C–D
1
E–F
1
A–C
2
C–F
2
E–G
1
A–D
2
D–F
1
F–G
3
B–E
5
Source node: B
Find. The least-cost path and its total length from node B to each of A, C, D, E, F and G, obtained by a correct execution of Dijkstra's algorithm with the working shown at every iteration.
[Figure not reproduced: The network as printed with the question: seven nodes, ten undirected edges, with the length marked on each edge. See the official exam paper.]
Approach. Maintain a set $S$ of nodes whose shortest distance is already known, together with a tentative label $d(v)$ for every other node; at each iteration move the unlabelled node of smallest label into $S$ and relax its edges.
Initialise. Put the source in the permanent set and label every other node with the direct edge from B if one exists, otherwise infinity:
$$S=\{B\},\quad d(B)=0,\quad d(A)=1,\quad d(E)=5,\quad d(C)=d(D)=d(F)=d(G)=\infty.$$
Only A and E adjoin B, so only those two labels are finite at the start.
Iteration 1 — make A permanent. The smallest tentative label is $d(A)=1$, so A joins $S$. Relaxing A's edges, the routes B → A → C and B → A → D each cost $1+2=3$, improving both labels from infinity:
$$d(C)\leftarrow3,\qquad d(D)\leftarrow3,\qquad S=\{B,A\}.$$
Iteration 2 — make C permanent. C and D are tied at 3; the algorithm may take either, and taking C first gives $S=\{B,A,C\}$. Relaxing C's edges, the route through C to D would cost $3+1=4$, which does not improve $d(D)=3$, while F is reached for the first time:
$$d(F)\leftarrow3+2=5,\qquad d(D)\ \text{unchanged at }3.$$
This is a useful check that the tie was harmless — D keeps the label it already had.
Iteration 3 — make D permanent. With $d(D)=3$ the smallest remaining, D joins $S$. Its edge to F now offers a cheaper route, so the tentative label improves:
$$d(F)\leftarrow\min(5,\ 3+1)=4\quad\text{via }B\rightarrow A\rightarrow D\rightarrow F.$$
Iteration 4 — make F permanent. $d(F)=4$ is now the smallest label outstanding. Relaxing F gives
$$d(E)\leftarrow\min(5,\ 4+1)=5,\qquad d(G)\leftarrow4+3=7.$$
The label on E is a genuine tie: the direct edge B–E and the path B → A → D → F → E both cost 5, so the shortest-path tree is not unique. Keeping the incumbent is the standard convention.
Iteration 5 — make E permanent. E enters with $d(E)=5$, and its edge of length 1 to G improves the last outstanding label:
$$d(G)\leftarrow\min(7,\ 5+1)=6\quad\text{via }B\rightarrow E\rightarrow G.$$
Note that the F–G edge of length 3, which produced the earlier label of 7, ends up on no shortest path at all.
Iteration 6 — make G permanent and stop. G joins $S$ with $d(G)=6$; every node is now permanent, so the algorithm terminates:
$$\boxed{d(A)=1,\ d(C)=3,\ d(D)=3,\ d(F)=4,\ d(E)=5,\ d(G)=6}$$
Dijkstra iteration table — tentative labels after each step (permanent labels in bold)
Step
Node made permanent
Permanent set S
d(A)
d(C)
d(D)
d(E)
d(F)
d(G)
0
B (source)
{B}
1
∞
∞
5
∞
∞
1
A (1)
{B,A}
1
3
3
5
∞
∞
2
C (3)
{B,A,C}
1
3
3
5
5
∞
3
D (3)
{B,A,C,D}
1
3
3
5
4
∞
4
F (4)
{B,A,C,D,F}
1
3
3
5
4
7
5
E (5)
{B,A,C,D,F,E}
1
3
3
5
4
6
6
G (6)
all
1
3
3
5
4
6
Tracing each predecessor back to the source recovers the routes themselves, which are what a router would actually install in its forwarding table.
The resulting shortest-path tree rooted at B, drawn heavy over the original network. The C-F and F-G edges carry no shortest path.