TheAlgorithms / C-Sharp

All algorithms implemented in C#.
GNU General Public License v3.0
7.13k stars 1.52k forks source link

Addition of the A* graph search algorithm #421

Closed el2-d2-42 closed 1 year ago

el2-d2-42 commented 1 year ago

I propose adding the A algorithm, a widely used graph traversal and path search method in computer science. A is valued for its completeness, optimality, and efficiency, but it has a practical limitation in its memory usage (O(b^d)). Despite this, it often outperforms other algorithms, except in cases where graph pre-processing or memory-bounded approaches are applicable. This algorithm was introduced by Peter Hart, Nils Nilsson, and Bertram Raphael at Stanford Research Institute in 1968. It's an extension of Dijkstra's algorithm, using heuristics to guide its search. Unlike Dijkstra's, A* focuses on finding the shortest path from a specific source to a defined goal, rather than generating the entire shortest-path tree. This distinction is a necessary trade-off for employing a specific-goal-directed heuristic. I would love to implement this algorithm and provide detailed documentation, since I just studied this algorithm in my Algorithms and Data Structures course at university. It's best described in book(s), on website(s):

siriak commented 1 year ago

It is already implemented here https://github.com/TheAlgorithms/C-Sharp/blob/e9537abce04c5d9c984fd8f89bf30254c757656d/Algorithms/Search/AStar/AStar.cs#L8

el2-d2-42 commented 1 year ago

Completely missed it - was searching for it in the graphs section. Nvm