This project has moved. For the latest updates, please go here.

Priority Queues

May 24, 2013 at 12:41 PM
In the path finder algorithm, why do you switch between the two types of priority queues?

Does the heap queue perform better when the range is longer and does the dictionary queue perform better when the range is shorter?

var queue = goal.Range(start) > RangeCutoff
? (IPriorityQueue<uint, Path2>) new HeapPriorityQueue<uint, Path2>()
: (IPriorityQueue<uint, Path2>) new DictPriorityQueue<uint, Path2>();
May 24, 2013 at 9:20 PM
Edited May 24, 2013 at 10:34 PM
Yes, the heap-queue is more efficient, particularly at longer range. The dictionary queue chooses better "shaped" paths from equal "optimal-length" paths.

I have added an example of this to the (imminent) next release. Directions are in the tool-tip text for the new tool-strip control; let me know if they are insufficiently clear.

Illustrative code now uploaded in V 5.2