Why does Dijkstra's algorithm use decrease-key?

后端 未结 3 799
花落未央
花落未央 2020-12-07 07:54

Dijkstra\'s algorithm was taught to me was as follows

while pqueue is not empty:
    distance, node = pqueue.delete_min()
    if node has been visited:
              


        
3条回答
  •  Happy的楠姐
    2020-12-07 08:04

    In 2007, there was a paper that studied the differences in execution time between using the decrease-key version and the insert version. See http://www.cs.utexas.edu/users/shaikat/papers/TR-07-54.pdf

    Their basic conclusion was not to use the decrease-key for most graphs. Especially for sparse graphs, the non-decrease key is significantly faster than the decrease-key version. See the paper for more details.

提交回复
热议问题