Min cut algorithm implementation in D