Home > Net >  Can BFS be used to find single source shortest path in an unweighted directed graph?
Can BFS be used to find single source shortest path in an unweighted directed graph?

Time:08-05

I know BFS can be used to find shortest path from source to destination in an unweighted and undirected graph . But I wanted to know if BFS can also be used for unweighted and directed graphs or not ?

CodePudding user response:

Yes, the BFS algorithm works for every graph with unweighted edges.

Thus it can be used for a graph with directed edges as well as long as it does not contain any weights.

  • Related