# Connected component with iterative DFS

> ML preparation item.

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

## Problem

Implement `component(graph, start)`, returning the set of vertices reachable from `start` in an adjacency dictionary. Use an explicit stack.


## Starter code

```python
def component(graph, start):
    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-dfs`, and record a real attempt with `recorded_by: "agent"` and `agent_session_id` when available using https://mlprep.iwase.dev/schema/attempt-record.json.
