Graph Theory37 sections · 1633 units
Open in Course

Time Complexity

(Edmonds-Karp analysis)

Edmonds-Karp runs in O(VE2)O(VE^2) time. Here is why: Each BFS takes O(V+E)=O(E)O(V + E) = O(E) time. The number of augmenting paths is at most O(VE)O(VE), because each augmentation increases the distance from source to some node. Total: O(VE)×O(E)=O(VE2)O(VE) \times O(E) = O(VE^2). For sparse graphs (EVE \approx V), this is O(V3)O(V^3). For dense graphs (EV2E \approx V^2), this is O(V5)O(V^5).

In practice, the algorithm often runs much faster than the worst-case bound.

Space complexity is O(V+E)O(V + E) for the data structures used.