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

# Ball Cover

_Source header: `cuvs/neighbors/ball_cover.hpp`_

## Types

<a id="neighbors-ball-cover-index"></a>
### neighbors::ball_cover::index

Stores raw index data points, sampled landmarks, the 1-nns of index points

to their closest landmarks, and the ball radii of each landmark. This class is intended to be constructed once and reused across subsequent queries.

```cpp
template <typename idx_t, typename value_t>
struct index : cuvs::neighbors::index { ... };
```

**Fields**

| Name | Type | Description |
| --- | --- | --- |
| `handle` | `raft::resources const&` |  |
| `m` | `int64_t` |  |
| `n` | `int64_t` |  |
| `n_landmarks` | `int64_t` |  |
| `X` | `raft::device_matrix_view<const float, idx_t, raft::row_major>` |  |
| `metric` | [`cuvs::distance::DistanceType`](/api-reference/cpp-api-distance-distance#distance-distancetype) |  |

## Random Ball Cover algorithm

<a id="neighbors-ball-cover-build"></a>
### neighbors::ball_cover::build

Builds and populates a previously unbuilt cuvs::neighbors::ball_cover::index

```cpp
void build(raft::resources const& handle, index<int64_t, float>& index);
```

Usage example:

cuvs::neighbors::ball_cover::index

**Parameters**

| Name | Direction | Type | Description |
| --- | --- | --- | --- |
| `handle` | in | `raft::resources const&` | library resource management handle |
| `index` | inout | [`index<int64_t, float>&`](/api-reference/cpp-api-neighbors-ball-cover#neighbors-ball-cover-index) | an empty (and not previous built) instance of |

**Returns**

`void`