just give me some ideas regarding how user can interact with display by specifying cost ,source node and destination node at run time.
Posts: 14,118
Threads: 61
Joined: Oct 2014
The Bellman-Ford algorithm is an algorithm that calculates the shortest paths from a single source vertex to all other vertices in a weighted digraph. It is slower than the Dijkstra algorithm for the same problem, but more versatile because it is able to handle graphics in which some of the edge weights are negative numbers. The algorithm was first proposed by Alfonso Shimbel in 1955, but instead is named after Richard Bellman and Lester Ford, Jr., who published it in 1958 and 1956, respectively. Edward F. Moore also published the same algorithm in 1957, and for this reason it is also sometimes called the Bellman-Ford-Moore algorithm.
The weights of the negative edges are found in various graphics applications, hence the usefulness of this algorithm. If a graph contains a "negative cycle" (ie a cycle whose edges add up to a negative value) that is accessible from the source, then there is no cheaper route: any route that has a point in the negative cycle can be made cheaper One more walk around the negative cycle. In such a case, the Bellman-Ford algorithm can detect negative cycles and report their existence.