This algorithm redistributes the weights, while keeping the topology invariant.
This algorithm was written by Duygu Balcan and integrated by Russell Duhon.