Top "Breadth-first-search" questions

In graph theory, breadth-first search (BFS) is a graph search algorithm that begins at the root node and explores all the neighboring nodes.

What is time complexity of BFS depending on the representation of the graph?

I was wondering what is the time complexity of BFS, if I use: an adjacency matrix adjacency list edge list …

data-structures graph graph-algorithm breadth-first-search
Finding the number of paths of given length in a undirected unweighted graph

'Length' of a path is the number of edges in the path. Given a source and a destination vertex, I …

algorithm graph routes depth-first-search breadth-first-search
Why does the time complexity of DFS and BFS depend on the way the graph is represented?

The site http://web.eecs.utk.edu/~huangj/CS302S04/notes/graph-searching.html describes that when an adjacency list is …

data-structures graph time-complexity graph-algorithm breadth-first-search
Explain BFS and DFS in terms of backtracking

Wikipedia about Depth First Search: Depth-first search (DFS) is an algorithm for traversing or searching a tree, tree structure, or …

graph backtracking depth-first-search breadth-first-search
How do you use a Bidirectional BFS to find the shortest path?

How do you use a Bidirectional BFS to find the shortest path? Let's say there is a 6x6 grid. The …

algorithm path-finding shortest-path breadth-first-search bidirectional
Shortest path: DFS, BFS or both?

I know BFS alone can find the shortest path in an unweighted graph but I also read on a couple …

algorithm graph depth-first-search breadth-first-search
Finding the shortest path nodes with breadth first search

I am running breadth first search on the above graph to find the shortest path from Node 0 to Node 6. My …

java algorithm data-structures breadth-first-search
How to implement a breadth first search to a certain depth?

I understand and can easily implement BFS. My question is, how can we make this BFS limited to a certain …

java algorithm search depth-first-search breadth-first-search
What is breadth-first search useful for?

Usually when I've had to walk a graph, I've always used depth-first search because of the lower space complexity. I've …

algorithm search graph-theory breadth-first-search depth-first-search
Is the runtime of BFS and DFS on a binary tree O(N)?

I realize that runtime of BFS and DFS on a generic graph is O(n+m), where n is number …

algorithm binary-tree time-complexity depth-first-search breadth-first-search