Max flow algorithm working for small sample