Skip to content

Feature Suggestion: DoublePriorityQueue with multiple priorities #45

Description

@Zannick

Hey, I'm really appreciating the DoublePriorityQueue: it lets me easily remove entries from one end to avoid overfilling a constant size, kind of like a work-queue LRU cache.

Since the heap is internally just a heap of element indices, I've been pondering having a priority queue with two (or more) unrelated priority measures, stored in two different index heaps. That would add a constant factor to the O(log n) guarantees (based on arbitrary remove), but it'd unlock the ability for me to have two different strategies for the threads selecting work items from the queue. In particular, I'm performing a graph search where every work item has a few variables that I combine unscientifically into a "score", and rather than perfect an equation, I'd like to just use one variable independently as its own measure in one thread (without doing a linear map().min() over the whole heap).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions