What's the difference between uniform-cost search and Dijkstra's algorithm?

前端 未结 5 640
半阙折子戏
半阙折子戏 2021-01-30 09:53

I was wondering what\'s the difference between uniform-cost search and Dijkstra\'s algorithm. They seem to be the same algorithm.

5条回答
  •  花落未央
    2021-01-30 10:41

    Dijkstra's algorithm searches for shortest paths from root to every other node in a graph, whereas uniform-cost searches for shortest paths in terms of cost to a goal node.

    Also, uniform cost has less space requirements, whereas the priority queue is filled "lazily" opposed to Dijkstra's, which adds all nodes to the queue on start with an infinite cost.

提交回复
热议问题