> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/sdgm/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/sdgm/_mcp/server.

# What are hops, and how do I control sampling?

> Control the graph context sampled for each training or prediction example

A **hop** follows one relationship in the graph. In a graph linking customers to orders and orders to line items, one hop reaches a customer's orders and two hops reach their line items.

For each training or prediction example, Kumo samples connected rows and their features. The **fanout** sets how many neighbors to request per node and relationship at each hop.

Set fanouts on the [model plan](/kumo-engine/user-code-guide/train-a-model/training#model-plan) before fitting:

```python
plan.neighbor_sampling.num_neighbors = [[20, 10]]
plan.neighbor_sampling.adaptive_sampling = False
```

This specifies one candidate configuration: up to 20 neighbors per node and relationship at the first hop, then up to 10 at the second. Sparse neighborhoods return fewer rows. The counts do not set a total neighborhood size.

Use `HopConfig` and `NumNeighborsConfig` for relationship and direction overrides. A count of `0` skips a relationship at that hop; `-1` requests all neighbors. Adaptive sampling can exceed nominal fanouts at later hops to compensate for sparse earlier hops, and requires nonnegative counts.

More hops or larger fanouts increase the context and resource requirements. See [Neighbor Sampling](/kumo-engine/user-code-guide/train-a-model/model-plan-guide#neighbor-sampling) for supported values and overrides.