In graph theory, breadth-first search (BFS) is a graph search algorithm that begins at the root node and explores all the neighboring nodes. Then for each of those nearest nodes, it explores their unexplored neighbor nodes, and so on, until it finds the goal.

2,091 questions
17views

### Finding the shortest path of a BFS solution

I am having difficulties to rewrite the path from the start to the end point after finding a BFS solution. I have found other questions similars to mine, but still couldnt understand what to do. I am ...
19views

### Valid path grid path finder

I was attempting to solve the problem where we have to say if a path is possible or not in a grid , considering that there are circles blocking the path . Here is the problem : https://www....
25views

### Finding shortest path in presence of hidden obstacles

I want to find the solution to the problem shown I am new to motion planning and also dont know much about graph based search algorithms. Here the "red" obstacles are not already known. ...
38views

### Use breadth first search in cypher (Neo4j) to do a complex calculating relationship score

I want to calculate a score from the cpt variables present on the edges between the nodes S (Blue), for this I would like to browse the graph as a tree for example. Maybe using BFS method. This is the ...
15views

### Issue regarding time complexity in Kahn's BFS algo for topological sort

Everywhere it is written that the Kahn's BFS algo for topological sorting takes O(V+E) time complexity but if I break down its code , I realized while calculating in-degree of vertices, we are ...
18views

### How can I convert .txt file to an array in python [closed]

I'm beginner to at phyton please don't make fun of me. I have a text file and I want to convert it to an array row by row. My txt file: ########### #0 # ## ##### ## ## # # X ## ### # #####...
24views

### Efficient implemetation of BFS on python

There is a following problem: Given set of n points with x, y coordinates. Distance between them is L1 : sum of abs of differences of corresponding coordinates. There is an edge between two points if ...
34views

### Are DFS and BFS interchangeable?

I know DFS is good for some problems and BFS is good for some other problems but if something can be solved using DFS, can it be solved (maybe less optimally) with BFS (or vise versa)? And is there a ...
1vote
28views

### Time complexity of two-way BFS

Time complexity of traditional (one-way) BFS is O(V+E) when an adjacency list is used. What is it in case of two-way BFS? Based on the answer here, I know: BFS will traverse 1 + B + B^2 + ... + B^k ...
22views

### dynamic programming grid problem approach solving using BFS in python

enter image description hereUpload your executable code here to the following algorithm problem statement: We have an NxM grid, grid have one element named Bob. Bob can travel diagonally blocks only. ...
44views

### Getting Wrong Answer in "Binary Tree Cameras" LeetCode Hard

I get a Wrong Answer in LeetCode question 968. Binary Tree Cameras: You are given the root of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, ...
42views

### How do I correct my Breadth First Search?

I've been trying to solve the following AI problem : https://www.hackerrank.com/challenges/botclean/problem Here's my code for the same : #include<iostream> #include<vector> #include <...
1vote
28views

### How to crop images / edges in a picture in OpenCV

Here's a picture of a maze solver, when the BFS function goes over the image it goes around the image I know it's possible to just crop the image manually, but I want a function where the computer can ...
51views

### Space complexity of "Number of islands" BFS solution on Leetcode

For the Leetcode question "Number of islands," I am trying to determine the SPACE complexity for the Breadth First Search solution. from collections import deque class Solution: def ...