Question

Dijkstra's algorithm is more efficient than bellman algorithm still we use bellman ford algo for negative edges but what do these negative edges even represent in networks? I couldn't find answer to this question anywhere and this question is killing me, i just need a few applications so i can feel that it is really useful.

Was it helpful?

Solution

The Bellman-Ford algorithm is used by DVR protocols like RIP and RIPv2.

From the wiki

Negative edge weights are found in various applications of graphs, hence the usefulness of this algorithm.[2] If a graph contains a "negative cycle", i.e., a cycle whose edges sum to a negative value, then there is no cheapest path, because any path can be made cheaper by one more walk through the negative cycle. In such a case, the Bellman–Ford algorithm can detect negative cycles and report their existence, but it cannot produce a correct "shortest path" answer if a negative cycle is reachable from the source

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top