googling "floyd algorithm " gave me the folowing

http://www.gamespp.com/alg

maybe you can modify the above to suit your needs

Solved

Posted on 2004-10-26

I am trying to implement floyd algorith to find shortest path ..cna any one help me...

3 Comments

googling "floyd algorithm " gave me the folowing

http://www.gamespp.com/alg

maybe you can modify the above to suit your needs

this can help you:

floyd on adjacent matrix W for the graph

floyd(W)

{

n is the number of rows in W;

D(0)=W;

for k = 1 to n

for i = 1 to n

for j = 1 to n

{

D(k)[i][j]=MIN(D(k-1)[i][j

}

}

means for all i and j, I want to know the minimum path between i and j that k participate in the path,

so for all k, i replace D[i][j] with the min of D[i][j] and D[i][k]+D[k][j], that means, if the path between i -> k, and then k ->j is smaller than the path i->j that doesn't use k in the path, i use this minimum.

note that you can use one D matrix for above operation.

have a good programming day.

By clicking you are agreeing to Experts Exchange's Terms of Use.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**17** Experts available now in Live!