What is difference between BFS and Dijkstra's algorithms when looking for shortest path?

后端 未结 3 911
醉酒成梦
醉酒成梦 2020-12-12 16:37

I was reading about Graph algorithms and I came across these two algorithms.

I searched a lot about this but didn\'t get any satisfactory answer!

I have a do

3条回答
  •  一整个雨季
    2020-12-12 16:47

    With SPFA algorithm, you can get shortest path with normal queue in weighted edge graph.

    It is variant of bellman-ford algorithm, and it can also handle negative weights.

    But on the down side, it has worse time complexity over Dijkstra's

提交回复
热议问题