Morass

Dijkstra

Aug 15th, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. dijkstra:
  2. //something before
  3. dist ← -1
  4. while !queue.empty()
  5. T=queue.top().dest, W=queue.top().dest
  6. dist[T]=W
  7. for_each edge
  8. queue.add(edge.dest, W+edge.price)
  9. while(!queue.empty()&&dist[queue.top().dest]!=-1)
  10. queue.pop()
Advertisement
Add Comment
Please, Sign In to add comment