bashbers / csharp-algorithms-hacktoberfest2018

Hacktoberfest repository which over time will include loads of c# algorithms.
https://hacktoberfest.digitalocean.com/
3 stars 29 forks source link

Bellman-Ford algorithm #29

Closed marosstruk closed 6 years ago

marosstruk commented 6 years ago

Enter Id of issue here.

If you can check all of the above, congrats! :sparkles:

Description:

The Bellman–Ford algorithm is an algorithm that computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph. It is slower than Dijkstra's algorithm for the same problem, but more versatile, as it is capable of handling graphs in which some of the edge weights are negative numbers.

Note: Description taken directly from wikipedia, as I did not make any special changes that would divert the algorithm from its original form.

Tests include 3 cases: graph with only positive edges, graph with negative edges and graph with negative circle.