I am in project using leafletJS to setting location on map, then finding shortest path between 2 locations. Current, I am applying A* Algorithm to find shortest path. But at starting point, it get wrong next node by H value is lower. Anyone help me add more conditions to selecting correct next node.

enter image description here

In pic, i try to find way to toilet icon from AI icon, right path is right side but method always take the left.

Sorry for bad english.

A* using 2 values to consider next node: Cost from start node to current, weight between current node to next node and value of next node to goal node. F(n) = g(n) + h(n);

0 Answers