Floyd-Warshall(G)
n=|V[G]|

for (int i=1;i<=numNodes;i++)
if connection weightmatrix[i][j]=weight;
else weightmatrix[i][j] = infinite;

if i=j
weightmatrix [i][j]=0;

for (int k=1; k<=numNodes; k++)
for (int i=1; i<=numnodes; i++)
for (int j=1; j<=numnodes; j++)

a=weightmatrix[i][k]+weightmatrix[k][j];



    if(a<weightmatrix[i][j]){




    weightmatrix[i][j]=a;}



return weightmatrix, matrixintnode;

Recommended Answers

All 2 Replies

update...you can go ahead and ignore lines 2 to 9 if it helps...

What's your question?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.