You are on page 1of 40

Simulation of Dijkstra Routing

Algorithm

Sriram Narayanan
BE- Electronics
Final Year
2002-03
CONTENTS

Chapter No. Title Page No.


List of Figures i
Abstract 1
1 Introduction 2
2 Literature Survey 3-5
3 Routing 6
3.1 Need for routing 6
3.2 Routing Principle 7
4 Routing Algorithm 8
4.1 Characteristics 8-9
4.2 Performance criteria 9
4.3 Classification 10-11
4.4 Routing Strategies 11-13
4.5 Types 13
5 Dijkstra Algorithm 14
5.1 Algorithm 14-15
5.2 Flowchart 16
5.3 Example 16-18
6 Problem Analysis & Implementation 19
6.1 Problem Analysis 19
6.2 Technique Used 20-21
6.3 Flowchart 22-23
6.4 Pseudo Code 24-25
7 Result Analysis 26-32
8 Conclusion 33
9 Reference 34
10.1 sugar LIST OF FIGURES

Chapter No. Figure Page No.

3.1 Graph 5
5.1 Structure 14
5.2 Flowchart (Dijkstra) 15
5.3 Network 16, 17
6.3 Flowchart for Implementation 22, 23
7 Physical Network 28, 32
Graphical Representation 29, 30, 31, 33
Of Shortest Path

Back to top
ABSTRACT

The complete network of large number of interconnected autonomous system, each of which
consists of a distinct domain, needs to communicate to different nodes to forward the
information. There are various means of communications between these systems. Routing is one
of them. Routing refers to the overall network wide process that determines end to end paths that
datagram will take from source to destinations. There are different routing algorithms available
such as BELLMAN FORD ALGORITHM which is decentralized routing algorithm and
DIJKSTRA ALGORITHM which is a global routing algorithm. In global routing algorithm,
each router has a complete view of the network, whereas in a decentralized routing algorithm
each router has a local view consisting of its directly attached neighbours. Out of this Dijkstra
Algorithm is mostly preferred as it is faster as compared to any other algorithm and its
implementation is easier. In this algorithm, router based information that has been collected from
other routers, builds a graph of the network which shows the locations & links of routers within
themselves & in the network. These links are labeled with a number called weight or cost. If
there are two links between a node and destination, the router chooses the link with the lowest
weight.

One of the chief advantages of Dijkstra Algorithm is that router computes routes
independently using the same original status data; they do not depend on the computation of
intermediate machines. Because link status messages propagate unchanged, it is easy to debug
problems. Because routers perform the route computation locally, it is guaranteed to converge.
Finally, because link status messages only carry information about the direct connections from a
single router, the size does not depend on the number of networks in the networks in the internet.
Thus, Dijkstra Algorithms scale better than distance vector algorithms. We have implemented
Dijkstra Algorithm for routing purpose.

Back to top
CHAPTER 1
INTRODUCTION

The Internet is one of the 20th century's greatest communications developments. It allows people
around the world to send E-Mail to one another in a matter of seconds. But none of these parts
would ever make it to our computer without a piece of the Internet that we've probably never
seen. In fact, most people have never stood "face to machine" with the technology most
responsible for allowing the Internet to exist at all: The Router. In order to transfer data from a
source host to the destination host, the network must determine the path or the route links
between source and destination. This can be achieved by using routers. The routers in a network
are responsible for receiving and forwarding packets through the interconnected set of networks.
In particular, the router must avoid the portion of network that has failed or has too much
congestion. At the heart of the router there is an algorithm which takes the dynamic decisions
and directs the datagrams from source to the destination. This is better known as Routing
Algorithm. Routing Algorithms are classified depending upon the technique they employ to
calculate the shortest path. Dijkstra Routing Algorithm is one of them.

Dijkstra Routing Algorithm was proposed by Dijkstra in 1959. It belongs to Link


State Routing Algorithm. While implementing Dijkstra Algorithm the router has the complete
knowledge of the network. It converges quickly and requires only N^2 computations. It is
comparatively easier to implement and comprehend. Here, Dijkstra Algorithm has been
implemented using ‘C’ language.

Back to top
19.2america CHAPTER 2
LITERATURE SURVEY

A Literature Survey was conducted to study the advancement made in the development of
Routing Algorithms.
Routing can be compared to the process of building graphs and directing the
datagrams from source to destination[12].To make such dynamic routing decisions router
exchange information using a special algorithm known as Routing Algorithm[10]. The Network
Graphs used in simulations are constructed by using the approach given in [1]. The Routing
Techniques can be sub-divided into following categories:

1) Fixed/Deterministic
2) Adaptive
3) Flooding
4) Multicasting
5) Hierarchical
6) Random

2.1 Fixed/Deterministic:

Practical multi-computers use Deterministic Routing [2]. Fixed Routing has been
widely used in practice due to its simplicity. However, message cannot take advantage of
alternative paths to avoid congested network regions. Dimension-Ordered Routing [3], [4] is a
typical example of deterministic routing where messages visit network dimensions in a
predefined order.
2.2 Adaptive:

Many fully Adaptive Algorithms, which overcome the performance limitations of


deterministic routing, have been proposed in the past few years [5], [6], [7].
For instance the concept of virtual channels has been generalized in [8] to develop deadlock-free
fully adaptive routing algorithms, which require (n+1)*2^(n-1) virtual channels per physical
channel in a k-ary n-cube.

2.3 Flooding:

Flooding is a Static type of routing in which every incoming packet is sent out on
every outgoing line except the one it arrived on [10]. Flooding is not practical in most
applications, but it does have some uses. For example, in military applications, where large
number of routers may be blown to bits at any instant, the tremendous robustness of flooding is
highly desirable.

2.4 Multicasting:

For some applications, widely-separated processes work together in groups.


Sending a message to such a group is called Multicasting, and its routing algorithm is called
Multicast Routing [15]. To do multicast routing, each router computes a spanning tree covering
all other routers in the subnet.
2.5 Hierarchical:

As Networks grow in size, the router’s routing tables grow proportionally. Not
only is router memory is consumed, but more CPU time is needed to scan them and more
bandwidth is needed to send status reports. This problem can be overcome by using Hierarchical
Routing [10], where the routers are divided into regions, with each router knowing all the details
about how to route packets to destinations within its own region, but knowing nothing about the
other region.

2.6 Random:

In case of Random Routing, a node selects only one outgoing path for retransmission
of an incoming packet. The outgoing link is chosen at random, excluding the link on which the
packet arrived [12]. It is further sub-divided into two categories: Distance Vector Routing
Algorithm and Link State Routing Algorithm [10], [12]. Bellman-Ford Routing Algorithm [10],
[12] is an example of the former while Dijkstra Routing Algorithm [10], [12], [13] belongs to
the latter. In the latter case the router has a complete view of the network, whereas for the former
each router only has a local view consisting of its directly attached neighbors.
It is the Dijkstra Routing Algorithm that we have implemented.

Currently research is going on for Routing Algorithms for Mobile Hosts where a user
wants to plug into a network at any time and any place [10].

Back to top
10.3 sugar CHAPTER 3
ROUTING

The term “Routing” refers to the overall, network wide process that determines end-to-end paths
that datagrams will take from source to destination. Using a driving analogy, we can think of
routing as the process of building maps and giving directions from source to destination. When
an end-to-end logical connection, consisting of a sequence of logical connections is to be set up,
each intermediate system in the sequence must make a routing decision that determines the next
hop in the sequence.
Back to top
3.1 Need for Routing:

A network is an interconnected set of nodes (with a network wide system of unique


addresses). In general there may be several different routes from one node to another. There is no
requirement for a direct connection between any two nodes. Any given node will have a direct
connection to one or more other nodes. If a node receives a packet addressed to a directly
connected node it will simply pass it to appropriate link driver software. If a node receives a
packet addressed to a node to which it has no direct connection it must solve the “routing
problem” to determine which node to send it to. A typical network is illustrated below:

NODE NODE NODE


X A B C
Y

NODE NODE

