Algorithm-Visualizer
github.com
github.com
I still agree that comparing a DFS and an A* is a bit strange, they have different use cases.
https://github.com/hediet/vscode-debug-visualizer/blob/maste...
Also - is the behavior shown in the screenshot working as intended, as the shown path includes a detour?
> The heuristic function is problem-specific. If the heuristic function is admissible, meaning that it never overestimates the actual cost to get to the goal, A* is guaranteed to return a least-cost path from start to goal.
In this case the euclidean does not overestimate so I would guess there is a bug in the implementation.
[1] https://en.wikipedia.org/wiki/A*_search_algorithm
Edit:
Having taken a look at the source code I believe the problems mostly stem from the `addNeighboursToOpen` function [2]. It sets the distance and parent of unvisited neighbors of the current node. However this may happen multiple times for a node before it is actually visited. Meaning that the distance and parent is updated multiple times and the value at the end is not the optimal one. A simple fix would be to do a if check to see if the node already has a distance assigned.
[2] https://github.com/Walker-TW/Algorithm-Visualizer/blob/maste...
contact us if you have any exciting
jr. dev roles/opportunities
... it would help if you had contact details in your HN profile.Under "Depth First Search" you say:
> Depth first search is the only algorithm listed which will NOT find the shortest path.
That turns out not to be the case. Euclidean will also sometimes not find the shortest path. And indeed, you say so in the section on Euclidean you say:
> *However because our grid is only traversable on horizontal or vertical vertices using this heurtistic will NOT always give the shortest path, ..."
You also mis-spelled "heuristics", but that's easily done, and easily fixed.
The app is nice ... well done.