Re: [PATCH 2/5] aga,agar: Dijkstra's algorithm

David Gibson <[email protected]> Fri, 13 Nov 2015 13:02:35 +1100
Newsgroups org.ozlabs.lists.ccan
Message-ID <[email protected]>
On Thu, Nov 12, 2015 at 04:59:51PM -0500, Emilio G. Cota wrote:
> On Thu, Nov 12, 2015 at 22:42:45 +1100, David Gibson wrote:
> > This uses the lpq module as the implementation of the priority queue.  That
> > means this implementation is some way behind the theoretical efficiency of
> > Dijkstra's algorithm.  It should be reasonably straightforward to swap out
> > the priority queue for a better one in the future, though.
> 
> Have you considered using the heap module?

The aga module (unlike agar) isn't supposed to allocate memory,
instead using the structures that the caller embeds in their own data
structures.

Unfortunately, that means it's not possible to use a binary heap - at
least not the usual array based implementation.  You could make a link
only based implementation, but it gets so horrible that you might as
well use a better data structure (e.g. a pairing heap) at that point.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

_______________________________________________
ccan mailing list
[email protected]
https://lists.ozlabs.org/listinfo/ccan
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJWRUS7AAoJEGw4ysog2bOSAEkP/jO+W6HTHFruJP5YH5tCQi/i
L1Z/OHqytvFVGLM8yg2mQKyqFb09EiDqk61WFSWpfwFG8B5yyAk3iwnpR8Puh4FO
p3MosrbQNIeGgCtmPzmi6EPGn+KK/+tqOMgS67w/ssBugB6JhT7QX/aBfxWF4uAk
sReAXlU5ub0WWE+D0/K6EUTgujukKBr0im4uTCckIie81kW8dsLl1PPimjRFnfBZ
bEBj08dGn/rPk70iuk3oDVDGdYwy2BLQNvRsA1Vwoc3btMSHo6SiQamgpTF/gSso
j0iX4x2mF7Z6IcEydK1NJcoIzZsy9SVTUECwWkoZHjl6sO//wVIJH9aV2EzOjRS0
WJAX5P9LjoBtObCLzqyx6dCyb5ZIjXA78+WzRXwWeEaE7rHNJ75An5gOqrypG7Jv
vkJptqoWQu+x2u9cLnj6LISLEq8SI6Ogr4SQR+7DMwJ3PiwzL0jNVJmtnRXEOtIN
zEB0G9qQ79ySq5MFgfagrnpiox9PFm/s9RaEC5QGsRIugq5LyQ/7QnjY+bKZbv6R
dYr/DsGLZv2BjnJK1/TMf/Oql2emrdTsHdTwaY7Dc9bQIX/Ob2F3lxgsh/fMkVs1
7Q92XtOwkBoHaNnuGrM4x4yWt56THkGS5Ddafsz3FJ42KEodbaE7OAiSM4D3f3er
hesUAefG4M8QiBWSMQJn
=PDVf
-----END PGP SIGNATURE-----