# Breadth-first walk over links from `from_nodes` (`{"paths": [...]}` and/or `{"table", "where"}`).

`POST /datanotes/operations/graph_traverse/` (operation `graph_traverse`)

Breadth-first walk over links from `from_nodes` (`{"paths": [...]}` and/or `{"table", "where"}`).

- `direction`: out (default, follow links), in (follow backlinks) or both.
- `edges`: edge labels to follow (link columns such as `people`, `event`, or `link`).
- `tables`: return only notes of these tables; `through`: only walk on through these tables.
- `min_depth` (default 1) / `max_depth` (default 2, max 10), `limit` (default 500).

Each node comes with `depth` and `via` (one shortest route). Example — moods tied to events
with Alice: from `{"table": "person", "where": {"name": "Alice"}}`, direction `in`, edges
`["people", "event"]`, tables `["mood"]`, max_depth 2. Feed the paths to `select_rows` with
`where: {"path": {"in": [...]}}` to aggregate them.

## Request body

`application/json`, required

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `from_nodes` | `object` | yes |  |  |
| `direction` | `"out" \| "in" \| "both" \| null` | no | `null` |  |
| `edges` | `string[] \| null` | no | `null` |  |
| `tables` | `string[] \| null` | no | `null` |  |
| `through` | `string[] \| null` | no | `null` |  |
| `min_depth` | `integer \| null` | no | `null` |  |
| `max_depth` | `integer \| null` | no | `null` |  |
| `limit` | `integer \| null` | no | `null` |  |

## Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | Done. | `object` (application/json) |
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
| 500 | Unexpected error. | `Error` (application/json) |

The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
