Priority Queue with Mutable Elements
Scott David Daniels
scott.daniels at acm.org
Sat Jun 16 14:21:31 EDT 2007
Chris Lasher wrote:
> On Jun 15, 5:52 pm, Josiah Carlson <josiah.carl... at sbcglobal.net>
> wrote:
>> See this implementation of a "pair heap":
>> http://mail.python.org/pipermail/python-dev/2006-November/069845.html
>> ...which offers the ability to update the 'priority' of an entry in the
>> heap. It requires that the 'value' in (priority, value) pairs be unique
>> (to the heap) and hashable.
>>
>> - Josiah
>
> Hmm. I won't be able to use that heap, as I can guarantee that the
> value will be identical for two nodes when they have edges to each
> other and no other nodes. Any suggestions on structures that can
> accompany identical priority values?
>
> Thanks,
> Chris
>
Make the priority value for element: (intended_value, id(element))
always a total order that obeys the partial order implied by
intended_value.
--
--Scott David Daniels
scott.daniels at acm.org
More information about the Python-list
mailing list