Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Suggestion: DoublePriorityQueue with multiple priorities #45

Open
Zannick opened this issue Apr 4, 2023 · 0 comments
Open

Feature Suggestion: DoublePriorityQueue with multiple priorities #45

Zannick opened this issue Apr 4, 2023 · 0 comments

Comments

@Zannick
Copy link

Zannick commented Apr 4, 2023

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants