# Routing Algorithms in Computer Networks

Routing Algorithms in Computer Networks

This article is about the process of implementing the routing algorithms along with the sample source code in computer networks.

Step: 1 Categories of Routing Algorithms

As first, let’s know the most significant classifications of routing algorithms in the following.

• Non adaptive routing algorithm
• Adaptive routing algorithm

Step: 2 Source Code for Routing Algorithms

In addition, our technical experts have highlighted the sample source code the process of routing algorithms in computer networks.

• AODV based configuration
AodvHelper aodv;
InternetStackHelper stack;
stack.SetRoutingHelper (aodv);
stack.Install (nodes);
• Header file initialization
#include "ns3/aodv-module.h"
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/mobility-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/wifi-module.h"
#include "ns3/v4ping-helper.h"
#include
• AODV neighbor detection
Neighbors::Neighbors (Time delay) :
m_ntimer (Timer::CANCEL_ON_DESTROY) {
m_ntimer.SetDelay (delay);
m_ntimer.SetFunction (&Neighbors::Purge, this);
m_txErrorCallback = MakeCallback (&Neighbors::ProcessTxError, this);
}
bool
Neighbors::IsNeighbor (Ipv4Address addr) {
Purge ();
for (std::vector::const_iterator i = m_nb.begin ();
i != m_nb.end (); ++i)
{
if (i->m_neighborAddress == addr)
return true;
}
return false;
}
Time
Neighbors::GetExpireTime (Ipv4Address addr)
{
Purge ();
for (std::vector::const_iterator i = m_nb.begin (); i
!= m_nb.end (); ++i)
{
if (i->m_neighborAddress == addr)
return (i->m_expireTime - Simulator::Now ());
}
return Seconds (0);
}
void
Neighbors::Update (Ipv4Address addr, Time expire)
{
for (std::vector::iterator i = m_nb.begin (); i != m_nb.end (); ++i)
if (i->m_neighborAddress == addr)
{
i->m_expireTime
= std::max (expire + Simulator::Now (), i->m_expireTime);
if (i->m_hardwareAddress == Mac48Address ())
i->m_hardwareAddress = LookupMacAddress (i->m_neighborAddress);
return;
}
NS_LOG_LOGIC ("Open link to " << addr);
Neighbor neighbor (addr, LookupMacAddress (addr), expire + Simulator::Now ());
m_nb.push_back (neighbor);
Purge ();
}

Step: 3 Run Routing Algorithm Process

Finally, we have highlighted the process of running routing algorithms and that through the execution of the following commands.

cd /home/research/ns-allinone-3.26/ns-3.26

sudo ./waf –run aodv –vis

Moreover, we have highlighted the result that is acquired through the process of running routing algorithm process.

The research scholars can reach us to get to know about the significant functions of routing algorithms in the computer networks.

Live Tasks
Technology Ph.D MS M.Tech
NS2 75 117 95
NS3 98 119 206
OMNET++ 103 95 87
OPNET 36 64 89
QULANET 30 76 60
MININET 71 62 74
MATLAB 96 185 180
LTESIM 38 32 16
COOJA SIMULATOR 35 67 28
CONTIKI OS 42 36 29
GNS3 35 89 14
NETSIM 35 11 21
EVE-NG 4 8 9
TRANS 9 5 4
PEERSIM 8 8 12
GLOMOSIM 6 10 6
RTOOL 13 15 8
KATHARA SHADOW 9 8 9
VNX and VNUML 8 7 8
WISTAR 9 9 8
CNET 6 8 4
ESCAPE 8 7 9
NETMIRAGE 7 11 7
BOSON NETSIM 6 8 9
VIRL 9 9 8
CISCO PACKET TRACER 7 7 10
SWAN 9 19 5
JAVASIM 40 68 69
SSFNET 7 9 8
TOSSIM 5 7 4
PSIM 7 8 6
PETRI NET 4 6 4
ONESIM 5 10 5
OPTISYSTEM 32 64 24
DIVERT 4 9 8
TINY OS 19 27 17
TRANS 7 8 6
OPENPANA 8 9 9
SECURE CRT 7 8 7
EXTENDSIM 6 7 5
CONSELF 7 19 6
ARENA 5 12 9
VENSIM 8 10 7
MARIONNET 5 7 9
NETKIT 6 8 7
GEOIP 9 17 8
REAL 7 5 5
NEST 5 10 9
PTOLEMY 7 8 4

### YouTube Channel

Unlimited Network Simulation Results available here.