# Shortest unweighted distance with BFS

> ML preparation item.

- Stable ID: `original-py-bfs`
- Area: Programming
- Topic: Data Structures
- Origin: original
- Expected time: 12 minutes
- Skills: queue, bfs, dictionaries-sets, hash-map, complexity
- Item JSON: https://mlprep.iwase.dev/data/items/original-py-bfs.json

## Problem

Implement `shortest_distance(graph, start, goal)` for an adjacency dictionary. Return the number of edges in a shortest path, or `None` when `goal` is unreachable.


## Starter code

```python
def shortest_distance(graph, start, goal):
    pass

```

## Answer policy

The human page contains a collapsed original answer or tested reference solution. 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 `original-py-bfs`, and record a real attempt with `recorded_by: "agent"` and `agent_session_id` when available using https://mlprep.iwase.dev/schema/attempt-record.json.
