Sitemap
Python in Plain English

New Python content every day. Follow to join our 3.5M+ monthly readers.

Member-only story

An Introduction to A* Algorithm in Python

11 min readMar 15, 2022

--

Press enter or click to view image in full size

Hi everyone, today we are going to talk about one of the best and most famous search algorithms, the well-known A* Algorithm. Till now we had the opportunity to study and implement in Python a couple of search algorithms, such as the Breadth-First Search (BFS), the Depth First Search (DFS), the Greedy Algorithm, etc. Today we are closing the chapter with Search Algorithms talking about the A*. More specifically, we will talk about the following topics:

1. Introduction
2. Pseudocode
3. Pen and Paper Example
4. Python implementation
5. Example
6. Conclusion

As usual, we have a lot of stuff to cover, so let’s get started.

Introduction

As we have already discussed, search algorithms are used to find a solution to a problem that can be modeled into a graph. If you want to learn more about Graphs and how to model a problem, please read the related article. In brief, a graph consists of a set of nodes (or vertices) and edges that connect the nodes. Each state (situation) of the given problem is modeled as a node in the graph, and each valid action that drives us from one state to another state is modeled as an edge, between the corresponding nodes. In…

--

--

Andreas Soularidis
Andreas Soularidis

Written by Andreas Soularidis

Hi, my name is Andreas and I'm passionate about Programming, Algorithms, Machine Learning, Semantic Web, and IoT.

Python in Plain English
Python in Plain English

Published in Python in Plain English

New Python content every day. Follow to join our 3.5M+ monthly readers.