Opened 14 years ago
Last modified 6 years ago
#381 new enhancement
Simplified heaps without priority update — at Initial Version
Reported by: | Peter Kovacs | Owned by: | Alpar Juttner |
---|---|---|---|
Priority: | major | Milestone: | LEMON 1.5 release |
Component: | core | Version: | hg main |
Keywords: | Cc: | ||
Revision id: |
Description
The existing heap implementations in LEMON cointain an Item->int map to indicate the current location of each item. It is required to implement increase()
, decrease()
, erase()
, etc. functions.
However, simplified heaps could be implemented with a limited functionality (push()
, pop()
, top()
, prio()
, size()
, empty()
, clear()
, etc.) without this corss reference map. For such heaps, the basic push()
and pop()
operations could implemented more efficiently, but the duplications of items could not be avoided.
A Dijkstra or Prim algorithm could be implemented with such heaps, but it would require slight modifications. A node should be pushed each time its distance label is updated (i.e. more than once in some cases), and the duplicate nodes should be skipped after each pop()
operation.
This idea comes from the fact that the LEDA library also contains such an implementation of the binary heap structure and the Dijkstra algorithm, which turned out to be particularly efficient on some graphs. It was faster than the usual implementation by a factor between 1.5 and 2 on large graphs generated with NETGEN.
Therefore, it would be nice to introduce such implementations in LEMON. I think, they would lead to better performance in many practical cases, because not too many duplications would be expected on typical graphs. However, there are some problems with this proposal. First, such heaps would not conform to the current heap concept. Second, using them would reqiure different implementation of the algorithms.