One that lets you modify the priority of keys.
My academic background tells me that a pairing_heap is excellent, but I've also heard good things of a meldable heap?
Of note is a nasty API issue around how you specify that a key is to be reprioritized.
My intuition is that push returns a token, and then you increase_key(&token, new_weight) or whatever. The token is a pointer to the node that contains the element, but this has a fundamental memory safety issue (the element associated with the token may have been popped).
One solution is to just make decrease/increase unsafe.
The other is to use Rcs internally, and have tokens be a Weak.
Neither is super great, honestly.
One that lets you modify the priority of keys.
My academic background tells me that a pairing_heap is excellent, but I've also heard good things of a meldable heap?
Of note is a nasty API issue around how you specify that a key is to be reprioritized.
My intuition is that
pushreturns a token, and then youincrease_key(&token, new_weight)or whatever. The token is a pointer to the node that contains the element, but this has a fundamental memory safety issue (the element associated with the token may have been popped).One solution is to just make decrease/increase unsafe.
The other is to use Rcs internally, and have tokens be a Weak.
Neither is super great, honestly.