# Who Can I Reach? Depth-First Search

Find everyone a person can reach through friends, and split a network into the groups that don't touch, with a short recursive walk that never goes round in circles: why the folder walk from Module 3 loops forever here, and the search that fixes it, depth-first search, and when to choose it over breadth-first search.

![Cheat sheet: Who Can I Reach? Depth-First Search](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/6151313ee10740fc967db49b6b7d4c6e.webp)

- Category: Data Structures
- Level: Journeyman
- Tags: Breadth-First Search, Connected Component, data structures, Depth-First Search, Graph, Recursion (data-structures)
- Updated: November 3, 2026

Source: https://www.ask-codey.com/cheat-sheets/ds-dfs-cheat-sheet
