Opened 4 years ago

Last modified 3 years ago

#27620 new enhancement

Addition of Fibonaci Heap for usage in Bidirectional_Dijkstra

Reported by: HRISHABH YADAV Owned by:
Priority: minor Milestone:
Component: graph theory Keywords:
Cc: David Coudert Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by HRISHABH YADAV)

Like Binomial Heap, Fibonacci Heap is a collection of trees with min-heap or max-heap property:- 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

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 4 years ago by David Coudert

Please check #27464. We are now using

from libcpp.queue cimport priority_queue
from libcpp.pair cimport pair

comment:2 Changed 4 years ago by HRISHABH YADAV

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 4 years ago by HRISHABH YADAV

Type: PLEASE CHANGEenhancement

comment:4 Changed 4 years ago by HRISHABH YADAV

Description: modified (diff)

comment:5 Changed 4 years ago by David Coudert

You can give it a try.

comment:6 Changed 3 years ago by Erik Bray

Milestone: sage-8.8

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).

Note: See TracTickets for help on using tickets.