Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: Priority queue for Dijkstra
Home

[Freeciv-Dev] Re: Priority queue for Dijkstra

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Priority queue for Dijkstra
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Sat, 16 Mar 2002 18:51:36 +0000 (GMT)

On Sat, 16 Mar 2002, Raimar Falke wrote:

> > The current implementation of priority queue in gotohand.c is actually
> > O(1) --- as far as I can tell --- due to the limited set of possible
> > priorities.  But it's a bit ugly.  Maybe there is a standard heap method 
> > ( heap is O(log(n)) ) somewhere in C or hidden in freeciv code?
> 
> None that I know of. I found these (GPLed):
>     223     864    5646 heap.c
>      77     356    2206 heap.h
> 
> Do you think that a "real" priority queue performance or does it will
> "only" increase readability?

Raimar, you been drinking???

It would definitely increase performance of your goto agent from 
O(n log(n)) to O(log(n)).

Compared with the current mapqueue methods it will be inferior I am 
afraid.  But mapqueue is hardly extendable and priority queue is.

Readability of the "user" code will not change.  It's the internal 
representation of mapqueue that is ugly, not the interface.

Right now I just want my air route-finding to be working.  Later I will 
try to convert to the best queue.

G.




[Prev in Thread] Current Thread [Next in Thread]