Skip to content

@graphty/algorithms / index / bellmanFordPath

Function: bellmanFordPath() ​

bellmanFordPath(graph, source, target): ShortestPathResult | null

Defined in: algorithms/shortest-path/bellman-ford.ts:138

Find shortest path between two specific nodes using Bellman-Ford

Parameters ​

graph ​

Graph

The graph to search

source ​

NodeId

The starting node for the path

target ​

NodeId

The destination node for the path

Returns ​

ShortestPathResult | null

The shortest path result or null if no path exists