Skip to content

Depth-first search

networks

Level 2 of 3

Also called DFS.

Goes as deep as the roads allow before turning back. From the start, keep following a road to a place you have not reached yet, and when a place has no such road left, step back to the place you came from and carry on from there.

the map

the stack

roads looked along
0

step 1 of 1

Examples

Tap a spot to put your pen down there, then tap a spot next to it to draw a road. Keep tapping to draw on.

Places stand in two rows, A to D above and E to H below. A road joins two places side by side, one above the other, or corner to corner (one road across each square), with a dash: A-B. Separate roads with commas, then a semicolon and where to start: A-B, A-E, B-F; A.