Opened 11 months ago
Last modified 9 months ago
#27620 new enhancement
Addition of Fibonaci Heap for usage in Bidirectional_Dijkstra
Reported by: | gh-Hrishabh-yadav | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | graph theory | Keywords: | |
Cc: | dcoudert | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Like Binomial Heap, Fibonacci Heap is a collection of trees with min-heap or max-heap property:- https://en.wikipedia.org/wiki/Fibonacci_heap. In Fibonacci Heap, trees can have any shape even all trees can be single nodes (This is unlike Binomial Heap where every tree has to be Binomial Tree). Currently, the Fibonacci heap isn't implemented in stl of c++, but Boost has an implementation of https://www.boost.org/doc/libs/1_50_0/doc/html/boost/heap/fibonacci_heap.html
As sage has an interface with Boost, we can have this heap instead of current python heap implemented in Bidirectional_dijkstra. Using Fibonacci Heap we can reduce time complexity of Decrease-Key, which has importance in Dijkstra and Prim algorithms. With Binary Heap, time complexity of these algorithms is O(VLogV + ELogV). If Fibonacci Heap is used, the time complexity is improved to O(VLogV + E).
Change History (6)
comment:1 Changed 11 months ago by
comment:2 Changed 11 months ago by
Priority queue in c++ implements Binomial heap which gives complexity of:
Algorithm Average Worst case Space O(n) O(n) Search O(n) O(n) Insert O(1) O(log n) Delete O(log n) O(log n) Peek O(1) O(1)
whereas Fibonacci Heap reduces complexity Insertion and Decrease key
Algorithm Average Insert Θ(1) Find-min Θ(1) Delete-min O(log n) Decrease-key Θ(1) Merge Θ(1)
comment:3 Changed 11 months ago by
- Type changed from PLEASE CHANGE to enhancement
comment:4 Changed 11 months ago by
- Description modified (diff)
comment:5 Changed 11 months ago by
You can give it a try.
comment:6 Changed 9 months ago by
- Milestone sage-8.8 deleted
As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).
Please check #27464. We are now using