Social Sciences, asked by yasjjoshi6543, 1 year ago

Advantages and disadvantages of floyd warshall algorithm

Answers

Answered by writersparadise
7
The Floyd-Warshall algorithm helps in determining all the shortest paths in a graph with positive or negative weight edges. It is known for its simplicity.

Advantages:
# It is easy to write the code for this algorithm in a program.
 
# It highlights all the shortest path pairs in a graph.
 
Disadvantages:
# It works slower than other algorithms designed to perform the same task.
Answered by Chirpy
11

The Floyd-Warshall algorithm or Floyd's algorithm is an example of dynamic programming. It is also known as Roy-Warshall algorithm, the WFI algorithm or the Roy-Floyd algorithm.


Advantages 

1. It helps to find the shortest path in a weighted graph with positive or negative edge weights.

2. A single execution of the algorithm is sufficient to find the lengths of the shortest paths between all pairs of vertices.

3. It is easy to modify the algorithm and use it to reconstruct the paths.

4. Versions of the algorithm can be used for finding the widest paths between all pairs of vertices in a weighted graph or transitive closure of a relation R.


Disadvantages 

1. It can find the shortest path only when there are no negative cycles.

2. It does not return the details of the paths. 

Similar questions