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.

learn more… | top users | synonyms

3
votes
1answer
39 views

BFS implementation that walks a tile-based field

I wrote a BFS implementation that walks a tile-based field. It takes a function that should return true for walkable tiles and false for walls. It also takes the start and end points. It currently ...
4
votes
1answer
57 views

Binary Tree Level Order Traversal Algoritm

I am trying to solve this Binary tree lever order traversal ...
4
votes
1answer
88 views

Modified BFS code optimizations

I need some help reviewing this code in terms of making as fast as possible. This is a modified version of BFS that does quite a bit of processing on the side. Use case: I have a large graph ...
2
votes
1answer
51 views

Solve a maze in the form of a 2D array using BFS - Haskell

Suggestions for improving coding style are greatly appreciated. ...
2
votes
0answers
48 views

Solve a maze in the form of a 2D array using BFS

Suggestions for improving coding style are greatly appreciated. ...
3
votes
2answers
148 views

Time Limit Exceeded in BFS maze solver

Here's a problem that I tried solving : Lakshagraha was a house built of lacquer, made by the Kauravas to kill the Pandavas. The Kauravas wanted to burn the house down when the Pandavas were ...
0
votes
1answer
1k views

Breadth-first tree traversal using STL list

I am writing code for breadth-first search of a tree with C++'s STL. Please help as I am new to the STL. ...
6
votes
1answer
217 views

Shortest Path in a Unit Cost DAG BFS in Hadoop

Just got done implementing a shortest path algo of a unit cost DAG BFS in Hadoop and wanting to get anyone's opinion on how I could have done it better. The main issue I see is that I lose the ...
2
votes
1answer
158 views

DFS/BFS implementation Cormen's pseudo code

I like this site and thought if putting this dfs/bfs C++ code for Cormen pseudo code.....please give your comments ...
6
votes
1answer
204 views

BFS for creating a queue without repetitions and with loops in the graph

I have a pipeline with loops of filters and one input filter. The rest are splitters, transform and output. I would like my code to go over the filters and push them into a queue (order is ...
2
votes
1answer
98 views

BFS implementation to find connected components taking too long

This is in continuation to a question I asked here. Given the total number of nodes (employees) and the adjacency list (friendship amongst employees), I need to find all the connected components. ...
1
vote
0answers
130 views

T-SQL BFS center node of undirected graph [closed]

I am trying to answer this question by using a breadth-first search from each node of the graph represented by the tables mapSolarSystems and ...
3
votes
3answers
1k views

Shortest path in a grid between two points. Code optimization

I have this problem where I have to find the shortest path in an NxM grid from point A (always top left) to point B (always bottom right) by only moving right or down. Sounds easy, eh? Well here's the ...
2
votes
1answer
940 views

Breadth- and Depth-first search code

Here is my breadth-first search (bfs) and depth-first search (dfs) code for graph traversal. Please give me some constructive ...
6
votes
1answer
1k views

Improve Graph Adjacency List Implementation and Operations

I am studying graphs and I am trying to make a library in C# for myself and anyone else interested, that is didactic and simple, so I can remember how to solve common problems. I would like to ...
2
votes
2answers
596 views

Code review of Pouring water from code chef using Scala

I had posted this question on Stackoverflow and it seems like code review might be a better venue for my query. My question is as follows: I am trying to solve the pouring water problem from codechef ...