3 ms·
The key thing that distinguishes A* from BFS or DFS is that you use it when you want to make use of a distance metric to traverse a graph. What I mean by that i
by glenra 13y ago
The key thing that distinguishes A* from BFS or DFS is that you use it when you want to make use of a distance metric to traverse a graph. What I mean by that is you have some way of objectively measuring whether you are getting closer or getting further away from your goal as you progress along different possible paths.
For example, if the task is to find the shortest path between two cities on a highway map, you can calculate a straight-line "as the crow flies" distance to the goal from any point on the map - that is a usable distance metric. A* makes use of that additional information to find the shortest possible path while evaluating the fewest necessary number of alternative routes.
[Caveat: My dad invented A*, so I've probably got this laughably wrong. :-) ]