> ## Documentation Index
> Fetch the complete documentation index at: https://vecgrep.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# graph_neighbors

> Explore the structural neighbourhood of a graph node

## Overview

Returns the immediate (or multi-hop) structural neighbourhood of a given node in the knowledge graph. Use this to navigate the codebase: find what a function calls, what calls it, what it imports, and what class it belongs to.

## Parameters

| Parameter | Type      | Default  | Description                                                                                                           |
| --------- | --------- | -------- | --------------------------------------------------------------------------------------------------------------------- |
| `node_id` | `string`  | required | Node ID or label substring (e.g. `"VectorStore"`, `"authenticate_user"`). Use `search_graph` first to find exact IDs. |
| `path`    | `string`  | required | Absolute path to the codebase root directory                                                                          |
| `depth`   | `integer` | `1`      | Number of hops to traverse (1–4)                                                                                      |

## Example

```
graph_neighbors("VectorStore", "/path/to/myproject", depth=1)
```

**Returns:**

```
Node: VectorStore  [class]
  Source: src/vecgrep/store.py:49-352
  ID: store_vectorstore

Callers (called by) (18):
  • _get_store  [function]  src/vecgrep/server.py:136
  • migrate_project  [function]  src/vecgrep/migrate.py:12
  ...

Contains (18):
  • search  [method]  src/vecgrep/store.py:292
  • add_chunks  [method]  src/vecgrep/store.py:180
  ...
```

## Finding node IDs

Node IDs are auto-generated from the file path and symbol name (e.g. `store_vectorstore`, `auth_authenticate_user`). You can pass a label substring instead and VecGrep will find the closest match:

```
graph_neighbors("authenticate_user", "/path/to/myproject")
```

Use `search_graph` to browse nodes and discover exact IDs.

## Relationship directions

| Relationship   | Description                            |
| -------------- | -------------------------------------- |
| `callers`      | Nodes that call this node              |
| `callees`      | Nodes this node calls                  |
| `imports`      | Modules this node imports              |
| `contains`     | Child nodes contained within this node |
| `contained_by` | Parent node that contains this node    |
| `inherits`     | Classes this class inherits from       |

## Notes

* Requires `index_graph` to have been run first
* `depth=1` returns direct neighbours only; higher values traverse transitively
* Maximum depth is 4
* Node IDs can be discovered via `search_graph`
