Dijkstra's algorithm with using standard library for heap.

Правка en1, от 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.

Теги #djikstra, #graph

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Vedkribhu 2020-06-16 13:27:24 606 Initial revision (published)