Implementation of Dinic’s network flow algorithm. The algorithm works by first constructing a level graph using a BFS and then finding augmenting paths on the level graph using multiple DFSs.