consider the loop as rep(k,n) rep(i,n) rep(j,n) if(dp[i][k] && dp[k][j])dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j])
here we take one node (first for loop) and check if the cost of moving from i->j gets reduced on choosing k as intermediate node. On Sat, Mar 3, 2012 at 6:26 PM, saurabh singh <[email protected]> wrote: > Its quite trivial..it just if there's a shorter way to reach from index j > and k by using any of the nodes as intermediate.... > Saurabh Singh > B.Tech (Computer Science) > MNNIT > blog:geekinessthecoolway.blogspot.com > > > > On Sat, Mar 3, 2012 at 5:59 PM, shady <[email protected]> wrote: > >> Can someone explain Flyod Warshall algorithm, i am unable to understand >> how it works ? >> even a good link will suffice, i am not getting the intuition behind it. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
