You are on page 1of 13

EE 706 Communication Networks

Homework 4 Solutions
Indian Institute of Technology Bombay

Kurose and Ross (6th edition)


P28

1
P29
The algorithm runs synchronously (that is, in one step, all nodes compute their
distance tables at the same time and then exchange tables). Let d be the “diameter”
of the network - the length of the longest path without loops between any two nodes
in the network. Using the reasoning above, after d - 1 iterations, all nodes will know
the shortest path cost of d or fewer hops to all other nodes. Since any path with
greater than d hops will have loops (and thus have a greater cost than that path
with the loops removed), the algorithm will converge in at most d - 1 iterations.

P30
a) Dx(w) = 2, Dx(y) = 4, Dx(u) = 7
b) First consider what happens if c(x,y) changes. If c(x,y) becomes larger or
smaller (as long as c(x, y) >= 1) , the least cost path from x to u will still have cost
at least 7. Thus a change in c(x,y) (if c(x, y) >= 1) will not cause x to inform its
neighbors of any changes.
If c(x,y)=µ < 1, then the least cost path now passes through y and has cos t
µ + 6.
Now consider if c(x,w) changes. If c(x,w) = σ <= 1, then the least-cost path
to u continues to pass through w and its cost changes to 5 + σ ; x will inform its
neighbors of this new cost. If c(x,w) =σ > 6, then the least cost path now passes
through y and has cost 11; again x will inform its neighbors of this new cost.
c) Any change in link cost c(x,y) (and as long as c(x, y) >= 1) will not cause x
to inform its neighbors of a new minimum-cost path to u

2
P31

3
P32
NO, this is because that decreasing link cost won’t cause a loop (caused by the next-
hop relation of between two nodes of that link). Connecting two nodes with a link
is equivalent to decreasing the link weight from infinite to the finite weight.

P34
a)

b) Yes, there will be a count-to-infinity problem. The following table shows the
routing converging process. Assume that at time t0, link cost change happens. At
time t1, y updates its distance vector and informs neighbors w and z. In the following
table, → stands for informs.

4
We see that w, y, z form a loop in their computation of the costs to router x. If
we continue the iterations shown in the above table, then we will see that, at t27,
z detects that its least cost to x is 50, via its direct link with x. At t29, w learns
its least cost to x is 51 via z. At t30, y updates its least cost to x to be 52 (via w).
Finally, at time t31, no updating, and the routing is stabilized.

c) Cut the link between y and z.

P52
After 1 step 3 copies are transmitted, after 2 steps 6 copies are transmitted. After
3 steps, 12 copies are transmitted, and so on. After k steps, 3 ∗ 2k−1 copies will be
transmitted in that step.

5
Questions from Bertsekas and Gallager
P5.1
The Prim-Dijkstra Algorithm Arbitrarily select node e as the initial fragment. Arcs
are added in the following order: (d,e), (b,d), (b,c) tie with (a,b) is broken arbi-
trarily,(a,b),(a,f). Kruskal’s Algorithm Start with each node as a fragment. Arcs
are added in the following order: (a,f), (b,d), (a,b) tie with(b,c) is broken arbitrar-
ily,(b,c), (d,e). The weight of the MST in both cases is 15.

P5.2
The Bellman-Ford Algorithm
By convention, D1 h = 0 , for all h. Initially Di 1 = d1i , all i̸=1. For each
successive h≥1 we compute Di h+1 = min[Dj h + dji ] , for all i̸=1. The results are
summarized in the following table.

The arcs on the shortest path tree are computed after running the Bellman Ford
algorithm. For each i̸=1 we include in the shortest path tree one arc (j,i) that
minimizes Bellman’s equation.

6
Dijkstra’s Algorithm

P5.3
Pij is the probability that link (i, j) fails during the lifetime of a virtual circuit.
Let Pk be the probability that a path k = (A, i, ... ,j, B) remains intact. Since
links fail independently: Pk = (1 − pAi )...(1 − pjB ) We want Pk to be maximized
or −ln(Pk ) to be minimized, which turns out to be summation of probabilities, i.e.
most reliable path is the shortest path using weights given in question. It comes out
to be (A,C,E,D,G,B) with probability of path remaining intact as 0.913.

P5.4
Let the weights for arcs AB, BC, and CA be 1, 2, and 2, respectively. Then an MST
is AB,BC whereas the shortest path tree rooted at C is CA,CB

