# DijkstraOptions

Defined in: [packages/graph/src/dijkstra.ts:28](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/dijkstra.ts#L28)

Where a shortest-path search starts, where it may stop, and what an edge costs.

## Properties

### sources

> `readonly` **sources**: `Iterable`<`number`>

Defined in: [packages/graph/src/dijkstra.ts:30](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/dijkstra.ts#L30)

Start vertices, all at distance `0`.

***

### target?

> `readonly` `optional` **target?**: `number`

Defined in: [packages/graph/src/dijkstra.ts:32](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/dijkstra.ts#L32)

One requested destination. When `targets` is also set, the search waits for all requested destinations.

***

### targets?

> `readonly` `optional` **targets?**: `Iterable`<`number`, `any`, `any`>

Defined in: [packages/graph/src/dijkstra.ts:34](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/dijkstra.ts#L34)

Stop once all these vertices and `target`, if supplied, settle. Duplicates are ignored.

***

### cost?

> `readonly` `optional` **cost?**: (`from`, `to`, `weight`) => `number`

Defined in: [packages/graph/src/dijkstra.ts:42](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/dijkstra.ts#L42)

The cost of walking one edge, in place of its stored weight. Called with the edge’s endpoints and stored weight (`1` when unweighted), once for every edge out of each expanded vertex. The last requested target settles without expansion. The callback must return a non-negative number and leave the graph unchanged. `Infinity` skips the edge.

#### Parameters

##### from

`number`

##### to

`number`

##### weight

`number`

#### Returns

`number`

***

### trace?

> `readonly` `optional` **trace?**: [`DijkstraStep`](/reference/knotkit/graph/type-aliases/dijkstrastep/)\[]

Defined in: [packages/graph/src/dijkstra.ts:48](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/dijkstra.ts#L48)

Receives a [DijkstraStep](/reference/knotkit/graph/type-aliases/dijkstrastep/) for each settle and relaxation, in order, so a caller can replay the search. Omitted, the search allocates no step objects. A relaxation’s `weight` is the cost the search used, after `cost`.
