This document summarizes the Bellman-Ford algorithm for finding shortest paths in a graph. It discusses the history and development of the algorithm by Bellman, Ford, and Moore in the 1950s. The Bellman-Ford algorithm can handle graphs with negative edge weights and detect negative cycles. It works by iterating over all edges to update the distance to each vertex. The algorithm is still used in practice for routing protocols like RIP to determine lowest cost paths between routers in a network.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
27 views7 pages
Graph Final
This document summarizes the Bellman-Ford algorithm for finding shortest paths in a graph. It discusses the history and development of the algorithm by Bellman, Ford, and Moore in the 1950s. The Bellman-Ford algorithm can handle graphs with negative edge weights and detect negative cycles. It works by iterating over all edges to update the distance to each vertex. The algorithm is still used in practice for routing protocols like RIP to determine lowest cost paths between routers in a network.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7
GRAPH ALGORITHMS
Bellman-Ford Algorithm for Shortest Paths
HISTORY OF BELLMAN-FORD The algorithm was first proposed by Alfonso Shimbel in 1955. Named after Richard Bellman and Lester Ford Jr who published it in 1956 and 1958. Edward F. Moore also published the same algorithm in 1957. And for this reason it is also sometimes called the Bellman-Ford-Moore algorithm. BELLMAN-FORD ALGORITHM Procedure: Negative edge weights are found in various applications of graphs, hence the usefulness of this algorithm. If a graph contains a "negative cycle" (a cycle whose edges sum to a negative value) that is reachable from the source, then there is no cheapest path: Any path that has a point on the negative cycle can be made cheaper by one more walk around the negative cycle. In such a case, the Bellman-Ford algorithm can detect negative cycles and report their existence. BELLMAN-FORD ALGORITHM: BELLMAN-FORD(G, s) 1. for all v ∈ V Initialize all the 2. dist[v] ← ∞ distances 3. prev[v] ← null 4. dist{s] ← 0 5. for i ← 1 to |V|-1 6. for all edges (u,v) ∈ E Iterate over all edges 7. if dist[v] > dist[u] + w(u,v) and vertices and apply 8. dist[v] ← dist|u] + w(u,v) update rule 9. prev[v] ← u 10. for all edges (u, v) ∈ E
11. if dist[v] > dist[u] + w(u, v)
12. return false BELLMAN-FORD IS ALSO USED IN PRACTICE: Destination Cost Send to E.g., Routing Information Protocol (RIP) to get Whom uses something like Bellman-Ford there Older protocol, not used as much anymore. 172.16.1.0 34 172.16.1.1 Each router keeps a table of distances to 10.20.40.1 10 192.168.1.2 every other router. 10.155.120.1 9 10.13.50.0 Periodically we do a Bellman-Ford update. This means that if there are changes in the network, this will propagate. (maybe slowly...) APPLICATION: Networks (Routing) Robot Navigation Urban Traffic Plan Telemarketer operator scheduling Routing of communication messages Optimal Truck routing traffic through given congestion pattern OSPF routing protocol for IP Thank you! Credits: Noman & Toqeer