954,202 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Bellman Ford Algo

i have created 3 matrices: 1) Connection Mtrx 2) Metric Mtrx 3) Ans Mtrx.

here from connection mtrx, seeing starting node,i update the ans mtrx which will hold the sequence of node traversal. how do i code to achieve this?

the code problem is coming in function bf().

#include
#include

class bellford
{
int size,**node,**metric,**ans,count,*temp;
int i,j,k,start_node,pass;

public:
bellford()
{
pass=count=i=j=0;
}

void accept(); // Accepts Number Of Nodes
void create(); // Creates Connection and Metric Matrices
void start(); // Accepts starting node for comm.
void bf(); // Generates Path for Routing
//void make_ans(int,int); // Holds Answers
void oracle(); // Displays Final Answer
};

void bellford::accept()
{
cout<<"Enter size of Matrix:";
cin>>size;
create();
}

void bellford::create()
{
node=new int*[size];
for(i=0;i Node "<>node[i][j];
cout< Node "<>metric[i][j];
cout<>start_node;
//cout< _ _ _ _ _
} // 5-> _ _ _ _ _
// 5-> _ _ _ _ _
i=0;//Making i=0 to put values of start_node in every row
j=0;
while(i

Naveen
Light Poster
25 posts since Jul 2004
Reputation Points: 14
Solved Threads: 0
 

hi everyone,
Try getting the user to input the matrix horizontally and use kramer's rule to break down the matrix.

Yours Sincerely

Richard West

freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You