Home A star pathfinding algorithm
Post
Cancel

A star pathfinding algorithm

A star pathfinding algorithm

A* (pronounced “A star”) is a popular pathfinding algorithm used in computer science to find the shortest path between two points in a graph or map. It is a heuristic search algorithm, which means that it uses an estimate of the distance between nodes to guide its search.

The A* algorithm works by maintaining a list of nodes that have been visited, as well as a list of nodes that are yet to be visited. It starts at the starting node and explores the neighboring nodes, calculating their “f score,” which is a combination of the node’s distance from the start node and its estimated distance to the target node. The algorithm then selects the node with the lowest f score as the next node to explore, and continues this process until it reaches the target node.

One of the main advantages of the A* algorithm is its efficiency. It is able to quickly find the shortest path between two points in a graph, even if the graph is quite large. Additionally, the algorithm can be customized by changing the heuristic function used to estimate the distance between nodes. This allows the algorithm to be tailored to specific applications, such as pathfinding in video games or route planning for logistics.

  • A star pathfinding algorithm

Image

Source code

See online

This post is licensed under CC BY 4.0 by the author.