D E
Back to top
3.2 Routing Principle:
11.1 sugar
In order to transfer packets from source host to the destination host, the network layer must
determine the path, or route, that the packets are to follow. Whether the network layer provides
the datagram service (in which case different packets between a given source–destination pair
may take different route) or a virtual circuits service (in which case all packets between a given
source and destination will take the same path). In the above network node A may route a packet
addressed to Y to either node B or to node D. The selection of which node to route the packet to
is the routing decision. The routing decision is made by an algorithm incorporated in the packet
switching exchange (PSE) software of node A. The performance of routing algorithms may be
expressed in terms of various criteria.
Back to top
10.4sugar CHAPTER 4
ROUTING ALGORITHM

Routing algorithm is the algorithm used to make a routing decision for a particular datagram
based on current routing information. Routing information is nothing but the information about
the topology and delays of the network.
An important requirement for any Routing Algorithm is to ensure deadlock freedom;
deadlock situation occur when no message can advance towards its destination because of filled
queues. Back to top

4.1 Characteristics:

The primary function of a packet-switching network is to accept packets from a


source station and deliver them to destination station. To accomplish this, a path or route to
through the network must be determined; generally, more than one route is possible. Thus a
routing function must be performed. The requirements for this function include:

 Correctness
 Simplicity
 Robustness
 Stability
 Fairness
 Optimality
 Efficiency

The first two items one the list is self-explanatory. Robustness has to do with the ability of the
network to deliver packets via some route in the face of localized failures and overloads. Ideally,
the network can react to such contingencies without the loss of packets or the breaking of virtual
circuits. The designer who seeks robustness must cope with the competing requirement for
stability. Techniques that react to changing condition have an unfortunate tendency to react too
slowly to events or to experience unstable swings from one extreme to another. For example, the
network may react to congestion in one area by shifting most of the load to a second area. Now
the second area is overloaded and the first is underutilized, causing a second shift. During these
shifts, packets may travel in loop through the network.
A tradeoff also exists between fairness and optimality. Some performance criteria may
give higher priority to the exchange of packets between near by station compare to an exchange
between distant stations. This policy may maximize average throughput but will appear unfair to
the station that primarily needs to communicate with distant station.
Finally, any routing technique involves some processing overhead at each node and often
a transmission overhead as well, both of which impair network efficiency. The penalty of such
overhead needs to be less than the benefit accrued based on some reasonable metric, such as
increased robustness or fairness. Back to top

4.2 Performance Criteria:

• Minimum number of Hops


• Minimum “cost”
• Minimum delay
• Maximum throughput
• Minimum CPU processing at nodes
• Minimum CPU memory requirement at nodes

Back to top
4.3 Classification of Routing Algorithms:

Routing algorithms determine an efficient path from one source to its destination through the
chain of Routers and servers. One way in which we can classify as routing algorithms is
according to whether they are Global or Decentralized.

• A Global Routing Algorithm computes the shortest path between a source &
destination using complete, global knowledge about the network i.e. the algorithm takes the
connectivity between all nodes & all link costs as inputs. The calculation can be run at one site (a
centralized global routing algorithm) or replicated at multiple sites. In practice, algorithms with
global state information are often referred to as Link State Algorithm.

• In a Decentralized Routing Algorithm, the calculation of the shortest path is carried


out in an iterative, distributed manner. No node has complete information about the costs of all
network links. Instead, each node begins with only the knowledge of the costs of its own directly
attached links. A decentralized Routing Algorithm is also known as a Distance Vector
Algorithm because a node never actually knows a complete path from source to destination.

We can also classify routing algorithms as Static or Dynamic:

• In Static Routing Algorithm, routes change very slowly over time, often as a result of
human intervention (for example, a human manually editing a router’s forwarding table).

• Dynamic Routing Algorithms change the routing paths as the network traffic loads for
topology change. While dynamic algorithms are more responsive to network

changes, they are also more susceptible to problem such as routing loops and oscillations in
route.
Routing Algorithms can be grouped into two major classes: Non-adaptive and Adaptive.
• Non-Adaptive Algorithms do not base their routing decisions on measurements or
estimates of the current traffic and topology. Instead, the choice of the route to use is computed
in advance, off-line and downloaded to the routers when the network is booted
• Adaptive Algorithms, in contrast, change their routing decisions to reflect changes in
the topology and usually the traffic as well. They differ in where they get their information (e.g.,
locally, from adjacent routers, or from all routers), when they change the routes.
Back to top

