Bristol University, Department of Computer Science
Bristol BS8 1UB, UK
December 3, 2009
COMS21102: Bellman-Ford Slide 1
Single-Source Shortest Paths
◮We have previously looked at this problem in two cases
◮When there are no negative weight edges, Dijkstra’s shortest path
algorithm uses |V|EXTRACT-MIN and INSERT operations plus |E|
DECREASE-KEY operations. This gives a total worst case of
O(|E|log |V|)or O(|V|log(|V|) + |E|)time depending on how we
implement the priority queue.
◮Where the graph has no cycles at all (it is a DAG) then we can solve the
problem in O(|V|+|E|)time
◮In this lecture we consider the case where there are negatively weighted
edges. The algorithm is known as Bellman-Ford
◮If the graph has a negatively weighted cycle, the algorithm will tell us.
Otherwise, it will give us the shortest path from the source to every node.
◮The good news is that Bellman-Ford is simpler than the previous
COMS21102: Bellman-Ford Slide 2