What is use of negative weight cycle in any graph?
What does a negative weight cycle describes?
Hello @Deepanshu_garg,
The weight on edges can represent anything in the real world, for example, the amount of money to be transferred from one account to another account. The amounts can be positive or negative. For example, if you want to go from a to b in your graph while losing as less money as possible (shortest path), then you can consider negative weights.
Apart from that, there are many more applications. The negative weights depend on what you model it to be. For example, consider this graph
Chemistry: Consider a graph simulating behavior of a molecule in a chemical reaction i.e. which paths it can take during reaction and weights represents energy absorbed or released in the transition, so if we want energy out of the reaction we represent released energy with +ve weights and absorbed energy with -ve.
Real Life: Think of a driver, who gets paid to drive his employer from s to t but he pays between a and b (say traveling between his home and his workplace).
Games: Suppose you play rock-paper scissor for money. Nodes: rock, paper, scissors. Edges: any relation (clique). Weights: wager. In this graph: (forget about b), here, s beats a, a beats t and t beats s, and wins 4,2,-5 respectively.
Hope, this would help.
Give a like, if you are satisfied.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.