Dijkstra's algorithm with using standard library for heap.

Revision en1, by Vedkribhu, 2020-06-16 13:27:24

I Dijkstra's algorithm we need to maintain heap for vertices who are not finalised. We need to modify the value of keys in the min heap. How can we do that without using custom heap written ourselves, but instead using Standard heap library like Heapq in python. I found this on stackoverflow but it is linear time to modify, can we do in logarithmic time complexity for decrease key? Any answer related to c++ or python will be awesome.

Tags #djikstra, #graph

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Vedkribhu 2020-06-16 13:27:24 606 Initial revision (published)