0% found this document useful (0 votes)
12 views1 page

Computer NetworkPart1

The document outlines the Distance Vector Algorithm, a decentralized routing method where routers share their routing tables with neighbors to determine the shortest path for data transmission. It utilizes the Bellman-Ford and Dijkstra algorithms to maintain a distance table that reflects the cost and path to each network node. The provided code snippet includes a structure for the routing table and initializes necessary variables for implementing the algorithm.

Uploaded by

xarovo3624
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

Computer NetworkPart1

The document outlines the Distance Vector Algorithm, a decentralized routing method where routers share their routing tables with neighbors to determine the shortest path for data transmission. It utilizes the Bellman-Ford and Dijkstra algorithms to maintain a distance table that reflects the cost and path to each network node. The provided code snippet includes a structure for the routing table and initializes necessary variables for implementing the algorithm.

Uploaded by

xarovo3624
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Program: - 1

1) Write a program for distance vector algorithm to find suitable


path for transmission.

Distance Vector Algorithm is a decentralize Rou ng algorithm that requires that each router
simply inform its neighbor of its rou ng table. For each network path, the receiving router pick the
neighbor adver sing the lowest cost, then add this entry into its rou ng table for re adver sement.
To find the shortest path, Distance vector algorithm is based on one of two basic algorithms: the
Bellman-Ford and the Dijkstra algorithms.

Reuters that use this algorithms have to maintain the distance table (Which is a one
dimension array—“a vector”), Which tells the distance and shortest path to sending packets to each
node in the network. The informa on in the distance table is always upd by exchanging informa on
with the neighboring nodes. The number of data in the table equals to that of all nodes in network
(excluded itself). The column of table represent the directly a ached neighbor whereas the rows
represent all the des na ons in the network. Each data contains the path for sending packet to
each des na on in the network and distance/or me to transmit on the path (we call this as
“cost”). The measurement in this algorithm are number of hopes latency, the number of outgoing
packets etc.

#include <stdio.h>

#define INFINITY 9999


#define MAX 10

struct node {
int dist[MAX];
int from[MAX];
} rou ngTable[MAX];

int main() {
int cost[MAX][MAX];
int nodes, i, j, k;

You might also like