I am implementing A* algorithm and I am stuck with the following piece of pseudo code :
if neighbor not in openset or tentative_g_score <= g_score[neighbor]
came_from[neighbor] := current
g_score[neighbor] := tentative_g_score
f_score[neighbor] := g_score[neighbor] + heuristic_cost_estimate(neighbor, goal)
if neighbor not in openset
add neighbor to openset
I want to optimize the openset checking so that I won't check if a node is openset twice in one algorithm pass.
I know that in bash there is something like :
if(( false == openedList_.ContainsNodeXY(n.X, n.Y)) &&
InOpenSet = false ){ .... }
With this I would have information about node being in or not in the openset.
How can I do this in C# ?
EDIT
openList_
is a List ( I have to have it sorted ) so it can't be a HashSet
.