4.4 Routing Strategies:

A large number of routing strategies have evolved for dealing with the routing requirements
of packet-switching networks. Many have these strategies are also applied to internetworking
routing. In the section, we survey three key strategies: Fixed, Flooding, and Random.

a) Fixed Routing:

For fixed routing, a single, a permanent route is configured for each source-destination pair
of nodes in the network. The routes are fixed, or at least only change when there is a change in
the topology of the network. Thus, the link cost used in designing routes cannot be based on any
dynamic variable such as traffic. They could, however, be based on expected traffic or capacity.

b) Flooding:

Another simple routing technique is flooding. This technique requires no network


information whatsoever and works as follows. A packet is sent by a source node to every one
of its neighbours. At each node, an incoming packet is retransmitted on all outgoing links
except for the link on which it arrived. Flooding obviously generates vast number of duplicate
packets, infact an infinite number unless some measures are taken to damp the process. One such
measure is to have hop counter contained in the header of each packet, which is decremented at
each hop with the packet being discarded when the counter reaches zero. Ideally, the hop counter
should be initialized to the length of the path from source to destination. If the sender does not
know how long the path is, it can initialize the counter to the worst case, namely, the full
diameter of the subnet.

c) Multicast Routing:

To do multicast routing, group management is required. For some applications,


widely-separated processes work together in groups, for example, a group of processes
implementing a distributed database system. Each router computes a spanning tree to know
which of their hosts belong to which groups. They forward the information to their neighbour
and this way the information propagates through the subnet. When a process sends a multicast
packet to a group, the first router examines its spanning tree and prunes it, removing all lines that
do not lead to hosts that are members of the group.

d) Hierarchical Routing:

When Hierarchical Routing is used, the routers are divided into what we call
regions, with each router knowing all the details about how to route packets to

destinations within its own region, but knowing nothing about the internal structure of other
regions. When different networks are connected together, it is natural to regard each one as a
separate region in order to free the routers in one network from having to know the topological
structure of the other ones.
e) Random Routing:

Random routing has the simplicity and robustness of flooding with far less traffic load. With
random routing, a node selects only one outgoing path for retransmission of an incoming packet.
The outgoing link is chosen at random, excluding the link on which the packet arrived. If all
links are equally likely to be chosen, then a node may simply utilize outgoing links in round-
robin fashion.
Back to top

13.1 sugar
4.5 Types of Routing Algorithms:

There are mainly two types of routing algorithms, The Bellman Ford Algorithm which is a
decentralized algorithm and Dijkstra Algorithm which is a global routing algorithm. In the
latter case the router has a complete view of the network. Whereas for the former each router
only has a local view consisting of its directly attached neighbors.

Dijkstra algorithm requires that any link cost change be broadcasted to the entire network.
Bellman-Ford algorithm is subject to the problems of routing loop and slow convergence due to
the lack of a complete network view. Routing in practice is actually hierarchical. RIP and OSPF
are the two main Intra-AS routing protocol. RIF is based on Bellman-Ford algorithm, while
OSPF is based on Dijkstra algorithm.
CHAPTER 5
DIJKSTRA ALGORITHM

Dijkstra Algorithm is one of the more common shortest path algorithms and can be applied to
network routing. This Algorithm is an iterative process that works through a graph or a set of
vertices & paths to calculate the shortest path from any one source node to every other node in
the set. Back to top

5.1 Algorithm:

The Dijkstra algorithm goes through these steps:

The router builds a graph of the network and identifies source and destination nodes, as V1
and V2 for example. Then it builds a matrix, called the "adjacency matrix." In this matrix, a
coordinate indicates weight. For example, [i, j] is the weight of a link between Vi and Vj. If there
is no direct link between Vi and Vj, this weight is identified as "infinity."

1. The router builds a status record set for every node on the network. The record
contains three fields:

• Predecessor field - The first field shows the previous node.

• Length field - The second field shows the sum of the weights from the source to
that node.

