Skip to content

@graphty/algorithms / index / bellmanFord

Function: bellmanFord() ​

bellmanFord(graph, source, options): BellmanFordResult

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

Find shortest paths from source using Bellman-Ford algorithm

Parameters ​

graph ​

Graph

The graph to search

source ​

NodeId

The starting node for the search

options ​

BellmanFordOptions = {}

Algorithm options including optional target for early termination

Returns ​

BellmanFordResult

The distances, predecessors, and negative cycle information