0

What does K (top most loop) in Floyd-Warshall Algorithm tells? I have confusion between 'k' tells number of intermediate vertex or K tells the kth vertex will be taken as intermediate vertex.

1 Answers1

0

Floyd-Warshall:

for(every vertex k that could possibly make distance from i to j shorter)
        for(every possible vertex i)
            for(every possible vertex j)
                if(going through k can make the distance from i to j shorter)
                    you should go through k and update distance between i and j as you go