<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wcipeg.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Edmonds%E2%80%93Karp_algorithm</id>
		<title>Edmonds–Karp algorithm - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wcipeg.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Edmonds%E2%80%93Karp_algorithm"/>
		<link rel="alternate" type="text/html" href="http://wcipeg.com/wiki/index.php?title=Edmonds%E2%80%93Karp_algorithm&amp;action=history"/>
		<updated>2026-05-09T13:54:50Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.25.2</generator>

	<entry>
		<id>http://wcipeg.com/wiki/index.php?title=Edmonds%E2%80%93Karp_algorithm&amp;diff=1738&amp;oldid=prev</id>
		<title>Brian: Created page with &quot;The Edmonds–Karp algorithm is a special case of the Ford–Fulkerson method that always chooses a shortest augmenting path at each iteration. It solves the [[maximum fl...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wcipeg.com/wiki/index.php?title=Edmonds%E2%80%93Karp_algorithm&amp;diff=1738&amp;oldid=prev"/>
				<updated>2013-09-09T04:36:23Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;The &lt;a href=&quot;/wiki/Edmonds%E2%80%93Karp_algorithm&quot; title=&quot;Edmonds–Karp algorithm&quot;&gt;Edmonds–Karp algorithm&lt;/a&gt; is a special case of the &lt;a href=&quot;/wiki/Ford%E2%80%93Fulkerson_method&quot; title=&quot;Ford–Fulkerson method&quot;&gt;Ford–Fulkerson method&lt;/a&gt; that always chooses a shortest augmenting path at each iteration. It solves the [[maximum fl...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The [[Edmonds–Karp algorithm]] is a special case of the [[Ford–Fulkerson method]] that always chooses a shortest augmenting path at each iteration. It solves the [[maximum flow problem]] in &amp;lt;math&amp;gt;O(VE^2)&amp;lt;/math&amp;gt; time.&lt;br /&gt;
&lt;br /&gt;
==The algorithm==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input flow network (V, s, t, c)&lt;br /&gt;
F &amp;amp;larr; 0&lt;br /&gt;
for u &amp;amp;isin; V&lt;br /&gt;
    for v &amp;amp;isin; V&lt;br /&gt;
        f[u, v] &amp;amp;larr; 0&lt;br /&gt;
        r[u, v] &amp;amp;larr; c[u, v]&lt;br /&gt;
while t is reachable from s in (V, s, t, r)&lt;br /&gt;
    find a shortest augmenting path (s = v[0], v[1], ..., v[n] = t) with BFS&lt;br /&gt;
    m &amp;amp;larr; &amp;amp;infin;&lt;br /&gt;
    for i &amp;amp;isin; [0, n)&lt;br /&gt;
        m &amp;amp;larr; min(m, r[v[i], v[i+1]])&lt;br /&gt;
    for i &amp;amp;isin; [0, n)&lt;br /&gt;
        f[v[i], v[i+1]] &amp;amp;larr; f[v[i], v[i+1]] + m&lt;br /&gt;
        f[v[i+1], v[i]] &amp;amp;larr; f[v[i+1], v[i]] - m&lt;br /&gt;
        r[v[i], v[i+1]] &amp;amp;larr; r[v[i], v[i+1]] - m&lt;br /&gt;
        r[v[i+1], v[i]] &amp;amp;larr; r[v[i+1], v[i]] + m&lt;br /&gt;
    F &amp;amp;larr; F + m&lt;br /&gt;
output max flow f&lt;br /&gt;
output max flow value F&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Complexity==&lt;br /&gt;
A trivial upper bound of &amp;lt;math&amp;gt;O((E+V)M)&amp;lt;/math&amp;gt; can be derived in the case that all edge capacities are integers. Each iteration of the algorithm uses [[breadth-first search]], which takes &amp;lt;math&amp;gt;O(E+V)&amp;lt;/math&amp;gt; time, to find a shortest augmenting path, and there are at most &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; iterations, where &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is the value of the max flow, since in each step the total flow so far increases by at least one unit.&lt;br /&gt;
&lt;br /&gt;
As a matter of fact, however, the Edmonds–Karp algorithm's running time has a capacity-independent bound, &amp;lt;math&amp;gt;O(VE^2)&amp;lt;/math&amp;gt;. The proof is not trivial and can be found in a textbook such as ''Introduction to Algorithms'' by Cormen ''et al.''&lt;br /&gt;
&lt;br /&gt;
[[Category:Articles needing code]]&lt;/div&gt;</summary>
		<author><name>Brian</name></author>	</entry>

	</feed>