Skip to content

Defined in: packages/graph/src/dijkstra.ts:28

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

readonly sources: Iterable<number>

Defined in: packages/graph/src/dijkstra.ts:30

Start vertices, all at distance 0.


readonly optional target?: number

Defined in: packages/graph/src/dijkstra.ts:32

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


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

Defined in: packages/graph/src/dijkstra.ts:34

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


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

Defined in: packages/graph/src/dijkstra.ts:42

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.

number

number

number

number


readonly optional trace?: DijkstraStep[]

Defined in: packages/graph/src/dijkstra.ts:48

Receives a 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.