Edmonds–Karp

Find the most water a network of pipes can deliver to a tank each minute. You could use the answer to check whether the garden will get enough water.

Send a wave along arrows with spare capacity. Every augmenting path found uses the fewest possible edges.

Time is O(VE² + V²); the capacity table uses O(V²) space.