Reimplement the network simplex method for min-cost flows