Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last Updated: Mar 28, 2024
Difficulty: Easy

Routing Algorithms in Computer Networks

Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Speaker
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM

Introduction

Routing algorithms are basically used in computer networks to determine the most efficient path for data to travel. They use various metrics such as distance, traffic, and available bandwidth to make routing decisions and optimize network performance.

Computer Networks convert data into packets. It is done before sending it from source to destination. The network layer determines the best path to send the packets. This layer provides services:

a.) Datagram and 

b.)Virtual circuit services.

These services find the best path for packets. 

It also provides a routing algorithm, which is used to determine the best and shortest path for sending data. 

Routing algorithms in Computer Networks

In this article, we will learn Routing Algorithms in Computer Networks.

Also read, Basic Networking Commands

What is a Routing Algorithms in Computer Networks?

Routing algorithms in computer networks determine the optimal path for data packets to travel from the source to the destination. They consider factors like network congestion, number of hops, and overall path cost. Examples include Dijkstra's algorithm, Link-State algorithm, and Distance Vector algorithm. Their goal is efficient data transfer and overall network performance optimization.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Types of Routing Algorithms

Now we will learn the types. The Routing Algorithms in Computer Networks can be classified as follow:

  1. Adaptive Algorithms
  2. Non-Adaptive Algorithms
  3. Hybrid Algorithms
Types of Routing Algorithms

Adaptive Routing Algorithm

It is also known as dynamic routing. The traffic and topology determine the decisions and select routes. It computes and optimizes:

 → Hop count.

→ Path distance to destination.

→ Transit time. 

Dynamic data such as 

a.) Network Topology, 

b.) Load, and 

c.)Delays 

are required to choose the best route.

These are of three types:

Centralized Routing

It finds the best least-cost path to transfer data packets. The complete network topology info is used. As a result, it is also known as the global routing algo. Before calculating routes, the connection between the nodes and input as link cost is set.

The centralized node contains all of the network topology data. It is needed to make correct routing decisions. If it fails, the entire network fails. The main benefit is that only one node will have information about the entire network.

Isolated Routing

It derives routing info from local info rather than from neighbour nodes. Routing decisions are based solely on local info, with no data from other nodes. The node will not know the link status.

The main flaw of this algo is that data packets are sent via a narrow network. It results in a delay to the destination. The two examples are:

a.) Hot Potato routing.

b.) Backward Learning.

Distribution Routing

It is also known as decentralized routing or distance vector routing. It finds the least-cost route. The node that sends the data packets receives info from other nodes. Then it determines how to send them to their target. A delay in the time interval of receiving info results in a delay in sending data.
The node that sends the data packets does not contain any info about the complete route. It includes info on the cheapest path for sending data packets.

Non-Adaptive Routing Algorithm

It is also known as static routing. This algorithm's routing of data packets is free of network topology and traffic. When the network boots, the routers save the routing info.

The best route will be selected in advance and will not change. These are two types:

Flooding Routing 

In this case, all incoming data packets are received by all outgoing links except the one from which the packet started. The loop links may generate duplicate data. We can fix this issue by using:

a.) Sequential numbers.

b.)  Spanning trees.

c.) Hop count.

Random walk Routing

The data packets are transferred from host to host to one of its neighbors. The packet arrives at the destination randomly. It is a robust method. It is implemented by sending packets onto the least queued link.

Random walk routing Algorithm

Hybrid Algorithm

A hybrid routing algorithm is a type of routing algorithm used in computer networks that combines the features of both distance vector and link state algorithms. It is designed to take advantage of the benefits of both algorithms while minimizing their drawbacks. 

Hybrid routing algorithms are commonly used in large computer networks, such as the internet, to provide efficient and reliable routing of data packets between nodes.

Difference between Adaptive and Non-Adaptive Routing Algorithm

Basis Of ComparisonAdaptive Routing algorithmNon-Adaptive Routing algorithm
Define

Adaptive routing is a network routing algorithm that dynamically changes the path of data based on the current network conditions, such as congestion or failures.

