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;
angela.hach.1 0 Newbie Poster
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.