some improvements to dinic and new min-cost max-flow implementation