Can Dijkstra's algorithm handle negative edge weights? Why or why not?

  • No, it assumes all edge weights are non-negative
  • Only if the graph is acyclic
  • Yes, but only for graphs with positive vertex values
  • Yes, it adjusts for negative weights during the process
No, Dijkstra's algorithm cannot handle negative edge weights because it relies on the assumption that the shortest path is found by consistently selecting the smallest tentative distance, which doesn't hold true for negative weights.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *