Home »
MCQs »
Algorithms MCQs
What is the primary purpose of the Floyd-Warshall algorithm?
26. What is the primary purpose of the Floyd-Warshall algorithm?
- To find the shortest path from a single source to all other nodes
- To find the shortest path from a single source to a single destination
- To find the shortest paths between all pairs of nodes
- To find the longest paths between all pairs of nodes
Answer
The correct answer is: C) To find the shortest paths between all pairs of nodes
Explanation
The Floyd-Warshall algorithm finds the shortest paths between all pairs of nodes in a weighted graph.