No discussion of A* etc is complete without a link to red blob games' interactive pages: <a href="https://www.redblobgames.com/pathfinding/a-star/introduction.html" rel="nofollow">https://www.redblobgames.com/pathfinding/a-star/introduction...</a>
Same story, made something similar in straight JavaScript while I was at school and never showed it to anyone:<p><a href="https://jayd.ml/algorithms/search/" rel="nofollow">https://jayd.ml/algorithms/search/</a> (source <a href="https://github.com/jaydenmilne/jaydenmilne.github.io/tree/master/algorithms/search" rel="nofollow">https://github.com/jaydenmilne/jaydenmilne.github.io/tree/ma...</a>)<p>Features:<p>- Draw your own maze!<p>- Several different algorithms!<p>- Adjust solving speed / step algorithm!<p>- Bugs!<p>- Share your mazes in the URL (abuse link shorteners to store your data! shorturl.at/ioyT9)<p>I'm quite proud of how I (ab)used async/await to increase the stack size and be able to easily step and delay the algorithms without having to rewrite them to be re-entrant.<p>(in case you're wondering, left click to draw walls, right click to place start then end node, left click and drag on walls to go into erase mode)
Two years ago I had to make a project about pathfinding for a university project, and I just realised I never showed it anywhere.<p>I made this little interactive playground for various pathfinding algorithms showing how they can be seen as a general algorithm with different a different queue and different heuristic in use.<p>The readme has some theory but the cool thing is the link to the app on netlify where you can experiment moving the positions of start, goal and of the obstacles.<p>If you're interested I'd suggest you keep the readme open while toying with the app, as the readme has more theory.
Nice work :) There's never going to bee too many learning materials with good visualizations.<p>For pathfinding, I've made one myself [0], and the Red Blob Games [1] one is also very popular.<p>[0] <a href="https://gabrielgambetta.com/generic-search.html" rel="nofollow">https://gabrielgambetta.com/generic-search.html</a><p>[1] <a href="https://www.redblobgames.com/pathfinding/a-star/introduction.html" rel="nofollow">https://www.redblobgames.com/pathfinding/a-star/introduction...</a>
For your non-admissible heuristic demo, it might also be interesting to look at squaring the euclidian distance and the affect of biasing the algorithm in this way.
I think the short summary is: Dijkstra is best when you don't know or care where you're going (there's no heuristic to tell you how close you are, or you want to know distances to all locations), but if that heuristic exists, A* is better.<p>I once used A* in a coding challenge for a job. Create a grid (in React) where you can place obstacles, wormholes, a start and a finish, and find the shortest route through it. The wormholes normally break A*, but I'd figured out a way to take them into account. Was a fun challenge. (Didn't take the job.)
I think your priority queue is doing O(nlogn) sort for every insert <a href="https://github.com/npretto/pathfinding/blob/master/src/algo/queues/PriorityQueue.js#L27" rel="nofollow">https://github.com/npretto/pathfinding/blob/master/src/algo/...</a><p>This should be a heap with O(logn) insert instead to be truly Dijsktra/A*
Nice job!<p>For others who want to play with visualizing different search algorithms, this is another cool tool:<p><a href="https://qiao.github.io/PathFinding.js/visual/" rel="nofollow">https://qiao.github.io/PathFinding.js/visual/</a>
Also interesting: <a href="https://observablehq.com/@mbostock/best-first-search" rel="nofollow">https://observablehq.com/@mbostock/best-first-search</a>, a visual display of A*
Very cool, thanks for sharing! Bonus points for non-gratuitous use of currying and generators in the implementation, not to mention clear and concise documentation. A+! :)
Very cool, well done!<p>It seems to crash (white page) if you cover the destination point with the constraint box.<p>You may want to look into (lazy) Theta* next