Searching a Graph
Searching a Graph: How Many Steps Apart? Breadth-First Search, Who Can I Reach? Depth-First Search.
Updated
- How Many Steps Apart? Breadth-First Search (Journeyman): Find how many friendships apart two people are, the fewest, without listing every route or walking in circles: why both of those fail, and the search that fixes them, breadth-first search, with a queue and a visited set.
- Who Can I Reach? Depth-First Search (Journeyman): 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.