Beam Search Algorithm | Baeldung on Computer Science
In this tutorial, we’ll go over the definition of the Beam Search algorithm, explain how it works, and zoom in on the role of the beam size in the algorithm. Beam Search is a greedy search algorithm similar to Breadth-First Search (BFS) and Best First Search (BeFS). In fact, we’ll see that the two algorithms are special cases of the beam search. Let’s assume that we have a Graph () that we want to traverse to reach a specific node. We start with the root node. The first step is to expand this node with all the possible nodes. Then, at each step of the algorithm, we choose a specific number of nodes, say , from the possible ones to expand. Let’s call the beam width. These nodes are the optimal ones based on our heuristic cost. The expansion continues until reaching the goal node. Let’s keep in mind that if , it’ll become BeFS algorithm since we’ll select the best one to expand at each step which is exactly how BeFS works. But, on the other hand, if , it becomes the breadth-first search
Summer Sale 2026 – NPI EA (cat = Baeldung on CS) Yes, we're now running our only Summer Sale. All Courses are 30% off until 20th July, 2026 : >> EXPLORE ACCESS NOW Baeldung Pro – CS – NPI EA (cat = Baeldung on Computer Science) Learn through the super-clean Baeldung Pro experience: >> Membership and Baeldung Pro . No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with. 1. Overview In this tutorial, we’ll go over the definition of the Beam Search algorithm, explain how it works, and zoom in on the role of the beam size in the algorithm. 2. How Does Beam Se
Explore this link on the map →related reading
- What is Beam Search? Explaining The Beam Search Algorithm | Width.aiwidth.ai
- Breadth-first search - Wikipediaen.wikipedia.org
- Stream of Search (SoS): Learning to Search in Languagearxiv.org
- Visualizing Algorithmsbost.ocks.org
- Alpha–beta pruning - Wikipediaen.wikipedia.org
- Hierarchical Navigable Small Worlds (HNSW) | Pineconepinecone.io
- Combinatorial search - Wikipediaen.wikipedia.org
- Monte Carlo Tree Search: An Introduction | Towards Data Sciencetowardsdatascience.com
- Depth-first search - Wikipediaen.wikipedia.org
- Chess Engines: A Zero to One Guidechessengines.super.site
- Okapi BM25 - Wikipediaen.wikipedia.org
- The Anatomy of a Search Engineinfolab.stanford.edu