Important: Use custom search function to get better results from our thousands of pages

Use " " for compulsory search eg:"electronics seminar" , use -" " for filter something eg: "electronics seminar" -"/tag/" (used for exclude results from tag pages)


 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code for distance vector routing protocol in vhdl
Post: #1
Heart 

I need distance vector routing algorithm in VHDL language
please help me
Post: #2

/*
Distance Vector Routing in this program is implemented using Bellman Ford Algorithm:-
*/
#include<stdio.h>
struct node
{
unsigned dist[20];
unsigned from[20];
}rt[10];
int main()
{
int costmat[20][20];
int nodes,i,j,k,count=0;
printf("\nEnter the number of nodes : ");
scanf("%d",&nodes);//Enter the nodes
printf("\nEnter the cost matrix :\n");
for(i=0;i<nodes;i++)
{
for(j=0;j<nodes;j++)
{
scanf("%d",&costmat[i][j]);
costmat[i][i]=0;
rt[i].dist[j]=costmat[i][j];//initialise the distance equal to cost matrix
rt[i].from[j]=j;
}
}
do
{
count=0;
for(i=0;i<nodes;i++)//We choose arbitary vertex k and we calculate the direct distance from the node i to k using the cost matrix
//and add the distance from k to node j
for(j=0;j<nodes;j++)
for(k=0;k<nodes;k++)
if(rt[i].dist[j]>costmat[i][k]+rt[k].dist[j])
{//We calculate the minimum distance
rt[i].dist[j]=rt[i].dist[k]+rt[k].dist[j];
rt[i].from[j]=k;
count++;
}
}while(count!=0);
for(i=0;i<nodes;i++)
{
printf("\n\n For router %d\n",i+1);
for(j=0;j<nodes;j++)
{
printf("\t\nnode %d via %d Distance %d ",j+1,rt[i].from[j]+1,rt[i].dist[j]);
}
}
printf("\n\n");
getch();
}
/*
A sample run of the program works as:-
Enter the number of nodes :
3
Enter the cost matrix :
0 2 7
2 0 1
7 1 0
For router 1
node 1 via 1 Distance 0
node 2 via 2 Distance 2
node 3 via 3 Distance 3
For router 2
node 1 via 1 Distance 2
node 2 via 2 Distance 0
node 3 via 3 Distance 1
For router 3
node 1 via 1 Distance 3
node 2 via 2 Distance 1
node 3 via 3 Distance 0
*/

Please Use Search http://projects-seminars.net/search.php wisely To Get More Information About A Seminar Or Project Topic
 


[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Image Verification
(case insensitive)
Please enter the text within the image on the left in to the text box below. This process is used to prevent automated posts.

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Image Verification
(case insensitive)
Please enter the text within the image on the left in to the text box below. This process is used to prevent automated posts.

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  source code of hasbe Guest 1 0 25-03-2017 09:56 AM
Last Post: jaseela123
  matlab code for erosion for skull remove in brain Guest 1 0 22-03-2017 03:52 PM
Last Post: jaseela123
  matlab source code for image compression using dct Guest 1 0 21-03-2017 01:06 PM
Last Post: jaseela123
  wallace tree multiplier verilog code Guest 1 0 21-03-2017 12:54 PM
Last Post: jaseela123
  source code k anonymity algorithm in java Guest 3 3,064 10-03-2017 09:22 AM
Last Post: jaseela123
  k anonymity code in java Guest 1 0 10-03-2017 09:09 AM
Last Post: jaseela123
  ocrp algorithm source code Guest 1 0 09-03-2017 09:29 AM
Last Post: jaseela123
  leaky bucket source code in opengl Guest 1 0 08-03-2017 10:39 AM
Last Post: jaseela123
  matlab code for image enhancement using fuzzy logic Guest 3 3,592 08-03-2017 10:14 AM
Last Post: jaseela123
  Online Voting system source code Pinksss044 1 0 08-03-2017 09:56 AM
Last Post: jaseela123
This Page May Contain What is code for distance vector routing protocol in vhdl And Latest Information/News About code for distance vector routing protocol in vhdl,If Not ...Use Search to get more info about code for distance vector routing protocol in vhdl Or Ask Here

Options: