BFS ever failing for a unweighted and undirected graph?

55 Views Asked by At

So I am just doing some work for my algorithms class and I was just wonder does a BFS tree ever fail on finding the single source shortest path I know that BFS finds the shortest path with the least amount of edges and I am pretty convinced BFS never fails on a unweighted graph

Ive drew multiple graphs by hand and the bfs graph and they all have turned out to be the single single source shortest path.

2

There are 2 best solutions below

4
StepUp On

I think that BFS never fails to find the shortest path because BFS:

0
RossK92 On

Yeah, BFS will absolutely fail on an unweighted and undirected graph; you just have to use too much memory...