22-Elec-B4 Information Technology Networks · Undated paper
Question 4 of 5: Shortest-Path Routing — Bellman-Ford from Node H
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
Notes on this paper
Paper format. National Examinations, May 2019 —
16-Elec-B4 Information Technology Networks. Three hours, closed book (one
approved Casio or Sharp calculator). Five questions of 25 marks; any four
constitute a complete paper worth 100 marks. Marks are printed in the left
margin. All five questions are solved below, because the set is a study resource
rather than an exam script.
Reference texts.
A. Leon-Garcia and I. Widjaja, Communication Networks: Fundamental Concepts
and Key Architectures, 2nd ed. — the syllabus reference for this code
(layering ch. 2, MAC ch. 6, TCP ch. 8, routing ch. 7).
J. F. Kurose and K. W. Ross, Computer Networking: A Top-Down Approach,
7th ed. — TCP congestion control (§3.7), distance-vector routing (§5.2).
A. S. Tanenbaum and D. J. Wetherall, Computer Networks, 5th ed. —
OSI model (§1.4), CSMA/CD and the Ethernet slot time (§4.2–4.3).
T. S. Rappaport, Wireless Communications: Principles and Practice, 2nd ed.
— frequency reuse and cell capacity (ch. 3).
S. Sesia, I. Toufik and M. Baker, LTE — The UMTS Long Term Evolution,
2nd ed. — OFDMA, the resource grid and reference signals (ch. 6, 8).
Check: one edge of the Question 4 graph. The printed drawing
carries a weight label “1” centred on the A–B chord, but the line itself is not drawn. Every other weight label sits
on a drawn edge, and eleven labels are printed against ten surviving lines. The
edge A–B = 1 is therefore taken as present. Reading A–B as absent
instead would leave A a leaf reachable only through C, changing
d(A) from 4 to 9 and leaving the printed “1” orphaned.
Question 4: Shortest-Path Routing — Bellman-Ford from Node H (25 marks)
The printed network for Question 4. Eight nodes, eleven undirected edges; the source is node H.
Given. The undirected weighted graph above, read from the printed
figure:
Edge
Cost
Edge
Cost
Edge
Cost
A–B
1
C–E
2
E–G
2
A–C
5
D–F
2
F–G
2
B–D
2
E–F
1
F–H
1
B–E
1
G–H
3
Eleven edges over eight nodes; all costs positive. Source node: H.
Find. The least-cost path from H to every other node, obtained by
the Bellman-Ford algorithm, with the work shown iteration by iteration.
Approach. Initialise the distance estimate of the source to zero
and of every other node to infinity, then repeatedly sweep the whole edge list
applying the relaxation test $d(v) \leftarrow \min\{d(v),\,d(u) + w(u,v)\}$ in both
directions of each undirected edge, until a complete sweep changes nothing. With
$|V| = 8$ nodes, at most $|V| - 1 = 7$ sweeps can be needed.
State the algorithm being applied. Bellman-Ford maintains a
distance estimate $d(v)$ and a predecessor $p(v)$ for every node. It does not
maintain a set of “settled” nodes, and it does not choose the
cheapest unvisited node next — that is Dijkstra. Every iteration relaxes
every edge:
$$\text{if } d(u) + w(u,v) < d(v) \;\text{ then }\;
d(v) \leftarrow d(u) + w(u,v), \quad p(v) \leftarrow u .$$
Because the graph is undirected, each listed edge is relaxed in both directions. After
$k$ complete iterations, $d(v)$ is guaranteed correct for every node whose shortest
path from H uses at most $k$ edges — that is the invariant the marks are
for.
Initialise. $d(\mathrm{H}) = 0$ and $d(v) = \infty$ for all
other $v$; every predecessor is undefined. Fix an edge-relaxation order for the
sweeps — alphabetical by edge, as listed in the Given table — so that the
work is reproducible.
Iteration 1 (paths of at most one edge). Only edges incident on H
can relax, because every other node still has $d = \infty$. Edge F–H gives
$d(\mathrm{F}) = 0 + 1 = 1$ with $p(\mathrm{F}) = \mathrm{H}$; edge G–H gives
$d(\mathrm{G}) = 0 + 3 = 3$ with $p(\mathrm{G}) = \mathrm{H}$. Within the same sweep,
later edges may already exploit these: D–F gives
$d(\mathrm{D}) = 1 + 2 = 3$ and E–F gives $d(\mathrm{E}) = 1 + 1 = 2$, and then
B–E gives $d(\mathrm{B}) = 3$ and C–E gives $d(\mathrm{C}) = 4$. The
table below records the estimate at the end of each sweep.
Iteration 2 and the sweeps that follow. The second sweep relaxes
A–B, giving $d(\mathrm{A}) = d(\mathrm{B}) + 1 = 4$ with
$p(\mathrm{A}) = \mathrm{B}$; it also tests A–C, which offers
$d(\mathrm{C}) + 5 = 9$ and is rejected as worse. Every other test in the sweep fails
to improve anything: F–G offers $d(\mathrm{F}) + 2 = 3$, which merely ties the
existing $d(\mathrm{G}) = 3$; E–G offers $2 + 2 = 4$, worse; B–D offers
$3 + 2 = 5$ against the established 3. The third sweep changes nothing, which is the
algorithm's termination condition.
The relaxation table. Distance estimates at the end of each
sweep (a dash is $\infty$):
Iteration
A
B
C
D
E
F
G
H
0 (init)
—
—
—
—
—
—
—
0
1
—
3
4
3
2
1
3
0
2
4
3
4
3
2
1
3
0
3 (no change)
4
3
4
3
2
1
3
0
Two sweeps suffice here, well inside the guaranteed bound of seven, because no
shortest path from H uses more than four edges. A third sweep is still required to
prove convergence — and, in the general case, a further sweep that
still improved something would reveal a negative-cost cycle. All weights here are
positive, so none exists.
Read the paths back through the predecessors. Following
$p(\cdot)$ from each node back to H, and re-adding the edge costs independently as a
check:
$$\boxed{\begin{aligned}
d(\mathrm{F}) &= 1 &&: \mathrm{H}\!-\!\mathrm{F} \\
d(\mathrm{E}) &= 2 &&: \mathrm{H}\!-\!\mathrm{F}\!-\!\mathrm{E} \\
d(\mathrm{B}) &= 3 &&: \mathrm{H}\!-\!\mathrm{F}\!-\!\mathrm{E}\!-\!\mathrm{B} \\
d(\mathrm{D}) &= 3 &&: \mathrm{H}\!-\!\mathrm{F}\!-\!\mathrm{D} \\
d(\mathrm{G}) &= 3 &&: \mathrm{H}\!-\!\mathrm{G} \\
d(\mathrm{C}) &= 4 &&: \mathrm{H}\!-\!\mathrm{F}\!-\!\mathrm{E}\!-\!\mathrm{C} \\
d(\mathrm{A}) &= 4 &&: \mathrm{H}\!-\!\mathrm{F}\!-\!\mathrm{E}\!-\!\mathrm{B}\!-\!\mathrm{A}
\end{aligned}}$$
Check the result and note the ties. Node G is a genuine tie:
the direct edge H–G costs 3 and the route H–F–G also costs
$1 + 2 = 3$, so which one appears depends only on the order in which the edges were
relaxed — both are correct answers and either should be stated. Node D is
reached through F for 3, not through B for $3 + 2 = 5$. Node A is reached through B
for 4 rather than by the direct A–C–E route, which costs
$4 + 5 = 9$. The seven tree edges sum to
$1 + 3 + 1 + 2 + 1 + 2 + 1 = 11$, and every node is attached exactly once, confirming
a spanning tree on eight nodes.
The shortest-path tree from H produced by the algorithm (heavy edges), total weight 11. H–G is shown as the tree edge to G; H–F–G ties it at cost 3.
Final results.
Destination
Least cost from H
Path
Predecessor
A
4
H–F–E–B–A
B
B
3
H–F–E–B
E
C
4
H–F–E–C
E
D
3
H–F–D
F
E
2
H–F–E
F
F
1
H–F
H
G
3
H–G (ties with H–F–G)
H
H
0
—
—
Total weight of the shortest-path tree: 11. Sweeps required: 2 to converge, 3 to
prove convergence.