• Label field - The last field shows the status of node. Each node can have one
status mode: "permanent" or "tentative."

2. The router initializes the parameters of the status record set (for all nodes) and sets
their length to "infinity" and their label to "tentative."
3. The router sets a T-node. For example, if V1 is to be the source T-node, the router
changes V1's label to "permanent." When a label changes to "permanent," it never changes again.
A T-node is an agent and nothing more.

4. The router updates the status record set for all tentative nodes that are directly linked to
the source T-node.

5. The router looks at all of the tentative nodes and chooses the one whose weight to V1 is
lowest. That node is then the destination T-node.

6. If this node is not V2 (the intended destination), the router goes back to step 5.

7. If this node is V2, the router extracts its previous node from the status record set and does
this until it arrives at V1. This list of nodes shows the best route from V1 to V2.

Back to top
5.2 Flowchart:
14.1 sugar
These steps are shown below as a flowchart.

START

Identify source node and destination node as V1 and V2

Set V1 as T-node

Set T-node’s label to “permanent” and update


neighbour’s status record set

Identify the tentative node linked to V1 that has the


lowest weight and set it as T-node

Is T-Node is V2?

Based on information in status record set, do these until u


reach V1. The string of link represents the best route

END

Back to top
5.3 Example:

Here we want to find the best route between A and E (see below). You can see that there are
six possible routes between A and E (ABE, ACE, ABDE, ACDE, ABDCE, ACDBE), and it's
obvious that ABDE is the best route because its weight is the lowest. But life is not always so
easy, and there are some complicated cases in which we have to use algorithms to find the best
route.

1. As you see in the image below, the source node (A) has been chosen as T-node, and so its
label is permanent (we show permanent nodes with filled circles and T-nodes with the -->
symbol).

Now we can have an adjacency matrix of the network. If there is no direct link between two
nodes, then assuming the weight is infinite.

A B C D E
A 0 1 5 INFINITE INFINITE
B 1 0 INFINITE 2 4
C 5 INFINITE 0 2 3
D INFINITE 2 2 0 1
E INFINITE 4 3 1 0

2. In this step, you see that the status record set of tentative nodes directly linked to T- node
(B, C) has been changed. Also, since B has less weight, it has been chosen as T-node and its
label has changed to permanent (see below)
3. In this step, like in step 2, the status record set of tentative nodes that have a direct link to
T-node (D, E), has been changed. Also, since D has less weight, it has been chosen as T-node
and its label has changed to permanent (see below).

4. In this step, we don't have any tentative nodes, so we just identify the next T-node. Since E
has the least weight, it has been chosen as T-node.

5. E is the destination, so we stop here.

We are at end! Now we have to identify the route. The previous node of E is D, and the
previous node of D is B, and B's previous node is A. So the best route is (ABDE). In this case,
the total weigh is 4 (1+2+1).
Alternative roots are:-
(ABE) 1+ 4=5
(ACE) 5 +3=8
(ACDE) 5+2+1=8 Back to top
CHAPTER 6
PROBLEM ANALYSIS AND IMPLEMENTATION

The complete project work has been divided into following modules:

• Problem Analysis
• Technique Used
• Flowchart
• Pseudo Code
Back to top

33.8america
6.1 Problem Analysis:

1. Read the number of nodes present in the network.


2. Read the activities between all the nodes.
3. Identify Source and Destination.
4. Find the distance of all the nodes from the source.
5. Select the node whose distance from the source is the least.
6. Lock the node that has passed i.e. source node in this case.
7. Find the distance of remaining nodes from the selected node and repeat steps 5 & 6
till the destination node is reached.
8. List all the selected nodes from source to destination in the sequence in which they
are generated above to give the Optimum Path.

Back to top
33.2america
6.2 Technique Used:

1. Construction of Network:
The Network to be processed is constructed depending upon the number of Nodes and the
Activities between the nodes as specified by the user. The activities are stored in a Matrix where
the intersection of particular row and column gives the activity between the corresponding nodes.
In the network the nodes having activity less than infinity between them are connected to give
the complete architecture.

2. Generation of Node Structure:

