Question:

Which algorithm is used for finding the shortest path in a weighted graph with negative edges?

Show Hint

Choose Bellman-Ford for graphs with negative weights; Dijkstra’s for non-negative weights.
Updated On: Jun 18, 2025
  • Bellman-Ford
  • Dijkstra’s
  • Kruskal’s
  • Prim’s
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

- Bellman-Ford algorithm handles graphs with negative edge weights and detects negative cycles, with time complexity $O(VE)$.
- Dijkstra’s algorithm fails with negative weights, requiring non-negative edges.
- Kruskal’s and Prim’s are for minimum spanning trees, not shortest paths.
Option (1) is correct.
Was this answer helpful?
0
0