Module Graph__Path.BellmanFord
Parameters
Signature
exception
NegativeCycle of G.E.t list
val all_shortest_paths : G.t -> G.V.t -> W.t H.t
shortest_path g vs
computes the distances of shortest paths from vertexvs
to all other vertices in graphg
. They are returned as a hash table mapping each vertex reachable fromvs
to its distance fromvs
. Ifg
contains a negative-length cycle reachable fromvs
, raisesNegativeCycle l
wherel
is such a cycle.Complexity: at most O(VE)