# The Bellman–Ford algorithm

This is A C Program : must be compiled using linux

In this exercise we will implement the Bellman-Ford algorithm.

Background (from wikipedia):

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.

Bellman–Ford is based on the principle of relaxation, in which an approximation to the correct distance is gradually replaced by more accurate values until eventually reaching the optimum solution. The approximate distance to each vertex is always an overestimate of the true distance, and is replaced by the minimum of its old value with the length of a newly found path.

A pseudo of the algorithm for node s:

d[s] ← 0

for each v ∈ V – {s}

do d[v] ← ∞

for i ← 1 to |V| – 1 do

for each edge (u, v) ∈ E do

if d[v] > d[u] + w(u, v) then

d[v] ← d[u] + w(u, v)

π[v] ← u

for each edge (u, v) ∈ E do

if d[v] > d[u] + w(u, v)

then report that a negative-weight cycle exists

What you need to do:

In this exercise, you need to implement the Bellman-Ford algorithm for one vertex, given as a

parameter to the program.

The input is a file that contains the network topology in the following format:

a b 6

c a 1

Meaning, there are 2 (or actually 4) edges, one from a to b (and vice versa) with weight 6, and

one from c to a (and vice versa) with weight 1.

The output of the program should be:

dst via cost

where dst is the destination node, via is the neighbor to pass a packet towards the destination

and cost is the cost of the path.

Good luck!!

( 7 comentários ) Jerusalem, Israel

ID do Projeto: #6789143

## Premiar a:

nani01029x

Dear sir, I have done many projects in C programming and got some positive feedback from clients. You can check my profile for more information. Let me help you. I'm ready to get started right now. Thanks and bes Mais

\$30 USD em 1 dia
(18 Avaliações)
4.2

## 5 freelancers estão ofertando em média \$115 para este trabalho

satishiiith

Hi I have very good knowledge about graph algorithms, can deliver with in time My publications [url removed, login to view]~ley/pers/hd/v/Varagani:[url removed, login to view] Do we have any negative edges in grpah or we ha Mais

\$88 USD em 1 dia
(3 Comentários)
2.3
rajatduggs

A proposal has not yet been provided

\$155 USD in 3 dias
(1 Comentário)
1.2
Cheluxe

Hi, for this algorithm, we can finish in roughly 60 hours. We have implemented deep first search, Dijkstra etc...

\$100 USD in 3 dias
(1 Comentário)
0.9
paulperker

I can create the algorithm as you mentioned. Expert in C. will be compiled through linux. Let's discuss more details about the project.

\$200 USD in 5 dias
(2 Comentários)
0.0
samkevin