Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fibonacciheap

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fibonacciheap

Modular version of [Tyriar/js-data-structures/lib/fibonacci-heap.js](https://github.com/Tyriar/js-data-structures/blob/master/lib/fibonacci-heap.js)

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

NPM

| Algorithm | clear | decreaseKey | delete | extractMinimum | findMinimum | insert | isEmpty | size | union | |------------------------|-----------|-----------|--------|-------------|------------|----------------|-------------|----------|---------|------|----------| | Fibonacci heap | Θ(1)* | Θ(1)* | O(log n)* | O(log n)* | Θ(1) | Θ(1) | Θ(1) | Θ(n) | Θ(1) |

* amortised

Installation

$ npm install fibonacciheap

Methods

clear()

Clears the heap's data, making it an empty heap.

decreaseKey(node, newKey)

node: Node, the node to be decreased

newKey: number, the new key value

delete(node)

node: Node, the node to remove from the heap

extractMinimum()

Returns

Node, the node with the smallest key

findMinimum()

Returns

Node, the node with the smallest key

insert(key, value)

key: number,

value: object, any value associated with the node to insert

Returns

Node, the node that was inserted

isEmpty()

Returns

boolean, true if the heap is empty

size()  

Returns

number, the amount of nodes in the heap

union(other)

other: FibonacciHeap, the FibonacciHeap to union with this one

compare(a, b)  

a: Node, a node to compare

b: Node, a node to compare

Returns

number, 1 if a has a larger key than b, -1 if b has a larger key than a and 0 if they are equal

Running Tests

Install the development dependencies:

$ npm install

Then run the tests:

$ npm test

Code Coverage

Install the development dependencies:

$ npm install

Then run coverage

$ npm run coverage

View coverage reports

$ firefox coverage/lcov-report/index.html

Browser Bundle

$ npm run build

Keywords

FAQs

Package last updated on 10 Aug 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc