Why use Dijkstra's Algorithm if Breadth First Search (BFS) can do the same thing faster?

后端 未结 4 1177
南笙
南笙 2020-11-30 18:47

Both can be used to find the shortest path from single source. BFS runs in O(E+V), while Dijkstra\'s runs in O((V+E)*log(V)).

Also, I\'ve s

4条回答
  •  Happy的楠姐
    2020-11-30 19:01

    Dijkstra's algorithm

    • Like BFS for weighted graphs.
    • If all costs are equal, Dijkstra = BFS

    Source : https://cs.stanford.edu/people/abisee/gs.pdf

提交回复
热议问题