P5.5
(a) Routing can be completely specified by indicating link at which traffic changes
from clockwise to counterclockwise. The link always carries zero traffic in both
directions.
In this case, routing would be (2,3). Now subsequent routings are (4,5), (1,6) and
so on.
(b) We proceed as in (a) but add 1 to each length. With an initial routing
of (2, 3), subsequent routings are: (3,4), (2,3) .... The oscillations are damped as

7
compared to part (a), and a reasonable routing is always maintained. With an initial
routing of (1, 2), subsequent routings are: (4,5), (1,2) .... There are still undesirable
oscillations, but the situation is not quite as bad as in (a). With an initial routing
of (1, 6), subsequent routings are: (5,6), (1,6) .... For this initial condition, the
constant bias factor has had no effect on the oscillatory behavior. By symmetry, the
remaining three cases are equivalent to the above.
(c) Regardless of choice of α, node 3 reverses its routing at each iteration. So
best is oscillation between (2,3) and (3,4). To reduce oscillations with routing of
(1,6), node 5 must continue to route counterclockwise. Which requires 5α > α +
4 + ϵ. To reduce oscillations with routing of (1,2) node 4 must continue to route
counterclockwise. That is 4α + 1 > 2α + 5 + 2ϵ. For symmetry, the remaining
routing results in the same condition. Therefore, for values of α > 2 + ϵ, the routing
of all nodes except node 3 eventually remains constant.
(d) In this case, routings are (2,3), (4,5), (1,6), (4,5), (2,3), (2,3), (2,3), . . . , (2,3),
(3,4), (2,3), (3,4), (2,3), . . . . Thus, oscillations are damped due to averaging.

8
P5.7
By definition of hi and ji , we have:

Dihi = di,ji + Djhii −1 . (1)

Assume, to reach a contradiction, that:

hji ≥ hi . (2)

By (2) and the definition of hji , we get:


hj
Dji i < Djhii −1 . (3)

Now:
hji +1 hj
Di ≤ di,ji + Dji i
< di,ji + Djhii −1
= Dihi .

Thus:
hji +1
Di < Dihi . (4)
Equations (2) and (4) contradict the fact that hi is the largest h such that Dih ̸= Dih−1 .
Hence:
hi > hji , ∀i. (5)
Now, start from any node i, take the edge to ji , then take the edge from ji to jji ,
then the edge from jji to jjji and so on. Suppose some node is repeated before we
reach node 1, i.e., a cycle forms. Suppose this cycle is i1 , i2 , . . . , ik , i1 . Then by (5):

hi1 > hi2 > . . . > hik > hi1 ,

which is a contradiction. Thus, a cycle cannot form and the above sequence of edges
is a path from node i to node 1. Also, the subgraph consisting of the edges (i, ji ) for
i ̸= 1 has N − 1 edges, where N is the number of nodes in the network. So it is a
spanning tree of paths to node 1. Let i1 , i2 , i3 , . . . , ik = 1 be the path from a node
i1 to node 1 in this spanning tree. Then Dhij = dij ,ij+1 + Dhij+1 for j = 1, . . . k − 1.
Adding these equations, we get that Dhi1 (which is the shortest path cost from i1 ) is
the cost of the path from i1 to 1 in the above spanning tree. So the above spanning
tree is a spanning tree consisting of shortest paths.

9
P5.9 (first part)
Let G be the given graph. There must exist at least one node with no incoming
edge. (Otherwise, we could start from any node, say v1 , follow an incoming edge to
reach v2 , then follow an incoming edge from v2 to reach v3 and so on until we got a
directed cycle.)
Number one such node as N . Let G1 be the graph obtained by removing node
N and all its outgoing edges from G. Again, there must be at least one node in G1
with no incoming edge in G1 . Number one such node as N − 1. We then remove
node N − 1 and all its outgoing edges from graph G1 to get graph G2 and so on until
all the nodes in G are numbered.
(Since it is assumed that there exists at least one path from each node to node
1, node 1 will retain its number after the above renumbering.)
Suppose to reach a contradiction that with the above numbering, i > j and there
is an edge from node j to node i. During the above construction procedure, just
before node i was removed, node j was present in the remaining graph since i > j.
So edge (j, i) (an incoming edge to i) was present, which contradicts the fact that
there was no incoming edge to i when it was removed.

