Skip to content

@graphty/algorithms / index / floydWarshallPath

Function: floydWarshallPath() ​

floydWarshallPath(graph, source, target): { distance: number; path: NodeId[]; } | null

Defined in: algorithms/shortest-path/floyd-warshall.ts:120

Finds the shortest path between two nodes using Floyd-Warshall

Parameters ​

graph ​

Graph

The graph to search

source ​

NodeId

The starting node for the path

target ​

NodeId

The destination node for the path

Returns ​

{ distance: number; path: NodeId[]; } | null

The path and distance or null if no path exists