Does Bfs Work on Directed Graphs

For directed graphs, too, we can prove nice properties of the BFS and DFS tree that help to classify the edges of the graph. For BFS in directed graphs, each edge of the graph either connects two vertices at the same level, goes down exactly one level, or goes up any number of levels.

Does BFS work on unweighted graphs?

BFS can be used to find shortest path in an unweighted cyclic graph as well. If a graph is unweighted, then BFS can be applied for SP regardless of having loops.

Does BFS work on cyclic graphs?

Yes, BFS works on cyclic graphs. You maintain a set of vertices you’ve already seen, and when a vertex that has previously been seen is seen again, you avoid adding it to the queue of vertices to explore.

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest