You are on page 1of 9

ASSOSA UNIVERSITY

SCHOOL OF POST-GRADUATE STUDIES


COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
Advanced-Data Communication and Networking (ECEg-6044)

ASSIGNMENT: II

By: -
Habtamu Demera
Abraham Gadissa
Muluken Yadessa
Mitiku Kelemwork

Submitted to: - Girma Beka (PhD.)

Oct,2023
Assosa, Ethiopia
1. Compare Dijkstra’s algorithm and Bellman Foard algorithm in terms of ;
a) Robustness: what happens if router malfunctions?
b) Speed of convergence: running time it takes to converge

Ans:-

a) In case of Robustness:

i) Dijkstra's Algorithm:

Relies on the assumption that all routers are functioning correctly. If a router malfunctions or fails
during the execution of Dijkstra's algorithm, it may lead to incorrect or incomplete results. This is
because Dijkstra's algorithm assumes that all edges have non-negative weights, and a
malfunctioning router may introduce negative weights or disrupt the connectivity of the network.
Dijkstra's algorithm may still produce a result or may get stuck in an infinite loop, depending on
the implementation. In either case, the output path may not be accurate.

ii) Bellman-Ford Algorithm:

The Bellman-Ford algorithm is more robust in the face of router malfunctions. It can handle routers
that malfunction or fail during the execution. This is because the algorithm iteratively relaxes all
the edges in the network, allowing it to detect negative weight cycles and handle them
appropriately. If a router malfunctions, the algorithm will still converge but may produce
suboptimal or incorrect paths.

b) in case of Speed of Convergence:

 Dijkstra's algorithm has a relatively faster convergence speed compared to the Bellman-Ford
algorithm in networks without negative-weight edges or cycles.
 Its time complexity is O((V + E) log V) when implemented with a min-priority queue, where V is
the number of vertices and E is the number of edges. However, in the presence of negative-weight
edges, Dijkstra's algorithm cannot guarantee correct results, and it may exhibit slow convergence
or fail to converge. Whereas The Bellman-Ford algorithm has a slower convergence speed
compared to Dijkstra's algorithm.
 It has a time complexity of O(VE), where V is the number of vertices and E is the number of edges.
 The algorithm iterates over all the edges in each iteration, relaxing them to find the shortest paths.
However, the advantage of the Bellman-Ford algorithm is its ability to handle graphs with
negative-weight edges and detect negative weight cycles, which Dijkstra's algorithm cannot handle
without modifications.
Bellman Ford’s algorithm and Dijkstra’s algorithm both are:-

 Single-source shortest path algorithm, i.e. both determines the shortest distance of each vertex of
a graph from a single source vertex. However, there are some key differences between them. We
follow the Dynamic Programming approach in Bellman Ford’s algorithm and Greedy approach in
Dijkstra’s algorithm.

o Let us see the other major differences between these two techniques-

 Bellman Ford’s Algorithm works when, there is negative weight edge, it also detects the negative
weight cycle. The result contains the vertices, which contains the information about the other
vertices they are connected to
 Dijkstra’s Algorithm does not work when there is negative weight edge. The result contains the
vertices containing whole information about the network, not only the vertices they are connected
to etc…

Consequently, we can summarize that,

Dijkstra's algorithm is faster in networks without negative-weight edges or cycles, but it is less
robust in the face of router malfunctions. On the other hand, the Bellman-Ford algorithm is more
robust and can handle malfunctions but has a slower convergence speed. The choice between the
two algorithms depends on the specific requirements and characteristics of the network being
analyzed.
2. Based on the given figure find the least cost path to send data from node A to all other
nodes
a) Using Dijkstra’s algorithm
b) Using Bellman Foard algorithm
c) Consider node C goes down and repeat a and b

SOLUTION

A. Using Dijkstra's algorithm:

Step M D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E)


0 {A} 5,A 2,A 3,A ∞
1 {AC} 5,A 3,A 6,C
2 {ACD} 5,A 6,C
3 {ACDB} 6,C
4 {ACDBE}

Resulting shortest-path tree is:

The resulting forwarding table is:

Destination Link
B (A,B)
C (A,C)
D (A,D)
E (A,C)
B. Using the Bellman-Foard algorithm:

Node A Table
Iteration 1 Iteration 2
From Node A From Node A
To Cost Next To Cost Next
A 0 A A 0 A
B 5 B B 5 B
C 2 C C 2 C
D 3 D D 3 D
E ∞ - E 6 C

The resulting shortest path tree is:

The resulting forwarding table is:


Destination Link
B (A,B)
C (A,C)
D (A,D)
E (A,C)
Or
We can show for each table as following
C. Consider node C goes down

Using Dijkstra's algorithm:

Step M D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E)


0 {A} 5,A ∞ 3,A ∞
1 {AD} 5,A ∞ ∞
2 {ADB} ∞ 8,B
3 {ADBE} ∞
4 {ADBE} ∞

Using Bellman-Foard algorithm:

Iteration 1 Iteration 2 Iteration 3


From Node From Node From Node
A A A
To Cost Next To Cost Next To Cost Next
A 0 A A 0 A A 0 A
B 5 B B 5 B B 5 B
C ∞ - C ∞ - C ∞ -
D 3 D D 3 D D 3 D
E ∞ - E 8 B E 8 B

If node C goes down, we need to recalculate the least-cost path using Dijkstra's algorithm or the
Bellman-Ford algorithm without considering node C as its path learned by A, B and E is infinity.

Thus the resulting least-cost paths in both cases are not convergent, and hence there is a count to
infinity problem.

Therefore, we just generalized the points…

Suppose that there is no path between C, node C now advertises this route with a distance of
infinity.

 Node A must not ignore this value even though its old entry is smaller.
 The old route does not exist anymore.
 The new route has a distance of infinity.
Thank you!

You might also like