Computer Science, asked by indusati9046, 1 year ago

Difference between all pair shortest path and single source shortest path

Answers

Answered by choudhary21
4
Dijkstra's Algorithm is one example of a single-source shortest or SSSP algorithm, i.e., given a source vertex it finds shortest path from source to allother vertices. Floyd Warshall Algorithm is an example of all-pairs shortest path algorithm, meaning it computes the shortest path between all pair of nodes.
Answered by suhanasharma3120
1

Answer:

We can find SSSP Using Bellman Ford algorithm and also by Dijkstra's algorithm whereas for finding APSP we use Floyd Warshall algorithm

The main difference b/w the two is that Dijkstra's algorithm doesn't work for negative edges in the graph but Floyd algo works for negative edges as well but won't work if any negative cycle is there in the graph

Explanation:

Similar questions