Skip to content

@graphty/algorithms / index / singleSourceShortestPath

Function: singleSourceShortestPath() ​

singleSourceShortestPath(graph, source, cutoff?): Map<NodeId, number>

Defined in: algorithms/shortest-path/dijkstra.ts:172

Single-source shortest paths with early termination optimization

Parameters ​

graph ​

Graph

The graph to search

source ​

NodeId

The starting node for the search

cutoff? ​

number

Optional maximum distance to search

Returns ​

Map<NodeId, number>

A map of node IDs to their distances from the source