Skip to content

@graphty/algorithms / index / dijkstra

Function: dijkstra() ​

dijkstra(graph, source, options): Map<NodeId, ShortestPathResult>

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

Find shortest paths from source to all reachable nodes using Dijkstra's algorithm

Parameters ​

graph ​

Graph

The graph to search

source ​

NodeId

The starting node for the search

options ​

DijkstraOptions = {}

Algorithm options including optional target for early termination

Returns ​

Map<NodeId, ShortestPathResult>

A map of node IDs to their shortest path results