> Unlikely. Are you sure that .heap and .lookup contents are still in sync
> with your modification?
No it's not. Atfer having read about heapq it's clear why.
Thanks for the hint.
> allows you to delete random nodes, but the lowest() method will slow down as
> it has to iterate over all dict v
Robert Voigtländer wrote:
>
>> > > def pop(self):
>> > > f, node = heapq.heappop()
>> > > del lookup[node.pos]
>> > > return node
>
>> > That should be
>>
>> > def pop(self):
>>
>> > f, node = heapq.heappop(self.heap)
>> > del self.lookup[node.po
On 21/01/2014 13:43, Robert Voigtländer wrote:
[double spaced google disease snipped]
I'm pleased to see the regular contributors helping out as usual. In
response would you please be kind enough to read and action this
https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the
> > > def pop(self):
> > > f, node = heapq.heappop()
> > > del lookup[node.pos]
> > > return node
> > That should be
>
> > def pop(self):
>
> > f, node = heapq.heappop(self.heap)
> > del self.lookup[node.pos]
> > return node
>
> Hi Peter,
Am Dienstag, 21. Januar 2014 15:19:54 UTC+1 schrieb Peter Otten:
> Peter Otten wrote:
>
>
>
> > def pop(self):
>
> > f, node = heapq.heappop()
>
> > del lookup[node.pos]
>
> > return node
>
>
>
> That should be
>
>
>
> def pop(self):
>
> f, node
Peter Otten wrote:
> def pop(self):
> f, node = heapq.heappop()
> del lookup[node.pos]
> return node
That should be
def pop(self):
f, node = heapq.heappop(self.heap)
del self.lookup[node.pos]
return node
--
https://mail.python.org/mailma
Robert Voigtländer wrote:
>
>> On Tue, Jan 21, 2014 at 03:17:43AM -0800, Robert Voigtl�nder wrote:
>>
>
>> > I have objects like this:
>>
>> >
>>
>> > class Node(object):
>>
>> > def __init__(self, pos, parent, g , h):
>>
>> > self.pos = pos
>>
>> > self.parent = par
On Tue, Jan 21, 2014 at 05:38:34AM -0800, Robert Voigtländer wrote:
>
> > On Tue, Jan 21, 2014 at 03:17:43AM -0800, Robert Voigtl�nder wrote:
> >
>
> > > I have objects like this:
> >
> > >
> >
> > > class Node(object):
> >
> > > def __init__(self, pos, parent, g , h):
> >
> > >
Am Dienstag, 21. Januar 2014 14:38:34 UTC+1 schrieb Robert Voigtländer:
> > On Tue, Jan 21, 2014 at 03:17:43AM -0800, Robert Voigtl�nder wrote:
>
> >
>
>
>
> > > I have objects like this:
>
> >
>
> > >
>
> >
>
> > > class Node(object):
>
> >
>
> > > def __init__(self, pos, par
> On Tue, Jan 21, 2014 at 03:17:43AM -0800, Robert Voigtl�nder wrote:
>
> > I have objects like this:
>
> >
>
> > class Node(object):
>
> > def __init__(self, pos, parent, g , h):
>
> > self.pos = pos
>
> > self.parent = parent
>
> > self.g = g
>
> >
On Tue, Jan 21, 2014 at 03:17:43AM -0800, Robert Voigtländer wrote:
> Hi,
>
> which would be the best data structure to use for the following case?
>
> I have objects like this:
>
> class Node(object):
> def __init__(self, pos, parent, g , h):
> self.pos = pos
> self.paren
Robert Voigtländer writes:
> which would be the best data structure to use for the following case?
First up, I want to compliment you on asking exactly the right question.
Getting the data structure right or wrong can often shape the solution
dramatically.
> I have objects like this:
>
> class
On Tue, Jan 21, 2014 at 10:17 PM, Robert Voigtländer
wrote:
> 1. check if a specific item - identified by Node.pos - is in the list.
> 2. find the object with the lowest Node.f attribute and update or remove it
Are both those values constant once the Node is added? If so, the
easiest way would be
Hi,
which would be the best data structure to use for the following case?
I have objects like this:
class Node(object):
def __init__(self, pos, parent, g , h):
self.pos = pos
self.parent = parent
self.g = g
self.h = h
self.f = g+h
I need to bu
14 matches
Mail list logo