> For the complete documentation index, see [llms.txt](https://wiki.ariitk.in/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.ariitk.in/wiki/concepts/path-planning/a-algorithm.md).

# A\* Algorithm

This algorithm uses the concept of a heuristic destination, which implies that the minimum distance is encountered in the direction of destination. Although, sometimes it might go wrong due to some obstacles encountered in between and we might need to head in the opposite direction.

![](https://2216434675-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVITCb6SLM7LAIvJagI%2F-LVP8aeBCo-ghj3_8g_1%2F-LVP9RN4xlOUVG5Szoew%2FA*2.png?alt=media\&token=b140c05d-3ccd-4536-975c-12d4efb9366a)

Some common heuristic functions used are the Euclidean distance and the Manhattan distance. We proceed to the neighbouring node closest to the destination and then update the neighbors of the node.

![](https://2216434675-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVITCb6SLM7LAIvJagI%2F-LVP8aeBCo-ghj3_8g_1%2F-LVP8lV8qpgqIRGoy2I-%2FA*1.png?alt=media\&token=b272f16f-c545-4ea9-9103-86b2aa606b0f)

For more detailed information refer:

{% embed url="<https://en.wikipedia.org/wiki/A*_search_algorithm>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://wiki.ariitk.in/wiki/concepts/path-planning/a-algorithm.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
