Graph visualizer
Breadth-First Search
Explore a graph level by level using a queue.
Best O(1)Average O(V + E)Worst O(V + E)Space O(V)
Example Graph
A-B, A-C, B-D, B-E, C-F, C-G, E-H, F-HVisualization
FrontierEmpty
CurrentFrontierVisitedFound
Metrics
Comparisons0
Visited0
Progress0%
Time taken0.0s
bfs(graph, start, target)queue = [start]mark start as discoveredwhile queue is not emptynode = queue.removeFront()check nodeif node == target: return nodefor each neighbor of nodeif neighbor is unvisitedadd neighbor to queuereturn not found