That title probably doesn't make sense. Assume the following:
In this basic situation there are three transactions but it can be reduced to two transactions:
Given a much more complicated graph, what algorithms exist to minimize the total number of transactions?
It seems to me the first thing you have to figure out how much each person is up/down after all transactions take place. For your example, that would be:
A : -5
B : 0
C : -10
D : +15
Once you have that, you just have to make them all zero. Take your highest gain, and start adding losses to it. At this point it's basically a bin-packing problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With