Skip to content

add Bellman-Ford algorithm for shortest paths #8714

@sagetrac-mvngu

Description

@sagetrac-mvngu

I'm using #698 as a wish list of items to add to the graph theory module of Sage. The purpose of this ticket is to implement the Bellman-Ford algorithm for finding shortest paths in a weighted graph G that may have negative weights. If G doesn't have negative weights, Dijkstra's algorithm can be used. However, if G has negative weights, we fall back on the Bellman-Ford algorithm. The Bellman-Ford algorithm is able to handle graphs with negative weights, but not graphs that have negative-weight cycles. See also the function BellmanFord in Mathematica's Combinatorica package. See this graph theory book for an algorithmic presentation of the Bellman-Ford algorithm.

See also the graph theory roadmap.

APPLY:

Depends on #12806

CC: @wdjoyner @dkrenn @dcoudert @nathanncohen

Component: graph theory

Author: David Coudert

Branch/Commit: u/cheuberg/8714 @ 2c58a9b

Reviewer: David Coudert

Issue created by migration from https://trac.sagemath.org/ticket/8714

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions