Maintainers

Classifiers

Project description

PriorityQ is a library for managing a priority queue (PQ) with a cleaner API to enable custom comparators,
finding references to values efficiently (in constant time) and deleting values from the PQ. This was
developed because the current heapq module (in python’s standard library) does not provide an efficient
find operation (it is O(n)) and has no easy way to deleting an element and ensuring the heap invariant
afterwards.

Features

O(1) finding of elements

Deletion of elements possible (in O(log n)).

Adjusting of the priority of an element without requiring a deletion followed by an insertion.

Opaque handles to elements that can be used to reference to the same item again.

Duplicate elements allowed.

Custom comparator function can be passed to the PQ itself instead of needing to implement __cmp__.