Skip to content

@graphty/algorithms / index / allPairsShortestPath

Function: allPairsShortestPath() ​

allPairsShortestPath(graph): Map<NodeId, Map<NodeId, number>>

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

All-pairs shortest paths using repeated Dijkstra Note: For dense graphs, consider Floyd-Warshall algorithm instead

Parameters ​

graph ​

Graph

The graph to compute all-pairs shortest paths for

Returns ​

Map<NodeId, Map<NodeId, number>>

A nested map of source to target to distance