Afterglowscreensavers

BFS vs DFS Explorer Screensaver

The BFS vs DFS Explorer screensaver runs real breadth-first and depth-first search on the same random graph side by side, so you can watch their traversal orders diverge live. It is free, runs in your browser, and ESC exits.

Live preview

Press ESC to leave fullscreen. Settings are saved in your browser only.

How the BFS vs DFS Explorer screensaver works

The saver builds one real random graph and explores two identical copies of it at once: one with real breadth-first search, one with real depth-first search.

Breadth-first search visits every neighbor of the current layer before moving deeper, so it spreads outward as a widening ring.

Depth-first search commits to one branch and follows it as far as possible before backtracking, so it snakes deep before it spreads.

Once both traversals finish visiting every reachable node, the graph fades and a fresh random graph begins.

A worked example

On the same graph, breadth-first search lights up an even, expanding ring of nodes, while depth-first search draws a single long, winding thread that only branches once it hits a dead end.

Settings & tips

Frequently asked questions

Are these real BFS and DFS implementations?
Yes — real, correct breadth-first and depth-first search, run on identical copies of the same graph.
Why do they look so different?
BFS explores layer by layer with a queue; DFS commits to one path with a stack, so their real visit orders diverge sharply.
Is a key needed?
No — it is a pure local computation.
Is it free?
Yes — free, no download, in your browser.

← All Science & Research screensavers