Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Edmonds–Karp algorithm
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Algorithm== The algorithm is identical to the [[Ford–Fulkerson algorithm]], except that the search order when finding the [[Flow network#Augmenting paths|augmenting path]] is defined. The path found must be a [[Shortest path problem|shortest path]] that has available capacity. This can be found by a [[breadth-first search]], where we apply a weight of 1 to each edge. The running time of <math>O(|V||E|^2)</math> is found by showing that each augmenting path can be found in <math>O(|E|)</math> time, that every time at least one of the {{mvar|E}} edges becomes saturated (an edge which has the maximum possible flow), that the distance from the saturated edge to the source along the augmenting path must be longer than last time it was saturated, and that the length is at most <math>|V|</math>. Another property of this algorithm is that the length of the shortest augmenting path increases monotonically.<ref name='clrs'>{{cite book |author=[[Thomas H. Cormen]], [[Charles E. Leiserson]], [[Ronald L. Rivest]] and [[Clifford Stein]] |title=Introduction to Algorithms |publisher=MIT Press | year = 2009 |isbn=978-0-262-03384-8 |edition=third |chapter=26.2 |pages=727–730 |title-link=Introduction to Algorithms }}</ref> A proof outline using these properties is as follows: The proof first establishes that distance of the shortest path from the source node {{mvar|s}} to any non-sink node {{mvar|v}} in a residual flow network increases monotonically after each augmenting iteration (Lemma 1, proven below). Then, it shows that each of the <math>|E|</math> edges can be critical at most <math>\frac{|V|}{2}</math> times for the duration of the algorithm, giving an upper-bound of <math>O\left( \frac{|V||E|}{2} \right) \in O(|V||E|)</math> augmenting iterations. Since each iteration takes <math>O(|E|)</math> time (bounded by the time for finding the shortest path using Breadth-First-Search), the total running time of Edmonds-Karp is <math>O(|V||E|^2)</math> as required. <ref name='clrs'/> To prove Lemma 1, one can use [[proof by contradiction]] by assuming that there is an augmenting iteration that causes the shortest path distance from {{mvar|s}} to {{mvar|v}} to ''decrease''. Let {{mvar|f}} be the flow before such an augmentation and <math>f'</math> be the flow after. Denote the minimum distance in a residual flow network {{tmath|G_f}} from nodes <math>u, v</math> as <math>\delta_f (u, v)</math>. One can derive a contradiction by showing that <math>\delta_f (s, v) \leq \delta _{f'} (s, v)</math>, meaning that the shortest path distance between source node {{mvar|s}} and non-sink node {{mvar|v}} did not in fact decrease. <ref name='clrs'/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)