implementation of st-min cut