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

updatable-priority-queue

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

updatable-priority-queue

A priority queue implementation based on a binary heap, with an efficient update-key operation

0.0.1
latest
Source
npm
Version published
Weekly downloads
1.9K
30.01%
Maintainers
1
Weekly downloads
 
Created
Source

updatable-priority-queue

A generic priority queue implementation based on a binary heap, with an efficient updateKey operation.

It was made first to support the pathfinding algorithms of my jKstra graph library, but it can probably serves other purposes.

$> npm install updatable-priority-queue

API

PropertyTypeDescription
countIntegerNumber of items stored in the queue.
MethodReturnsDescription
insert(item, key)VertexAdds an item to the queue, with a key used as sorting value.
pop(){item, key}Removes and returns the first item of the queue, with its associated key, or null if the queue is empty.
peek(){item, key}Reads the first item of the queue, with its associated key, without removing it, or null if the queue is empty.
updateKey(item, newKey)-Updates the key associated with an element.

Keywords

priority

FAQs

Package last updated on 25 Apr 2016

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