# Compute unweighted distances with BFS

> ML Prep screening item.

- Stable ID: `prog-ds-bfs-distances`
- Collection: screening
- Area: Programming
- Topic: Data Structures
- Origin: original
- Difficulty: medium
- Expected time: 18 minutes
- Skills: queue, bfs, dictionaries, hash-map
- Item JSON: https://mlprep.iwase.dev/item/prog-ds-bfs-distances.json

## Problem

Implement `bfs_distances(graph, start)` for a directed unweighted graph
represented by a dictionary from a node to its neighbors in deterministic
list order. Return a dictionary mapping each reachable node to its minimum
edge distance from `start`. A node mentioned only as a neighbor has no
outgoing edges.


## Answer policy

The human page contains a collapsed answer. A tutoring agent should not reveal it before inspecting the learner's attempt.

## Tutoring contract

Ask for the learner's attempt, begin with the smallest useful hint, preserve item ID `prog-ds-bfs-distances`, and record a real attempt with `recorded_by: "agent"` and `agent_session_id` when available using https://mlprep.iwase.dev/schema/attempt-record.json.
