version 1 Dinic, work with the same graph