Implement Edmonds-Karp algorithm.