The article doesn't explicitly state it in this manner in one concise place, but the way I would always think about A* from a "practical/easy-to-remember" perspective back when I was doing competitive programming is that they're all the same algorithm, but with different priorities on the priority queue: Breadth-first Search: Priority is order of discovery of edges (that is, no priority queue/just a regular queue) Di…
Another way I like to think about it is that every graph traversal can be represented as a white set of unknown nodes, a grey set of known but unvisited nodes, and a black set of visited nodes. The data structure used to represent the grey set defines the algorithm: DFS = queue BFS = stack Dijstra's = priority queue keyed by edge weight A* = priority queue with heuristic function Beam search = bounded priority queue…
Introduction to the A* Algorithm (2014)
91–100 of 111 posts
Re: Introduction to the A* Algorithm (2014)
#92The article doesn't explicitly state it in this manner in one concise place, but the way I would always think about A* from a "practical/easy-to-remember" perspective back when I was doing competitive programming is that they're all the same algorithm, but with different priorities on the priority queue: Breadth-first Search: Priority is order of discovery of edges (that is, no priority queue/just a regular queue) Di…
Re: Introduction to the A* Algorithm (2014)
#93Earlier quoted context omitted.
Another way I like to think about it is that every graph traversal can be represented as a white set of unknown nodes, a grey set of known but unvisited nodes, and a black set of visited nodes. The data structure used to represent the grey set defines the algorithm: DFS = queue BFS = stack Dijstra's = priority queue keyed by edge weight A* = priority queue with heuristic function Beam search = bounded priority queue…
A* = priority queue with heuristic function _with specific properties_ ... in particular it must be an "admissible" hueristic that never overestimates the true value.
Re: Introduction to the A* Algorithm (2014)
#94Earlier quoted context omitted.
OP's point is that · BFS is priority queue with key h(n) + g(n) , where h(n) = 0 , g(n) = #edges · Dijkstra's is priority queue with key h(n) + g(n) , where h(n) = 0 , g(n) = sum over edges · A* is priority queue with key h(n) + g(n) , where h(n) = heuristic(n) , g(n) = sum over edges It's cute.
> OP's point is that > BFS is priority queue with key h(n) + g(n), where h(n) = 0, g(n) = #edges He doesn't say that, and it isn't true.
Re: Introduction to the A* Algorithm (2014)
#95Re: Introduction to the A* Algorithm (2014)
#96A* is simple enough, but how do you handle pathfinding when the environment isn’t known to the entity?
Iirc, the best approaches for this nowadays are machine learning based. Otherwise, you probably want to do an exploration step first, and bake in the environment.
Re: Introduction to the A* Algorithm (2014)
#97The article doesn't explicitly state it in this manner in one concise place, but the way I would always think about A* from a "practical/easy-to-remember" perspective back when I was doing competitive programming is that they're all the same algorithm, but with different priorities on the priority queue: Breadth-first Search: Priority is order of discovery of edges (that is, no priority queue/just a regular queue) Di…
Any other tips for competitive coding ie a book or source of wisdom in a similar vein?
Re: Introduction to the A* Algorithm (2014)
#98The article doesn't explicitly state it in this manner in one concise place, but the way I would always think about A* from a "practical/easy-to-remember" perspective back when I was doing competitive programming is that they're all the same algorithm, but with different priorities on the priority queue: Breadth-first Search: Priority is order of discovery of edges (that is, no priority queue/just a regular queue) Di…
Another way I like to think about it is that every graph traversal can be represented as a white set of unknown nodes, a grey set of known but unvisited nodes, and a black set of visited nodes. The data structure used to represent the grey set defines the algorithm: DFS = queue BFS = stack Dijstra's = priority queue keyed by edge weight A* = priority queue with heuristic function Beam search = bounded priority queue…
Re: Introduction to the A* Algorithm (2014)
#99Earlier quoted context omitted.
Any other tips for competitive coding ie a book or source of wisdom in a similar vein?
leetcode will strengthen the youngblood programmer for competitive matters such as competitions or interviews
Re: Introduction to the A* Algorithm (2014)
#100Earlier quoted context omitted.
Another way I like to think about it is that every graph traversal can be represented as a white set of unknown nodes, a grey set of known but unvisited nodes, and a black set of visited nodes. The data structure used to represent the grey set defines the algorithm: DFS = queue BFS = stack Dijstra's = priority queue keyed by edge weight A* = priority queue with heuristic function Beam search = bounded priority queue…
This is very insightful and a handy mental model I'll be using thanks. A small nit is that I think you have DFS and BFS swapped?