-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Hey!
First of all thanks for sharing your pathfinding implementation.
I meet a small issue and was wondering whether it is something I am doing wrong or whether it is in fact a small bug. Sometimes when using the ShortestPathGraphSearch I am getting an error with this class's use of PriorityQueue.Replace(). I did the following small update without getting any adverse effects but am not 100% sure it's legit. Am sharing it here just in case:
public void Replace(V value, P oldPriority, P newPriority){
if (list.ContainsKey(oldPriority))
{
LinkedList<V> v = list[oldPriority]; // <--- this was breaking
v.Remove(value);
if (v.Count == 0)
{ // nothing left of the top priority.
list.Remove(oldPriority);
}
}
Enqueue(value, newPriority);
}
Thanks again,
A
Metadata
Metadata
Assignees
Labels
No labels