Questions tagged [breadth-first-search]

For questions concerning the breadth-first search (BFS) algorithm, which is an algorithm for traversing or searching tree or graph data structures. BFS starts at the root of the tree (or graph), then explores all of the neighbor nodes at the present depth prior to moving on to the nodes at the next depth level.

See also Graph traversal (Wikipedia) and The breadth-first search algorithm (Khan Academy).

18 questions
10
votes
5 answers

How do I keep track of already visited states in breadth-first search?

I was trying to implement the breadth-first search (BFS) algorithm for the sliding blocks puzzle (number type). Now, the main thing I noticed is that, if you have a $4 \times 4$ board, the number of states can be as large as $16!$, so I cannot…
user9947
5
votes
1 answer

Why is breadth-first search only optimal when the cost solution is a non-decreasing function?

I am learning about searching strategies in AI and I was reading that breadth-first search is only optimal when the cost solution is a non-decreasing function? I am not really sure what this refers to since decreasing search cost should be our goal.…
xava
  • 423
  • 1
  • 3
  • 9
4
votes
1 answer

How do I train a bot to solve Katona style problems?

Cognitive psychology is researched since the 1940s. The idea was to understand human problem solving and the importance of heuristics in it. George Katona (an early psychologist) published in the 1940s a paper about human learning and teaching. He…
3
votes
1 answer

Why does the adversarial search minimax algorithm use Depth-First Search (DFS) instead of Breadth-First Search (BFS)?

I understand that the actual algorithm calls for using Depth-First Search, but is there a functionality reason for using it over another search algorithm like Breadth-First Search?
2
votes
1 answer

Why do we use a last-in-first-out queue in depth-first search?

Why do we use a last-in-first-out (LIFO) queue in the depth-first search algorithm? In the breadth-first search algorithm, we use a first-in-first-out (FIFO) queue, so I am confused.
2
votes
1 answer

What is the difference between the breadth-first search and recursive best-first search?

What is the difference between the breadth-first search and recursive best-first search? How can I describe the key difference between them?
Marosh Fatima
  • 375
  • 1
  • 3
  • 10
2
votes
2 answers

How do the BFS and DFS search algorithms choose between nodes with the "same priority"?

I am currently taking an Artificial Intelligence course and learning about DFS and BFS. If we take the following example: From my understanding, the BFS algorithm will explore the first level containing $B$ and $C$, then the second level containing…
Sergio
  • 123
  • 5
2
votes
0 answers

Why do we use the tree-search version of breadth-first search or A*?

In Artificial Intelligence A Modern Approach, search algorithms are divided into tree-search version and graph-search version, where the graph-search version keeps an extra explored set to avoid expanding nodes repeatedly. However, in breadth-first…
2
votes
1 answer

What is the space complexity of breadth-first search?

When using the breadth-first search algorithm, is the space complexity $O(b^d)$, where $b$ is the branching factor and $d$ the length of the optimal path (assuming that there is indeed one)?
user42125
1
vote
0 answers

How can we find the number of node expansions performed by BFS in this hexagonal map?

An agent aims to find a path on a hexagonal map, with an initial state $s_0$ in the center and goal state $s^*$ at the bottom as depicted below. The map is parametrized by the distance $n \geq 1$ from $s_0$ to any of the border cells ($n = 3$ in…
akano1
  • 111
  • 2
1
vote
0 answers

What would happen if we set the evaluation function in the best-first search algorithm as the cost of paths taken to new nodes?

I am reading Artificial Intelligence: A Modern Approach. In Chapter 3, Section 3.3.1, The best-first search algorithm is introduced. We learn that in each iteration, this algorithm chooses which node to expand based on minimizing an evaluation…
1
vote
2 answers

Is there any situation in which breadth-first search is preferable over A*?

Is there any situation in which breadth-first search is preferable over A*?
1
vote
1 answer

A way to leverage machine learning to reduce DFS/BFS search time on a tree graph?

I'm not very knowledgeable in this field but I'm wondering if any research or information already exists for the following situation: I have some data that may or may not look similar to each other. Each represents a node that represents a vector of…
1
vote
1 answer

What is the space complexity of bidirectional search?

Is the space complexity of the bidirectional search, where the breadth-first search is used for both the forward and backward search, $O(b^{d/2})$, where $b$ is the branching factor and $d$ the length of the optimal path (assuming that there is…
1
vote
0 answers

2 Partition Problem

I want to solve the two partition problem (https://en.wikipedia.org/wiki/Partition_problem) using an uninformed search algorithm (BFS or uniform cost). The states can be represented by three sets S1,S1,S where the set S contains unassigned values…
hyuj
  • 131
  • 4
1
2