adding min cut code. Currently broken