I've seen a post on this subreddit before regarding what the significance to using negative edges is, but none of the answers seemed to agree on one thing and most of them went back to the analogies in the context of chemistry or monetary values. So, this post is just to give a clear understanding of negative edges in terms of networking, since I was struggling with this yesterday and just learnt it.
While negative cost edges aren't given any particular physical significance in any of the standard protocols, it does have an algorithmic significance. They're used in Bhandari's algorithm to find shortest disjoint path pairs (or triplets or quadruples). Disjoint paths are needed in load balancing or rerouting, so this is needed in practical routing.
There is a variant of Dijkstra's algorithm which works with negative edges as well, let's assume we're using this.
Bhandari's algorithm to find a disjoint path pair goes like this: 1) First, all edges will be positive and we use Dijkstra's algo to find shortest path between A and B. 2) Now, take all the edges of this shortest path and reverse the links, giving them negative cost arcs and only in the backward direction of the original traversal. This is done because, since we want to find a disjoint path, we shouldn't bee using these edges to find the other shortest path in the forward direction. 3) Now, run the algo again with the new graph and try to find the shortest path again. 4) If this new path, shared an edge with one of the negative edges from the first path, then it means that these two paths are technically not disjoint. 5) To make these two paths disjoint, you'll need to discard these shared negative edges.
For more information just refer to Bhandari's paper. Hope this helps.
No comments:
Post a Comment