# What is a Routing Algorithm in Computer Network?

A routing algorithm is a procedure that lays down the route or path to transfer data packets from source to the destination. They help in directing Internet traffic efficiently. After a data packet leaves its source, it can choose among the many different paths to reach its destination. Routing algorithm mathematically computes the best path, i.e. “least – cost path” that the packet can be routed through.

## Types of Routing Algorithms

Routing algorithms can be broadly categorized into two types, adaptive and nonadaptive routing algorithms. They can be further categorized as shown in the following diagram −

Adaptive routing algorithms, also known as dynamic routing algorithms, makes routing decisions dynamically depending on the network conditions. It constructs the routing table depending upon the network traffic and topology. They try to compute the optimized route depending upon the hop count, transit time and distance.

The three popular types of adaptive routing algorithms are −

• Centralized algorithm − It finds the least-cost path between source and destination nodes by using global knowledge about the network. So, it is also known as global routing algorithm.

• Isolated algorithm − This algorithm procures the routing information by using local information instead of gathering information from other nodes.

• Distributed algorithm − This is a decentralized algorithm that computes the least-cost path between source and destination iteratively in a distributed manner.

## Non – Adaptive Routing Algorithms

Non-adaptive Routing algorithms, also known as static routing algorithms, construct a static routing table to determine the path through which packets are to be sent. The static routing table is constructed based upon the routing information stored in the routers when the network is booted up.

The two types of non – adaptive routing algorithms are −

• Flooding − In flooding, when a data packet arrives at a router, it is sent to all the outgoing links except the one it has arrived on. Flooding may be uncontrolled, controlled or selective flooding.

• Random walks − This is a probabilistic algorithm where a data packet is sent by the router to any one of its neighbours randomly.

Updated on: 31-Oct-2023

72K+ Views

Get certified by completing the course