A separate Structure for each Node is generated containing two Arrays. One of the arrays
includes the information of those nodes, which are connected to that particular node, and the
other array stores the corresponding activity. The array of nodes is sorted in increasing order
with respect to activities.

3. Calculation of Optimum Path:

Starting from Destination Node, the node at the Shortest Distance is identified. If this node is
Source then we have the Optimum Path here itself. Otherwise the node is saved in the Route
Array and it is locked to avoid Recursion. Now the next node, which is at the shortest distance
from the current node, is identified and saved in the route array till the source node is found.
Simultaneously the activities are added up to get the total activity on the corresponding path.
This way all the possible routes are calculated and sorted in increasing order with total activities
on the path.
4. Graphics Display:

The Shortest Path between Source and Destination is shown in text showing all the
Intermediate hops along with total number of activities. The same is displayed Graphically by
connecting the intermediate nodes. All the other links of the original network are hidden.

The various options provided are:

 Alternate Shortest Path:

It gives the next path available for the datagram to move from source to destination. The
alternate path is given depending upon the activities on that path as compared to the Optimum
Path and the other available paths. Similarly the subsequent alternate paths are provided.

 Change in the Destination:

We can change the Destination Node within the same Network and find out its Optimum
Path as well as the Alternate Paths from the Source Node. This way we can check the Shortest
Path for any Node in the Network from the Source.

 Change in Link/activity between any two Nodes:

Suppose a link fails, then the datagram can not move through that link. This changes the
whole configuration of the Network and the available paths between Source and Destination. It
provides the Shortest Path and the Alternate Paths after the link failure. Thus we don’t have to
run the program all over again to get the Optimum Path.
The following features of ‘C’ Language have been extensively used in the
implementation:

 Structures
 Arrays
 Graphics

Back to top
6.3Flowchart:

Start

Read – i Number of Nodes


ii Activities between Nodes
iii Source and Destination

Construct the Network


i Draw the Nodes
ii Connect the Nodes the activities
between which is less than infinity

Generate Structure for each Node –


i Form an array of all the connected Nodes
ii Form a corresponding array of Activities

Arrange the array for each Node


using Insertion Sort.

Calculate the Optimum Path


Starting from the Destination Node
move to the Node which is at the A
shortest distance at each successive
Node till the Source Node and add up
the activities through that path.
A

Arrange all the route arrays


depending upon the total
activities using Insertion Sort

i Write the Optimum Path


between Source and
Destination
ii Show the total number of
Activities along the Path.

Display the Shortest path


i Draw the Nodes
ii Connect the Intermediate Nodes
between Source and Destination

End

Back to top
6.4 Pseudo Code:

// Pseudo Code for Implementation of Dijkstra Routing Algorithm//

Read the number of nodes n;


