title: Why does Dijkstra's algorithm use decrease-key?
body: <p>Dijkstra's algorithm was taught to me was as follows</p>
  
  <pre><code>while pqueue is not empty:
      distance, node = pqueue.delete_min()
      if node has been visited:
          continue
      else:
          mark node as visited
      if node == target:
          break
      for each neighbor of node:
           pqueue.insert(distance + distance_to_neighbor, neighbor)
  </code></pre>
  
  <p>But I've been doing some reading regarding the algorithm, and a lot of versions I see use decrease-key as opposed to insert.</p>
  
  <p>Why is this, and what are the differences between the two approaches?</p>