Graph.Pathfindings.BellmanFord (libgraph v0.17.1)

Copy Markdown

The Bellman–Ford algorithm is an algorithm that computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph. It is capable of handling graphs in which some of the edge weights are negative numbers Time complexity: O(VE)

Summary

Functions

Returns nil when graph has negative cycle.

Functions

call(g, a)

@spec call(Graph.t(), Graph.vertex()) ::
  %{required(Graph.vertex()) => number() | :infinity} | nil

Returns nil when graph has negative cycle.