You are on page 1of 4

COSC6397 Homework Assignment 3

September 22, 2004

1 Part 1: Routing
1. Find the shortest path tree from every node to node 1 for the graph
of Fig.1 using the Bellman-ford and Dijkstra algorithms.
10
2 5
3 6 2
4

4
1 6 4 3 2 7
3
4 3
5 2

3 6
9

Figure 1: Graph for Problem 1

Solution:
(h)
The Bellman-Ford Algorithm Let Cl be the cost from node l to
(h) (1)
node 1 at the hth iteration. C1 = 0, for all h. Initially C1 = d1i , for
(h+1) (h)
all i 6= 1. For each successive h ≥ 1 we compute C i = minj [Cj +
dji ], for all i 6= 1. The results are summarized in Table 1.
The arcs on the shortest path tree are computed after running the
Bellman-Ford algorithm. For each i 6= 1 we include in the shortest
path tree one arc (j, i) that minimizes Bellman’s equation.

Dijkstra’s Algorithm Refer to the algorithm description in the


text. Initially: D1 = 0; Di = d1i for i 6= 1; P = {1}. The state after
each iteration is shown in Table 2. P is not shown but can be inferred
from i. Only the Dj ’s which are updated at each step are shown.

1
Table 1: Bellman-Ford Algorithm
i Ci1 Ci2 Ci3 Ci4 Ci5 Shortest path arcs†
1 0 0 0 0 0
2 4 4 4 4 4 (1, 2)
3 5 5 5 5 5 (1, 3)
4 ∞ 7 7 7 7 (2, 4)
5 ∞ 14 13 12 12 (6, 5)
6 ∞ 14 10 10 10 (1, 2)
7 ∞ ∞ 16 12 12 (1, 2)

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

Table 2: Dijkstra’s Algorithm


Iteration i D 1 D2 D3 D4 D5 D6 D7 Arc Added
Initial 0 4 5 ∞ ∞ ∞ ∞
1 2 5 7 14 ∞ ∞ (1, 2)
2 3 7 14 14 ∞ (1, 3)
3 4 13 10 ∞ (2, 4)
4 6 12 12 (4, 6)
5 5 12 (6, 5)
6 7 (6, 7)

2
1 2 1 2

5
4
3 3
4

(a) Without Suppression (b) With Suppression

Figure 2: Suppression vs. No Suppression

2. Consider a connected network with topology G(V, E), where V is the


set of vertices and E the edges. |V | and |E| gives the number of
vertices and edges respectively. Analyze the number of messages of the
flooding protocol with sequence number under i) wired connectivity
and ii) wireless connectivity (assuming broadcast medium such that
one transmission can reach all neighboring nodes).
Solution:
With wired connectivity, when a node first receives a message, it du-
plicates the message and transmits it to all the out-going interfaces
except the one(s) the message comes from. Let us consider two cases.

• No suppression In this case, when a node first receives a mes-


sage, it forwards the message to all interfaces except the one the
message comes from (an example is given in Figure 2(a)). The
total number of message is thus, 2|E| − |V | + 1.
• With suppression In this case, when a node first receives a mes-
sage, it waits for a period of time and forwards the message to all
interfaces that it has not received the message from (an example
is given in Figure 2(b)). Since only one message is transmitted
per edge, we have the total number of messages as |E|. Clearly,
with suppression, the number of messages can be reduced.

With wireless connectivity, the key difference is that a single message


transmission can reach all neighboring nodes (under the assumption
that there is no collision in the network).

3
(a) one message transmission (b) two message transmissions

Figure 3: Effect of Choice of Originator. Dark nodes are originators of the


message.

• No suppression Since each node only transmit the message


once, the total number of messages (transmissions) is |V |.
• Suppression In this case, a node does not transmit if it is a
leaf node in the spanning tree rooted at the originator. However,
since the number of leaf nodes is dependent upon how the tree is
constructed, the number of leaf nodes may vary. However, the no
suppression case provides an upper bound. An example is given
in Figure 3.

You might also like