**Main Purposes: **

- 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 all other vertices.
- Floyd Warshall Algorithm is an example of all-pairs shortest path algorithm, meaning it computes the shortest path between all pair of nodes.

**Time Complexities : **

- Time Complexity of Dijkstra’s Algorithm: O(E log V)
- Time Complexity of Floyd Warshall: O(V
^{3})

**Other Points:**

- We can use Dijskstra’s shortest path algorithm for finding all pair shortest paths by running it for every vertex. But time complexity of this would be O(VE Log V) which can go (V
^{3}Log V) in worst case. - Another important differentiating factor between the algorithms is their working towards distributed systems. Unlike Dijkstra’s algorithm, Floyd Warshall can be implemented in a distributed system, making it suitable for data structures such as Graph of Graphs (Used in Maps).
- Lastly Floyd Warshall works for negative edge but no negative cycle, whereas Dijkstra’s algorithm don’t work for negative edges.

This article is contributed by **Vineet Joshi**. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Comparison between Adjacency List and Adjacency Matrix representation of Graph
- What are the differences between Bellman Ford's and Dijkstra's algorithms?
- Push Relabel Algorithm | Set 1 (Introduction and Illustration)
- Graph and its representations
- Eulerian path and circuit for undirected graph
- Travelling Salesman Problem | Set 1 (Naive and Dynamic Programming)
- Shortest path with exactly k edges in a directed and weighted graph
- Given a matrix of ‘O’ and ‘X’, replace 'O' with 'X' if surrounded by 'X'
- Karger's algorithm for Minimum Cut | Set 1 (Introduction and Implementation)
- Karger’s algorithm for Minimum Cut | Set 2 (Analysis and Applications)
- Number of Triangles in Directed and Undirected Graphs
- Minimum Cost Path with Left, Right, Bottom and Up moves allowed
- Graph implementation using STL for competitive programming | Set 1 (DFS of Unweighted and Undirected)
- Cycles of length n in an undirected and connected graph
- Union-Find Algorithm | (Union By Rank and Find by Optimized Path Compression)
- Construct binary palindrome by repeated appending and trimming
- Number of shortest paths in an unweighted and directed graph
- Cuts and Network Flow
- Undirected graph splitting and its application for number pairs
- Tree, Back, Edge and Cross Edges in DFS of Graph