/* Read the Activities */
For (i=0 to i<n)
{
For (j=0 to j<n)
{
Read act[i][j];
}
}
Read the source node src;
Read the destination node dest;
/* Construct the Network */
Draw node I and J;
If (act[i][j]<infinity)
Connect;
First: /* Generate Structure for each Node */
For (i=0 to i<n)
{
If (i!=src)
{
Set y=0;
For (j=0 to j<n)
{
If (i!=j & act[i][j]<infinity)
{
node[i].prev[j]=j;
node[i].traffic[y]=act[i][j];
Increment y;
}
}
}
}
Arrange the array for each node using insertion sort;
Start: Set m=0;
/* Set Check field of each node */
For (l=0 to l<n)
Set node[l].check=0;
/* Calculate the Optimum Path */
For (i=0 to i<node[dest].k)
{
Set x & y =0;
temp=node[dest].prev[i];
route[m].dist=node[dest].traffic[i];
node[dest].check=1;
If (temp=src)
{
route[m].path[y]=temp;
route[m].v=y;
Increment m;
}
Up: Else
{
For (j=o to j<node[temp].k)
{
temp1=node[temp].prev[j];
If (node[temp1].check=0)
{
route[m].path[y]=temp1;
route[m].dist=route[m].dist+node[temp].traffic[j];
node[temp].check=1;
If (route[m].path[y]!=src)
{
temp=temp1;
Goto Up;
}
Else
route[m].v=y;
}
}
}
Arrange the route arrays depending upon the total activities using insertion sort;
Write the Optimum Path between source and destination;
Show the total number of activities;
/* Display the Shortest Path */
Draw the nodes;
Connect the intermediate nodes between source and destination;
/* Option Menu Bar */
Show the Options;
Read the choice;
Case 1: Show the Alternate Path;
Case 2: Change the Destination;
Goto Start;
Case 3: Change the Activity;
Goto First;
Case 4: Exit;
Close the Main Function; Back to top
CHAPTER 7
RESULT ANALYSIS

Enter the Number of Nodes: 5

If there is no activity between the nodes => Enter 1000

Enter the number of activities between nodes 0 & 1 :1000


Enter the number of activities between nodes 0 & 2 :2
Enter the number of activities between nodes 0 & 3 :10
Enter the number of activities between nodes 0 & 4 :1000
Enter the number of activities between nodes 1 & 2 :3
Enter the number of activities between nodes 1 & 3 :1000
Enter the number of activities between nodes 1 & 4 :1
Enter the number of activities between nodes 2 & 3 :1
Enter the number of activities between nodes 2 & 4 :3
Enter the number of activities between nodes 3 & 4 :1

Screen 1 : Data Input

The Activity Matrix Entered By You :

Node 0 Node 1 Node 2 Node 3 Node 4


Node 0 0 1000 2 10 1000
Node 1 1000 0 3 1000 1
Node 2 2 3 0 1 3
Node 3 10 1000 1 0 1
Node 4 1000 1 3 1 0

Enter the Source Node Number :0


Enter the Destination Node Number :5
Invalid Node !
Press Any Key To Continue

Screen 2 : Activity Matrix


The Activity Matrix Entered By You :

Node 0 Node 1 Node 2 Node 3 Node 4


Node 0 0 1000 2 10 1000
Node 1 1000 0 3 1000 1
Node 2 2 3 0 1 3
Node 3 10 1000 1 0 1
Node 4 1000 1 3 1 0

Source Node Number :0


Enter the Destination Node Number :4
Press Any Key for Physical Connectivity

Screen 3 : Source & Destination Confirmation

Node 0

2
10
Node 1 Node 2
3

1 1

1
Node 3 Node 4

Physical Connectivity
Press Any Key For Shortest Path

Screen 4 : Physical Network


The Shortest Path From Node 0 To Node 4 :
0 => 2 => 3 => 4

Number of Activities :4

1 => Graphical Representation


2 => Activity Matrix

Enter the Choice :1

Screen 5 : Shortest Path

Node 0

2
10
Node 1 Node 2
3

1 1

1
Node 3 Node 4

SHORTEST PATH
Press Any Key To Continue

Screen 6 : Graphical Representation


1 => Show Alternate Path
2 => Change Destination
3 => Change Activities
4 => Exit

Enter the Choice :1

Screen 7 : Menu Bar

Alternate Path From Node 0 To Node 4 :


0 => 2 => 4

Number of Activities :5

Node 0

2
10
Node 1 Node 2
3

1 1

1
Node 3 Node 4

Alternate Shortest Path

1 => Menu Bar 2 => Next Alternate Path

Screen 8 : Alternate Path With Graphical Representation


Choice :2

Enter the Destination Node Number :3

The Shortest Path From Node 0 To Node 3 :


0 => 2 => 3

Number of Activities :3

Node 0

2
10
Node 1 Node 2
3

1 1

1
Node 3 Node 4

Shortest Path
Press Any Key To Continue

Screen 9 : Shortest Path For Changed Destination


Choice :3

Enter the Nodes between which Activity is to be changed :2 & 3


To Delete the Link => Enter 1000
Enter the Activity Between Nodes 2 & 3 :1000

The Changed Activity Matrix :

Node 0 Node 1 Node 2 Node 3 Node 4


Node 0 0 1000 2 10 1000
Node 1 1000 0 3 1000 1
Node 2 2 3 0 1000 3
Node 3 10 1000 1000 0 1
Node 4 1000 1 3 1 0

Node 0

2
10
Node 1 Node 2
3

1
Node 3 Node 4

Physical Connectivity
Press Any Key To Continue

Screen 10 : Activity Matrix And Physical Network After Deleting The Link
The Shortest Path From Node 0 To Node 4 :
0 => 2 => 4

Number of Activities :5

1 => Graphical Representation


2 => Activity Matrix

Enter the Choice :1

Node 0

2
10
Node 1 Node 2
3

1
Node 3 Node 4

SHORTEST PATH
Press Any Key To Continue

Screen 11 : Shortest Path After Link Failure

Back to top
CHAPTER 8
CONCLUSION AND SUGGESTIONS

In today’s world, networking plays an important role in communication between autonomous


computers. For this many hardware devices and software algorithms have been designed. So far,
the traditional system used for the communication were the hub networking system and many
other hardware applications present in the market, but as they operate on electricity, it may lead
to the failure of device due to some malfunctioning in the hardware circuitry. Dijkstra Algorithm
has been incorporated in ‘C’, which provides easy understandability and hence its chances of
failure is negligible.

Generally, under normal circumstances after we have determined the optimum path
for a datagram in a network using Dijkstra Algorithm, if a link failure occurs then the complete
network topology changes including the path that the datagram was following. Hence in case of a
link failure we have to run the algorithm all over again to provide the shortest path to the
datagram. However, we have implemented the Dijkstra Algorithm in such a way that under the
context of link failure it will provide the next shortest path from the available alternate paths that
has been calculated along with the Optimum Path itself. As a result there is no need to execute
the algorithm again.
Back to top
CHAPTER 9
REFERENCE

1. B.M. Waxman, “Routing of Multipoint Connections”, IEEE Journal on “Select. Areas


Communication”, vol. 6, pp. 1617-1622, Dec.1988.
2. W.J. Dally, “ Virtual Channel Flow Control”, IEEE Transcription on “Parallel and
Distributed Systems”, vol. 3, no. 2, pp. 194-205, 1992.
3. J. Duato, S. Yalamanchili, and L. Ni., “Interconnection Network: An Engineering
Approach” IEEE CS Press, 1997.
4. C.L. Seitz, “The Hypercube Communication Chip”, Display File 5182: DF: 85, Department
of Computer Science, California Institute of Technology, Mar. 1985.
5. Y. Boura, C.R. Das, and T.M. Jacob, “A Performance Model For Adaptive Routing in
Hypercubes”, Proc. from Intel Workshop on “Parallel Processing”, pp. 11-16, Dec. 1994.
6. J. Duato, “A New Theory of Deadlock-Free Adaptive Routing in Wormhole Routing
Networks”, IEEE Transcription on “Parallel and Distributed Systems”, vol. 4, no.12, pp.
1320-1331, Dec. 1993.
7. X. Lin, P.K. Mckinley, and L.M. Lin, “The Message Flow Model for Routing in
Wormhole-Routed Networks”, Proc. from Intel Conference on “Parallel Processing”, pp. 294-
297, 1993.
8. D.H. Linder and J.C. Harden, “An Adaptive and Fault Tolerant Wormhole Routing
Strategy for K-ary n-cubes”, IEEE Transcription on Computers, vol. 40, no. 1, pp. 2-12, Jan.
1991.
9. C.Y. Chou, D.J. Guan, and K.L. Wang, “A Dynamic Fault-Tolerant Message Routing
Algorithm for Double-Loop Networks”, Information Processing Letters, vol. 70, pp. 259-264,
1999.
10. A.S.Tanenbaum - Computer Networking (3rd Edition)
11. W. Stallings - Data & Computer Communication (6th Edition)
12. James F. Kurose and Keith W. Ross - Computer Networking (2nd Edition)
13. Yedidyah Langsam, Moshe J. Augenstein, Aaron M. Tenenbaum – Data Structures
Using C and C++ (2nd Edition)
14. Roger T. Stevens – Graphics Programming in C (1st Edition)

URL’S 

15. http://www.soi.wide.ad.ip/soi_asia/pkg2/03/6.html
16. http://www.eell70.ee.uts.edu.all/~rob/48750/book/node123.htm

Back to top

You might also like