---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/orchestration/plan/functions/routesBetween.md
---

# Function: routesBetween()

```ts
function routesBetween(
  view: RawPlanView | PlanGraphView,
  fromId: string,
  toId: string,
): string[][];
```

Defined in: [src/batteries/orchestration/plan.ts:270](https://github.com/NHTIO/ADK/blob/v1.20260906.0/src/src/batteries/orchestration/plan.ts#L270)

All distinct simple paths from one node to another.

## Parameters

| Parameter | Type                                                                                                           | Description          |
| --------- | -------------------------------------------------------------------------------------------------------------- | -------------------- |
| `view`    | | [`RawPlanView`](../../types/interfaces/RawPlanView.md) | [`PlanGraphView`](../interfaces/PlanGraphView.md) | The graph to search. |
| `fromId`  | `string`                                                                                                       | The start node id.   |
| `toId`    | `string`                                                                                                       | The target node id.  |

## Returns

`string`\[]\[]

Every distinct simple path from `fromId` to `toId`, truncated at MAX\_ROUTES.

## Remarks

A simple path is a route that visits no node twice. This is used to derive a join's `required`
(the number of fork→join routes) and to validate the diamond topology. The result is a list of
node-id sequences, each starting at `fromId` and ending at `toId`.

**Blowup guard.** The number of simple paths in a DAG can be exponential in the node count, so
this enumerates at most MAX\_ROUTES paths and stops. A caller that needs an exact count
(a join's `required`) must treat a truncated result as "too many to count" and refuse the graph
rather than trust a partial count — the freeze validator does exactly that. The cap is a
documented safety valve, not a correctness knob.