P5.10
(a) Let B be the lower bound on the arc lengths. Each node i ( i not belonging to
P) with Di ≤ min(Dj ) + B(jnotbelongingtoP ) could be added to P. This is because
the inductive argument which proved Dijkstra’s algorithm required that each node
added to P must have a shortest path for which all but the final node lie in P. This
must be true for each node i which meets the above condition, since any path which
included another node not in P would have a length of at least Di .
(b) Suppose the edge whose cost increases is from node i to node j. Consider the
shortest path tree obtained after running Dijkstra’s algorithm with the original link
costs. Note that if the link (i, j) is not in this tree, then the shortest paths remain
unchanged. Now assume that (i, j) is in this tree.
Note that only the shortest paths from i and all of i’s descendents in this tree
can possibly change after the link cost increase. Put all other nodes in the set P , the
set of permanently labeled nodes (in the terminology of Bertsekas and Gallager, pp.
401-402). Also, for every node k ∈ / P , let Dk = minm∈P (dkm + Dm ). Then, calculate
the new shortest paths from the nodes not in P proceeding similar to Dijkstra’s
algorithm (see Steps 1 and 2 in Bertsekas and Gallager, pp. 401-402).

10
Problem 3
In Fig. 1, node u is the destination. The count-to-infinity problem occurs if the cost
of edge (x, u) increases from 1 to 1000.

Figure 1: The figure for Problem 3.

Problem 4
(a) The cost of any spanning tree T ′ in G with
P
P edge costs {c(e)P: e ∈ E} is e∈T ′ c(e)
and with edge costs {c(e)+k : e ∈ E} is e∈T ′ [c(e)+k] = e∈T ′ c(e)+(|N |−1)k,
where |N | is the number of nodes in G and the equality holds because every
P exactly |NP
spanning tree has |−1 edges. If T is a MST in G with edge costs {c(e) :

e ∈ E}, then e∈T c(e) ≤ e∈T P′ c(e) for every spanning
P tree T in G. Adding
(|N |−1)k to both sides, we get e∈T c(e)+(|N |−1)k ≤ e∈T ′ c(e)+(|N |−1)k for
all T ′ in G. This shows that T is a MST in G with edge costs {c(e) + k : e ∈ E}.
The above proof with −k in place of k shows the converse: if T is a MST in
G with edge costs {c(e) + k : e ∈ E}, then it is a MST in G with edge costs
{c(e) : e ∈ E}.

(b) Consider the graph G in Fig 2. (v, w, u) is a shortest path from v to u in G with
the edge costs indicated in the figure. It is a shortest path in G with k added to
every edge cost if and only if k ≤ 1.

11
Figure 2: The figure for Problem 4(b).

Problem 5
True.
The proof is similar to the proof of optimality of Dijkstra’s algorithm for the case
where all edge costs are non-negative, which was discussed in class. In particular,
see the Key Lemma on slide 13 of the lecture slides of Feb. 27. Part (a) now changes
to the following: “D(s) ≤ D(t) for all s ∈ N ′ \{u} and t ∈ / N ′ ”. Part (b) remains
unchanged. The Key Lemma with these modifications can be shown by induction as
before.

Problem 6
We proceed as in the hint. Let T ∗ be the unique MST in graph G. Assume, to
reach a contradiction, that the algorithm removes one or more edges from T ∗ , and
let e be the first such edge removed. T ∗ \{e} is a subgraph of G that consists of
two sub-trees of G, say T1 and T2 , disconnected from each other. Just before the
algorithm removed e, there must have been an edge, say f , from a node in T1 to a
node in T2 in the remaining graph. (Otherwise the removal of e would disconnect
the graph.) Also, the cost of f is less than the cost of e. (Otherwise the algorithm
would have removed f instead of e.) Let T = T ∗ ∪ {f }\{e}. It is a spanning tree
with cost less than T ∗ , which is a contradiction.

Problem 7
Since c(v, u) ≥ D∗ (v) for all v, D(v) ≥ D∗ (v) after initialization. Consider the first
time that D(v) decreases below D∗ (v) for some node v. This happens when node v
executes an update. So upon execution of this update:

D(v) = min(c(v, w) + D(w)) < D∗ (v).


w

12
Now, D(w) ≥ D∗ (w) for all w ̸= v when the above update was executed. So:

D∗ (v) > min(c(v, w) + D(w)) ≥ min(c(v, w) + D∗ (w)) = D∗ (v),


w w

which is a contradiction. The result follows.

13

You might also like