Breadth-first and depth-first search
Breadth-first and depth-first search one step at a time, with the queue or stack shown, and a check of which extra edges fit the BFS levels.
BFS visits every vertex at distance 1 before any at distance 2, so its levels are distances from the start.
DFS backtracks only when the current vertex has no unvisited neighbours.