# Some questions about shortest-path algorithms

I'm trying to understand why anyone would prefer Floyd-Warshal over Dijkstra:

• Dijkstra gives a correct result, using an understandable system, combined with backtracking.
• Floyd-Warshal makes an entire list and filters in there.

The only thing I can imagine, is the case of enormous graphs, where Dijkstra only gives a solution when found, resulting in a very large time for giving a result. Floyd-Warshal, however, already starts spitting out different possibilities and tries to improve those bit by bit (e.g. based on heuristics). But if this were true, then wouldn't that be the case for Dijkstra too?

Or are there other reasons I'm not thinking of here?

For your information: the graphs I'm dealing with, are the "typical" graphs where a vehicle needs to go from one place to another, the weights of the edges are equal to the distances between the vertices (which are the points I travel by). The edges might be directional or not, both are possible (maybe this makes a difference?).

• "Floyd-Warshal, however, already starts spitting out different possibilities and tries to improve those bit by bit (e.g. based on heuristics). But if this were true, then wouldn't that be the case for Dijkstra too?" I don't understand that reasoning at all. If this is the distinguishing feature, why would it be the case for the other algorithm too? Commented Jan 20, 2023 at 9:19
• @KilianFoth: thanks for your quick reaction. I'm a complete newbie in graph theory and I've been given the assignment to compare both algorithms. The general idea I have is that Dijkstra is very fast and it gives a correct result, while Floyd-Warshal is slower and takes a lot of resources and time. So, the only advantage I can imagine, is that Floyd-Warshal gives intermediate results, which might be helpful, while Dijkstra only gives a result at the end. Do you know if this is correct or are there other possible differences in favour of Floyd-Warshal? Commented Jan 20, 2023 at 9:27