Non-adaptive routing is a network routing algorithm that uses a predetermined or fixed path for data to travel through the network, regardless of the current network conditions.

Usage

Adaptive routing is commonly used in large, complex networks to optimize data delivery, minimize congestion, and reroute data in the event of network failures.

Non-adaptive routing is often used in smaller, less complex networks where network conditions are relatively stable and predictable, and where routing decisions can be made ahead of time.

Categorization

Adaptive routing algorithms can be categorized as distributed or centralizedsed on whether the routing decisions are made locally by individual nodes or globally by a central control entity.

Non-adaptive routing algorithms can be categorized as static or dynamic, based on whether the predetermined path is fixed or can be changed in response to changes in network conditions.

Complexity 

Adaptive routing can be complex, as it requires the exchange of information between nodes and the use of sophisticated algorithms to make routing decisions in real-time based on changing network conditions.

They are simple as compared to the Adaptive routing algorithms.

Must Read Algorithm Types

Difference between Routing and Flooding

 

Basis Of ComparisonRouting algorithmFlooding
Definition 

A set of computational rules that determine the best path for data transmission between network devices from a source to a destination in a computer network.

 

Flooding is a network communication method in which a packet is transmitted to all network devices, without considering the destination address, causing network congestion and redundancy.

 

Duplicacy  It does not generate duplicate data packets.Duplicacy in flooding occurs when a packet is transmitted multiple times to the same network device, either due to looped network paths or the absence of a mechanism to prevent packet duplication.
Optimal Path It finds the shortest path, which may or may not be the optimal path.It always takes the shortest path.
Traffic It does not generate extra traffic.It generates a large amount of traffic, which may reduce network throughput.

You can read related articles such as Congestion Control in Computer Networks here.

Frequently Asked Questions

What are routing algorithms in computer networks?

Routing algorithms play an important role in the network layer of a computer network. They enable efficient communication between the network devices, ensure scalability and fault tolerance, and provide security measures to protect against network threats.

What are the types of routing algorithm?

  1. Static Routing: Fixed, manually configured routes.
  2. Dynamic Routing: Adjusts routes in real-time based on network conditions.
  3. Link-State Routing: Uses complete network topology information.
  4. Distance-Vector Routing: Relies on distance metrics between nodes.
  5. Hybrid Routing: Combines aspects of both link-state and distance-vector algorithms.

What are the two popular routing algorithms?

Two popular routing algorithms are:

  1. OSPF (Open Shortest Path First): A link-state routing protocol used in IP networks.
  2. BGP (Border Gateway Protocol): A path vector protocol for routing between autonomous systems in the global internet.

Conclusion

This article discussed an overview of Routing Algorithms in Computer Networks.Routing algorithms are fundamental in computer networks, determining how data travels from source to destination. The choice of algorithm impacts network efficiency, scalability, and fault tolerance. OSPF and BGP are widely used, showcasing the diversity of routing strategies to meet different network requirements.

We hope this blog helped you. You can check out more articles such as: 


Do upvote our blogs. Check out The Interview guide for Product Based Companies and some of the Popular Interview Problems from Top companies like AmazonAdobeGoogle, etc. on Coding Ninjas Studio.

To study more about computer networks, refer to disadvantages of computer network.

Topics covered
1.
Introduction
2.
What is a Routing Algorithms in Computer Networks?
3.
Types of Routing Algorithms
4.
Adaptive Routing Algorithm
4.1.
Centralized Routing
4.2.
Isolated Routing
4.3.
Distribution Routing
5.
Non-Adaptive Routing Algorithm
5.1.
Flooding Routing 
5.2.
Random walk Routing
5.3.
Hybrid Algorithm
6.
Difference between Adaptive and Non-Adaptive Routing Algorithm
7.
Difference between Routing and Flooding
8.
Frequently Asked Questions
8.1.
What are routing algorithms in computer networks?
8.2.
What are the types of routing algorithm?
8.3.
What are the two popular routing algorithms?
9.
Conclusion