🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

github.com/SeaEagle568/fib_heap

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/SeaEagle568/fib_heap

v0.0.0-20210808124200-db5f79368633
Source
Go
Version published
Created
Source

fib_heap

Golang fibonacci heap + Dijkstra SSSP algorithm implementation

Summary

Here is the implmentation for Fibonacci Heap and Dijkstra based on it (with time complexity of O(E + V log V) on Go.

Also there is Dijkstra implementation on Red-Black Tree, but the red-black tree set isn't mine

Testing

There are unit tests for fib heap included, A large test for Dijkstra and I also submitted SSSP solutions based on this algo to CF

Details

Here is time complexity of my implementation

Insertion     O(1)*
GetMin        O(1)
Merge         O(n) - details below
ExtractMin    O(log n)
Decrease      O(1)*
DeleteKey     O(log n)
  
* - amortized
Merge is O(n) because I use hash map to search for node in O(1)*
If needed, can be replaced with other, tree-like structure, then
Merge will be O(log n) but Decrease will be O(log n) too, and constant will increase
It is usually more preferable to find decrease and delete keys from heap quickly then to merge

FAQs

Package last updated on 08 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts