Search code examples
network-programmingroutesprotocolsgraph-algorithmbellman-ford

How does distance vector routing algorithm handle negative weight cycles?


There a quite a few questions here on this algorithm but I haven't been able to find that how would it handle negative weight cycles? Suppose a router x gets update from router y that cost of y to z is 5. Later, router x gets update from router y that cost of y to z is 2 now. What does router x do? My understanding is that Bellman Ford algorithm states that error should be raised in this case. But what distance vector routing algorithm do - simply update it or raise an error or something else?


Solution

  • Not sure if I'm reading this question right. Updates from routers can specify a new cost for a path whether it be higher or lower than before. If x gets an update from y for a path to z with cost of 2 (originally 5), then x should simply update its forwarding table with the new cost path and use this path to get to z if it is the least cost path.