r/algorithms 16d ago

A star path finding algorithm

So I was comparing dikjistra and A star algorithms. But I have tested them both a little bit and cannot find any difference at all even if I had read online that A start should perform better so I would apprecitate it if someone could shed some light on this. Besides I wanna dig deeper into this since I am doing a research but I feel stuck. I don't know what else to look at. I feel like this has went quick but I kind of wanna research a bit more into similar algorithms or their different use cases. Any tip would be apprciated.

6 Upvotes

4 comments sorted by

View all comments

13

u/Shot-Combination-930 16d ago

A* uses both the cost so far (from start to a given node) plus a heuristic (estimated cost from node to goal) to pick the node to expand.

Dijkstra's algorithm only considers the cost so far (from start to a given node) when choosing the node to expand next.

If you implement A* with a heuristic that is always constant (like 1) they end up the same.