# path

> **path**(`result`, `target`): `Int32Array`<`ArrayBufferLike`> | `undefined`

Defined in: [packages/graph/src/path.ts:22](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/path.ts#L22)

The vertices of the path a search found from a source to `target`, source first, or `undefined` when the search never reached `target`. `O(path length)`.

## Parameters

### result

[`PathSource`](/reference/knotkit/graph/interfaces/pathsource/)

### target

`number`

## Returns

`Int32Array`<`ArrayBufferLike`> | `undefined`

## Throws

With code `INVALID_VERTEX` when `target` is outside the result.

## Example

```ts
path(breadthFirstSearch(graph, { sources: [0] }), 5) // Int32Array [0, 2, 5]
```
