Max-Flow problem with BFS and Dijkstra