# Demo Example to find Shortest Paths using Bellman-Ford algorithm

By | July 14, 2017

## Shortest Paths using Bellman-Ford Algorithm

Write a C  Demo Program to find Shortest Paths using Bellman-Ford Algorithm Example. Here’s a simple C Program to find Shortest Distances or Paths using Bellman-Ford Algorithm with output in C Programming Language.

### Bellman-Ford Algorithm

The Bellman-Ford algorithm is a graph search algorithm that finds the shortest path between a given source vertex and all other vertices in the graph. This algorithm can be used on both weighted and unweighted graphs.

Like Dijkstra’s shortest path algorithm, the Bellman Ford algorithm is guaranteed to find the shortest path in a graph. Though it is slower than Dijkstra’s algorithm, Bellman-Ford is capable of handling graphs that contain negative edge weights, so it is more versatile.

It is worth noting that if there exists a negative cycle in the graph, then there is no shortest path. Going around the negative cycle an infinite number of times would continue to decrease the cost of the path (even though the path length is increasing). Because of this, Bellman-Ford can also detect negative cycles which is a useful feature.

Also Read : C Program to find Shortest Path using Bellman Ford Algorithm

Below is the source code for C Program to find Shortest Paths using Bellman Ford Algorithm which is successfully compiled and run on Windows System to produce desired output as shown below :

### OUTPUT : :

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.