Floyd Warshall Algorithm

Could someone please give me a basic intuition between the Floyd Warshall algorithm like how you would explain it to a layman? In addition to when it is/isn’t preferred over Dijakstra’s algorithm?

I’ve tried looking up various sources but it’s like, if I read a pseudocode I am able to understand what they are doing but not why they are doing it, which is pretty pointless as that is not the right way to learn.

Could someone please help me out?

Hi. I’m not a pro coder nor am I an expert on graph theory, but I wanted to share what I know.
Essentially, Djikstra’s Algorithm is used to find the shortest distance from a particular node to another given node (shortest as in, cheapest or lightest).
On the other hand, Floyd-Warshall is used to find shortest costs of all-pairs of possible paths (refer to FREETICKET problem for an example/implementation).

Hope I could help a bit. Please ping back if you find anything confusing.

1 Like

I think you are yet to watch the best tutorial for this alg. Plz check out https://www.youtube.com/watch?v=EMAoMMsA5Jg

It’d be better if you revise a bit of DP, cos its after all a DP alg.

All the best!!!

1 Like

Hey thanks for your help :slight_smile:

This video was exactly what I needed! Thank you so much!

@sandy999 acctually i was also hvin the same trouble…but this video made it all clear…
Plz. find my code for FREETICKETS and help me locate the errors.
u can find it in the disc. on FREETICKET.

I think you forgot to include your code

Check the discussion on FREETICKETS…I inserted it in 1 of d ans…