<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Equatorial Mathematics</title>
	<atom:link href="http://equatorialmaths.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://equatorialmaths.wordpress.com</link>
	<description>Mathematics, teaching, brain meltdown</description>
	<lastBuildDate>Wed, 04 Jan 2012 17:31:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='equatorialmaths.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Equatorial Mathematics</title>
		<link>http://equatorialmaths.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://equatorialmaths.wordpress.com/osd.xml" title="Equatorial Mathematics" />
	<atom:link rel='hub' href='http://equatorialmaths.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Experimental Sage-based Mathematics course</title>
		<link>http://equatorialmaths.wordpress.com/2011/08/07/experimental-sage-based-mathematics-course/</link>
		<comments>http://equatorialmaths.wordpress.com/2011/08/07/experimental-sage-based-mathematics-course/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 08:28:56 +0000</pubDate>
		<dc:creator>Dima</dc:creator>
				<category><![CDATA[maths software]]></category>
		<category><![CDATA[undergrad maths]]></category>
		<category><![CDATA[MTH213]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[teaching]]></category>

		<guid isPermaLink="false">http://equatorialmaths.wordpress.com/?p=434</guid>
		<description><![CDATA[We are to embark upon teaching a 2nd year undergraduate course Experimental Mathematics, which will cover computer algebra basics, and refresh concepts from 1st year linear algebra, calculus, and combinatoris, with few more advanced things thrown in. The course will be based on Sage, with the actual software running on dedicated servers, and accessible via [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=434&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We are to embark upon teaching a 2nd year undergraduate course  Experimental Mathematics, which will cover computer algebra basics, and refresh concepts from 1st year linear algebra, calculus, and combinatoris, with few more advanced things thrown in. The course will be based on <a href="http://sagemath.org" title="Sage math">Sage</a>, with the actual software running on dedicated servers, and  accessible via <a href="http://nb.sagemath.org/">Sage web notebook interface</a> (i.e. basically nothing but a web browser running on the student&#8217;s computer/laptop/ipad, etc).</p>
<p>Given the enrollment of about 120, this will be interesting&#8230;</p>
<p>PS. Most students did not appreciate the freedom given, and complained, complained, complained&#8230; </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/equatorialmaths.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/equatorialmaths.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/equatorialmaths.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/equatorialmaths.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/equatorialmaths.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/equatorialmaths.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/equatorialmaths.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/equatorialmaths.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/equatorialmaths.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/equatorialmaths.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/equatorialmaths.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/equatorialmaths.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/equatorialmaths.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/equatorialmaths.wordpress.com/434/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=434&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://equatorialmaths.wordpress.com/2011/08/07/experimental-sage-based-mathematics-course/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Dima</media:title>
		</media:content>
	</item>
		<item>
		<title>An email from Sendai (Tohoku University)</title>
		<link>http://equatorialmaths.wordpress.com/2011/03/13/an-email-from-sendai-tohoku-university/</link>
		<comments>http://equatorialmaths.wordpress.com/2011/03/13/an-email-from-sendai-tohoku-university/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 15:30:08 +0000</pubDate>
		<dc:creator>Dima</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://equatorialmaths.wordpress.com/?p=427</guid>
		<description><![CDATA[I was very glad today to receive an email from Akihiro Munemasa (from Tohoku university at Sendai), my long-term collaborator and friend. He says he&#8217;s OK, but has no electricity/water/gas&#8230; And, as we see, they have internet, at least some kind of service (email went via me.com, a web-mail service run by Apple). Well, I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=427&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was very glad today to receive an email from Akihiro Munemasa (from Tohoku university at Sendai), my long-term collaborator and friend. He says he&#8217;s OK, but has no electricity/water/gas&#8230;</p>
<p>And, as we see, they have internet, at least some kind of service (email went via me.com, a web-mail service run by Apple).</p>
<p>Well, I can only wish a lot of strength to Akihiro, and all the people affected by this disaster!</p>
<p>PS: today (14th March) he also sent me photos of his office:<br />
<a href="http://equatorialmaths.files.wordpress.com/2011/03/photo-e1300087193327.jpg"><img src="http://equatorialmaths.files.wordpress.com/2011/03/photo-e1300087193327.jpg?w=225&#038;h=300" alt="photo of the office" title="photo of the office" width="225" height="300" class="alignnone size-medium wp-image-430" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/equatorialmaths.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/equatorialmaths.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/equatorialmaths.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/equatorialmaths.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/equatorialmaths.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/equatorialmaths.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/equatorialmaths.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/equatorialmaths.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/equatorialmaths.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/equatorialmaths.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/equatorialmaths.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/equatorialmaths.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/equatorialmaths.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/equatorialmaths.wordpress.com/427/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=427&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://equatorialmaths.wordpress.com/2011/03/13/an-email-from-sendai-tohoku-university/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Dima</media:title>
		</media:content>

		<media:content url="http://equatorialmaths.files.wordpress.com/2011/03/photo-e1300087193327.jpg?w=225" medium="image">
			<media:title type="html">photo of the office</media:title>
		</media:content>
	</item>
		<item>
		<title>2010 in review &#8211; Happy New Year!</title>
		<link>http://equatorialmaths.wordpress.com/2011/01/02/2010-in-review-happy-new-year/</link>
		<comments>http://equatorialmaths.wordpress.com/2011/01/02/2010-in-review-happy-new-year/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 14:01:27 +0000</pubDate>
		<dc:creator>Dima</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://equatorialmaths.wordpress.com/?p=414</guid>
		<description><![CDATA[While it might be snowing on this page, Edith picked up a mango fallen from a tree outside our block of flats this afternoon&#8230; The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here&#8217;s a high level summary of its overall blog health: The Blog-Health-o-Meter™ reads Fresher than ever. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=414&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em>While it might be snowing on this page, Edith picked up a mango fallen from a tree outside our block of flats this afternoon&#8230;</em></p>
<p>The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here&#8217;s a high level summary of its overall blog health:</p>
<p align="center"><img style="border:1px solid #ddd;background:#f5f5f5;padding:20px;" src="http://s0.wp.com/i/annual-recap/meter-healthy3.gif" width="250" height="183" alt="Healthy blog!"></p>
<p align="center">The <em>Blog-Health-o-Meter™</em> reads Fresher than ever.</p>
<h2>Crunchy numbers</h2>
<div style="width:288px;float:right;border:1px solid #ddd;background:#fff;margin:0 0 1em 1em;padding:6px;">
<p>				<img src="http://s0.wp.com/i/annual-recap/abstract-stats-5.png" alt="Featured image" /><br />
				<br /><em>A helper monkey made this abstract painting, inspired by your stats.</em></p></div>
<p>A Boeing 747-400 passenger jet can hold 416 passengers.  This blog was viewed about <strong>5,700</strong> times in 2010.  That&#8217;s about 14 full 747s.</p>
<p>
<p>In 2010, there were <strong>6</strong> new posts, growing the total archive of this blog to 33 posts. There were <strong>5</strong> pictures uploaded, taking up a total of 28kb. </p>
<p>The busiest day of the year was May 11th with <strong>79</strong> views. The most popular post that day was <a style="color:#08c;" href="http://equatorialmaths.wordpress.com/2010/05/07/is-c-the-worst-1st-programming-language-for-maths-majors/">Is C++ the worst 1st programming language for maths majors?</a>.</p>
<p></p>
<h2>Where did they come from?</h2>
<p>The top referring sites in 2010 were <strong>terrytao.wordpress.com</strong>, <strong>cameroncounts.wordpress.com</strong>, <strong>debian-news.net</strong>, <strong>edventure.ntu.edu.sg</strong>, and <strong>symomega.wordpress.com</strong>.</p>
<p>Some visitors came searching, mostly for <strong>funny pictures</strong>, <strong>funny</strong>, <strong>confused cat</strong>, <strong>total unimodularity</strong>, and <strong>funny pics</strong>.</p>
<div style="clear:both;"></div>
<h2>Attractions in 2010</h2>
<p>These are the posts and pages that got the most views in 2010.</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">1</div>
<p>					<a style="margin-right:10px;" href="http://equatorialmaths.wordpress.com/2010/05/07/is-c-the-worst-1st-programming-language-for-maths-majors/">Is C++ the worst 1st programming language for maths majors?</a> <span style="color:#999;font-size:8pt;">May 2010</span><br />4 comments											</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">2</div>
<p>					<a style="margin-right:10px;" href="http://equatorialmaths.wordpress.com/2009/10/12/total-unimodularity-and-networks/">Total unimodularity and networks</a> <span style="color:#999;font-size:8pt;">October 2009</span><br />1 comment											</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">3</div>
<p>					<a style="margin-right:10px;" href="http://equatorialmaths.wordpress.com/2009/03/11/cosets-and-normal-subgroups/">Cosets and normal subgroups</a> <span style="color:#999;font-size:8pt;">March 2009</span>											</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">4</div>
<p>					<a style="margin-right:10px;" href="http://equatorialmaths.wordpress.com/2009/09/14/bipartite-matchings-via-linear-programming/">Bipartite matchings via linear programming</a> <span style="color:#999;font-size:8pt;">September 2009</span><br />1 comment											</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">5</div>
<p>					<a style="margin-right:10px;" href="http://equatorialmaths.wordpress.com/2009/09/18/bellman-ford-algorithm-for-shortest-paths/">Bellman-Ford algorithm for shortest paths and potentials</a> <span style="color:#999;font-size:8pt;">September 2009</span>											</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/equatorialmaths.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/equatorialmaths.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/equatorialmaths.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/equatorialmaths.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/equatorialmaths.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/equatorialmaths.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/equatorialmaths.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/equatorialmaths.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/equatorialmaths.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/equatorialmaths.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/equatorialmaths.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/equatorialmaths.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/equatorialmaths.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/equatorialmaths.wordpress.com/414/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=414&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://equatorialmaths.wordpress.com/2011/01/02/2010-in-review-happy-new-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Dima</media:title>
		</media:content>

		<media:content url="http://s0.wp.com/i/annual-recap/meter-healthy3.gif" medium="image">
			<media:title type="html">Healthy blog!</media:title>
		</media:content>

		<media:content url="http://s0.wp.com/i/annual-recap/abstract-stats-5.png" medium="image">
			<media:title type="html">Featured image</media:title>
		</media:content>
	</item>
		<item>
		<title>Python extensions with C libraries made easy by Cython</title>
		<link>http://equatorialmaths.wordpress.com/2010/10/16/python-extensions-with-c-libraries-made-easy-by-cython/</link>
		<comments>http://equatorialmaths.wordpress.com/2010/10/16/python-extensions-with-c-libraries-made-easy-by-cython/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 07:19:40 +0000</pubDate>
		<dc:creator>Dima</dc:creator>
				<category><![CDATA[maths software]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://equatorialmaths.wordpress.com/?p=394</guid>
		<description><![CDATA[Suppose you have a library written in C that you like to be called from Python. There are many ways to accomplish this, and I would like to show here a complete example of doing this using Cython, which is basically a compiler from (an extension of Python) to C. Most of this, and much [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=394&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Suppose you have a library written in C that you like to be called from Python. There are many ways to accomplish this, and I would like to show here a complete example of doing this using <a href="http://www.cython.org">Cython</a>, which is basically a compiler from (an extension of Python) to C. Most of this, and much more, can be found in a quick <a href="http://conference.scipy.org/proceedings/SciPy2009/paper_1/full_text.pdf">tutorial</a>.<br />
For the purpose of an example, suppose you have a C function that computes the average of an array of doubles (all source files here, as well as the Makefile that basically contains the shell commands we show below, can be downloaded <a href="http://www1.spms.ntu.edu.sg/~dima/software/dynpy.tgz">here</a>):<br />
<code><br />
/* cmean.c */<br />
double mean(int n, double* a)<br />
{<br />
&nbsp;  double s;<br />
&nbsp;  int i;<br />
&nbsp;  for (s=0., i=0; i&lt;n; i++) s+=*(a++);<br />
&nbsp;  return s/n;<br />
}<br />
</code><br />
with the prototype<br />
<code><br />
</code>/* cmean.h */<br />
double mean(int, double*);<br />
</code><br />
and you want to call it from Python, i.e. (we need to give the function another name here, cmean(), for technical as well as for semantic reasons---noone would pass the length of an array and the array to a function in Python, as the array itself would certainly do) say<br />
<code><br />
b=[1.3,5.777777,-12.0,77.]<br />
print cmean(b)<br />
</code><br />
would print the same as<br />
<code><br />
print sum(b)/len(b)<br />
</code><br />
As cmean() is not a Python built-in, we would expect to import it first. So the following<br />
<code><br />
$ python test.py<br />
</code><br />
where<br />
<code><br />
# test.py<br />
import dyn<br />
from dyn import cmean<br />
b=[1.3,5.777777,-12.0,77.]<br />
print cmean(b)<br />
print sum(b)/len(b)<br />
</code><br />
will print the number 18.01944425 twice. OK, so here is cmean() definition in Cython (note the file extension .pyx)<br />
<code><br />
# m.pyx<br />
cdef extern from "cmean.h":<br />
&nbsp;&nbsp;&nbsp;   double mean(int, double*)<br />
from stdlib cimport *<br />
def cmean(a):<br />
&nbsp;&nbsp;&nbsp;   n = len(a)<br />
&nbsp;&nbsp;&nbsp;   cdef double *v<br />
&nbsp;&nbsp;&nbsp;   v = malloc(n*sizeof(double))<br />
&nbsp;&nbsp;&nbsp;   for i in range(n):<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;      v[i] = float(a[i])<br />
&nbsp;&nbsp;&nbsp;   m  = mean(n, v)<br />
&nbsp;&nbsp;&nbsp;   free(v)<br />
&nbsp;&nbsp;&nbsp;   return m<br />
</code><br />
The main task of cmean() is to create a "plain" C array of doubles, pass it to our C function, get the result, clean after itself, and return the result. Unlike Python, Cython has types declarations. Unless one calls C-function from the Cython code, they are not mandatory though, although they can speed the things up tremendously in "real" computations. In the example here<br />
<code><br />
  cdef double *v<br />
</code><br />
cannot be avoided --- the code does not compile without it. In a usual C-like fasion, instead of 2 lines<br />
<code><br />
  cdef double *v<br />
  v = malloc(n*sizeof(double))<br />
</code><br />
one could have written just<br />
<code><br />
  cdef double *v  = malloc(n*sizeof(double))<br />
</code><br />
The top two lines pass the prototype declaration of the C-function mean to be included into the C file to be generated, and the third line imports the functions from the C library stdlib (we need malloc and free from there).</p>
<p>Having this, we need to create the extension module dyn, to be imported by Python. This is perhaps the least intuitive part of the job. One way to accomplish it is to use Python distutils: i.e. we need to create a setup.py file to be called as<br />
<code><br />
$ python setup.py build_ext --inplace<br />
</code><br />
This should look as follows:<br />
<code><br />
# setup.py<br />
from distutils.core import setup<br />
from distutils.extension import Extension<br />
from Cython.Distutils import build_ext<br />
ext_modules=[<br />
&nbsp;&nbsp;&nbsp;    Extension("dyn",<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;              ["m.pyx"],<br />
&nbsp;&nbsp;&nbsp;              library_dirs = ['.'],<br />
&nbsp;&nbsp;&nbsp;              libraries=["cmean"]) # Unix-like specific<br />
]<br />
setup(<br />
&nbsp;&nbsp;&nbsp;    name = "Demos",<br />
&nbsp;&nbsp;&nbsp;    cmdclass = {"build_ext": build_ext},<br />
&nbsp;&nbsp;&nbsp;    ext_modules = ext_modules<br />
)<br />
</code><br />
One not yet explained thing here is how the shared library containing the compiled C-function mean() is hooked up to dyn. You see in the code above the declarations library_dirs and libraries. They assume that the shared library is called libcmean.so and that it is in the same directory (i.e. '.' is the path to it) as the rest of the code. One can create libcmean.so (before creating dyn, more precisely, a file called dyn.so) by running<br />
 <code><br />
$ gcc -fPIC -shared cmean.c -o libcmean.so<br />
</code><br />
One more point to watch is that on some Unix systems the loader will be unable to locate the dynamic libraries libcmean.so and/or dyn.so we created (unless they are placed in certain stanadard directories, which is not something one wants to do with experimental code!). So test.py will need to be run, e.g.,  as follows:<br />
<code><br />
$ LD_LIBRARY_PATH=. python test.py<br />
</code></p>
<p>For the sake of completeness, the aforementioned <a href="http://www1.spms.ntu.edu.sg/~dima/software/dynpy.tgz">archive</a> contains a C file that calls mean from libcmean.so, and the corresponding entries in the Makefile can do the necessary work to build and run it.</p>
<p>Last but not least, <a href="http://www.sagemath.org">Sage</a> automates parts of the interface building <a href="http://sagemath.blogspot.com/2010/11/getting-started-with-cython.html">even better</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/equatorialmaths.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/equatorialmaths.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/equatorialmaths.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/equatorialmaths.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/equatorialmaths.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/equatorialmaths.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/equatorialmaths.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/equatorialmaths.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/equatorialmaths.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/equatorialmaths.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/equatorialmaths.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/equatorialmaths.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/equatorialmaths.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/equatorialmaths.wordpress.com/394/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=394&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://equatorialmaths.wordpress.com/2010/10/16/python-extensions-with-c-libraries-made-easy-by-cython/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Dima</media:title>
		</media:content>
	</item>
		<item>
		<title>Integer flows and graph theory applications</title>
		<link>http://equatorialmaths.wordpress.com/2010/10/14/integer-flows-and-graph-theory-applications/</link>
		<comments>http://equatorialmaths.wordpress.com/2010/10/14/integer-flows-and-graph-theory-applications/#comments</comments>
		<pubDate>Thu, 14 Oct 2010 04:58:50 +0000</pubDate>
		<dc:creator>Dima</dc:creator>
				<category><![CDATA[undergrad maths]]></category>
		<category><![CDATA[graph theory]]></category>
		<category><![CDATA[MAS324]]></category>

		<guid isPermaLink="false">http://equatorialmaths.wordpress.com/?p=390</guid>
		<description><![CDATA[Here we are continuing the story of Ford-Fulkerson algorithm. Assume that , i.e. the capacities are all integers. Then starting the Ford-Fulkerson from the zero flow, we see that at each iteration . Thus the optimal flow will have integer values for each arc (such flows are called integral). We have Corollary 3 A maxflow [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=390&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here we are continuing the story of <a>Ford-Fulkerson algorithm.</a> Assume that <img src='http://s0.wp.com/latex.php?latex=%7Bc%3AD%5Crightarrow+%7B%5Cmathbb+Z%7D_%2B%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{c:D&#92;rightarrow {&#92;mathbb Z}_+}' title='{c:D&#92;rightarrow {&#92;mathbb Z}_+}' class='latex' />, i.e. the capacities are all integers. Then starting the Ford-Fulkerson from the zero flow, we see that at each iteration <img src='http://s0.wp.com/latex.php?latex=%7B%5Ctau%28P%29%5Cin+%7B%5Cmathbb+Z%7D_%2B%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;tau(P)&#92;in {&#92;mathbb Z}_+}' title='{&#92;tau(P)&#92;in {&#92;mathbb Z}_+}' class='latex' />. Thus the optimal flow will have integer values for each arc (such flows are called <em>integral</em>). We have </p>
<blockquote><p><b>Corollary 3</b> <em> A maxflow problem with integer capacities has an integral optimal solution. </em></p></blockquote>
<p> This has various graph-theoretic applications. We can convert an undirected graph <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%3D%28V%2CE%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma=(V,E)}' title='{&#92;Gamma=(V,E)}' class='latex' /> into a digraph by replacing each edge <img src='http://s0.wp.com/latex.php?latex=%7B%5C%7Bx%2Cy%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;{x,y&#92;}}' title='{&#92;{x,y&#92;}}' class='latex' /> by a pair of opposite arcs <img src='http://s0.wp.com/latex.php?latex=%7Bxy%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{xy}' title='{xy}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Byx%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{yx}' title='{yx}' class='latex' />, set all arc capacities to 1, and see what this implies for a pair of non-adjacent vertices <img src='http://s0.wp.com/latex.php?latex=%7Bs%5Cneq+t%5Cin+V%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s&#92;neq t&#92;in V}' title='{s&#92;neq t&#92;in V}' class='latex' />. Running Ford-Fulkerson algorithm, we obtain an integral maximum <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> flow <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' />, of value <img src='http://s0.wp.com/latex.php?latex=%7Bk%3A%3D%7B%5Cmathrm+val%7D%28f%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{k:={&#92;mathrm val}(f)}' title='{k:={&#92;mathrm val}(f)}' class='latex' />. </p>
<p>
We also know that there is, by the maxflow-mincut Theorem, an <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> cut <img src='http://s0.wp.com/latex.php?latex=%7B%28S%2CV%5Csetminus+S%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(S,V&#92;setminus S)}' title='{(S,V&#92;setminus S)}' class='latex' /> s.t. <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+cap%7D%28S%2CV%5Csetminus+S%29%3D%7B%5Cmathrm+val%7D%28f%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm cap}(S,V&#92;setminus S)={&#92;mathrm val}(f)}' title='{{&#92;mathrm cap}(S,V&#92;setminus S)={&#92;mathrm val}(f)}' class='latex' />. Instead of capacity, it is more appropriate to talk here about the <em>size</em> <img src='http://s0.wp.com/latex.php?latex=%7B%7C%28S%2CV%5Csetminus+S%29%7C%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{|(S,V&#92;setminus S)|}' title='{|(S,V&#92;setminus S)|}' class='latex' /> of the cut, i.e. the number of edges crossing from one part of the cut to another. Obviously, by definition of the capacity, we have <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+cap%7D%28S%2CV%5Csetminus+S%29%3D%7C%28S%2CV%5Csetminus+S%29%7C%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm cap}(S,V&#92;setminus S)=|(S,V&#92;setminus S)|}' title='{{&#92;mathrm cap}(S,V&#92;setminus S)=|(S,V&#92;setminus S)|}' class='latex' />.</p>
<p>
The flow <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' /> can be viewed as a collection <img src='http://s0.wp.com/latex.php?latex=%7BD_f%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{D_f}' title='{D_f}' class='latex' /> of <img src='http://s0.wp.com/latex.php?latex=%7Bk%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{k}' title='{k}' class='latex' /> edge-disjoint <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' />-paths from <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' />, as can be seen by induction on <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+val%7D%28f%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm val}(f)}' title='{{&#92;mathrm val}(f)}' class='latex' />: indeed, if <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+val%7D%28f%29%3D1%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm val}(f)=1}' title='{{&#92;mathrm val}(f)=1}' class='latex' /> then by construction (via the Ford-Fulkerson algorithm) <img src='http://s0.wp.com/latex.php?latex=%7BD_f%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{D_f}' title='{D_f}' class='latex' /> is a path. Suppose now this statement holds for all <img src='http://s0.wp.com/latex.php?latex=%7Bk%3C%7B%5Cmathrm+val%7D%28f%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{k&lt;{&#92;mathrm val}(f)}' title='{k&lt;{&#92;mathrm val}(f)}' class='latex' />. As <img src='http://s0.wp.com/latex.php?latex=%7BD_f%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{D_f}' title='{D_f}' class='latex' /> induces a connected subgraph, it contains a shortest path <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' />. Then, <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> is cut by a minimum cut <img src='http://s0.wp.com/latex.php?latex=%7B%28S%2CV%5Csetminus+S%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(S,V&#92;setminus S)}' title='{(S,V&#92;setminus S)}' class='latex' />&#8212;otherwise the cut does not cut! Removing all the edges of <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> from <img src='http://s0.wp.com/latex.php?latex=%7BD%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{D}' title='{D}' class='latex' />, we thus obtain a graph <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma&#039;}' title='{&#92;Gamma&#039;}' class='latex' /> that has the cut <img src='http://s0.wp.com/latex.php?latex=%7B%28S%2CV%5Csetminus+S%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(S,V&#92;setminus S)}' title='{(S,V&#92;setminus S)}' class='latex' /> of size <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+val%7D%28f%29-%5Cell%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm val}(f)-&#92;ell}' title='{{&#92;mathrm val}(f)-&#92;ell}' class='latex' />, for <img src='http://s0.wp.com/latex.php?latex=%7B%5Cell%3E0%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;ell&gt;0}' title='{&#92;ell&gt;0}' class='latex' />. The flow <img src='http://s0.wp.com/latex.php?latex=%7Bf%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f&#039;}' title='{f&#039;}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> corresponding to <img src='http://s0.wp.com/latex.php?latex=%7BD_f%5Csetminus+P%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{D_f&#92;setminus P}' title='{D_f&#92;setminus P}' class='latex' /> has value <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+val%7D%28f%29-%5Cell%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm val}(f)-&#92;ell}' title='{{&#92;mathrm val}(f)-&#92;ell}' class='latex' />, and <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> is an augmenting path for this flow, with <img src='http://s0.wp.com/latex.php?latex=%7B%5Ctau%28P%29%3D1%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;tau(P)=1}' title='{&#92;tau(P)=1}' class='latex' />. Thus <img src='http://s0.wp.com/latex.php?latex=%7B%5Cell%3D1%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;ell=1}' title='{&#92;ell=1}' class='latex' />, i.e. <img src='http://s0.wp.com/latex.php?latex=%7B%28S%2CV%5Csetminus+S%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(S,V&#92;setminus S)}' title='{(S,V&#92;setminus S)}' class='latex' /> cuts just 1 edge in <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' />, and by induction <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma&#039;}' title='{&#92;Gamma&#039;}' class='latex' /> contains <img src='http://s0.wp.com/latex.php?latex=%7Bk-1%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{k-1}' title='{k-1}' class='latex' /> edge-disjoint <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' />-paths, and we obtain </p>
<blockquote><p><b>Corollary 4</b> <em> (Menger Theorem (for edge-disjoint paths)) The minimum size of an <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> cut in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> equals the maximal number of edge-disjoint <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> paths in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' />. </em></p></blockquote>
<p> There is a graph transformation that allows one to prove Menger Theorem for internally disjoint <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> paths (two paths between <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> are called internally disjoint is their only common vertices are <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7By%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{y}' title='{y}' class='latex' />). Our goal is to prove the following. </p>
<blockquote><p><b>Theorem 5</b> <em> (Menger Theorem (for internally disjoint paths)) The minimum size of an <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> cut in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> equals the maximal number of internally disjoint <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> paths in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' />. </em></p></blockquote>
<p> <em>Proof:</em>  Assume <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> are not adjacent. Replace each <img src='http://s0.wp.com/latex.php?latex=%7Bv%5Cin+V%5Csetminus%5C%7Bs%2Ct%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v&#92;in V&#92;setminus&#92;{s,t&#92;}}' title='{v&#92;in V&#92;setminus&#92;{s,t&#92;}}' class='latex' /> by a pair of vertices <img src='http://s0.wp.com/latex.php?latex=%7Bv_%2B%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_+}' title='{v_+}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=%7Bv_-%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_-}' title='{v_-}' class='latex' />, joined by an arc <img src='http://s0.wp.com/latex.php?latex=%7Bv_%2B+v_-%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_+ v_-}' title='{v_+ v_-}' class='latex' />. Then replace each edge <img src='http://s0.wp.com/latex.php?latex=%7B%5C%7Bx%2Cy%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;{x,y&#92;}}' title='{&#92;{x,y&#92;}}' class='latex' /> of <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> by a pair of opposite arcs <img src='http://s0.wp.com/latex.php?latex=%7Bxy%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{xy}' title='{xy}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Byx%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{yx}' title='{yx}' class='latex' />. Replace every arc <img src='http://s0.wp.com/latex.php?latex=%7Bxy%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{xy}' title='{xy}' class='latex' /> such that <img src='http://s0.wp.com/latex.php?latex=%7Bs%2Ct%5Cnot%5Cin+%5C%7Bx%2Cy%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s,t&#92;not&#92;in &#92;{x,y&#92;}}' title='{s,t&#92;not&#92;in &#92;{x,y&#92;}}' class='latex' /> by the arc <img src='http://s0.wp.com/latex.php?latex=%7Bx_%7B-%7Dy_%7B%2B%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{x_{-}y_{+}}' title='{x_{-}y_{+}}' class='latex' />, each arc <img src='http://s0.wp.com/latex.php?latex=%7Bxy%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{xy}' title='{xy}' class='latex' /> with <img src='http://s0.wp.com/latex.php?latex=%7Bx%3Ds%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{x=s}' title='{x=s}' class='latex' /> or <img src='http://s0.wp.com/latex.php?latex=%7Bx%3Dt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{x=t}' title='{x=t}' class='latex' /> by <img src='http://s0.wp.com/latex.php?latex=%7Bxy_%2B%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{xy_+}' title='{xy_+}' class='latex' />, and each arc <img src='http://s0.wp.com/latex.php?latex=%7Bxy%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{xy}' title='{xy}' class='latex' /> with <img src='http://s0.wp.com/latex.php?latex=%7By%3Ds%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{y=s}' title='{y=s}' class='latex' /> or <img src='http://s0.wp.com/latex.php?latex=%7By%3Dt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{y=t}' title='{y=t}' class='latex' /> by <img src='http://s0.wp.com/latex.php?latex=%7Bx_-y%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{x_-y}' title='{x_-y}' class='latex' />. Now each <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> path <img src='http://s0.wp.com/latex.php?latex=%7Bs%2Cx%5E1%2C%5Cdots%2Cx%5E%7Bk-1%7D%2Ct%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s,x^1,&#92;dots,x^{k-1},t}' title='{s,x^1,&#92;dots,x^{k-1},t}' class='latex' /> corresponds to the path <img src='http://s0.wp.com/latex.php?latex=%7Bs%2Cx%5E1_%2B%2Cx%5E1_-%2Cx%5E2_%2B%2C%5Cdots%2Cx%5E%7Bk-1%7D_%2B%2Cx%5E%7Bk-1%7D_-%2Ct%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s,x^1_+,x^1_-,x^2_+,&#92;dots,x^{k-1}_+,x^{k-1}_-,t}' title='{s,x^1_+,x^1_-,x^2_+,&#92;dots,x^{k-1}_+,x^{k-1}_-,t}' class='latex' /> in the new graph, and the opposite holds, too: each <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> path in the new graph has this form.</p>
<p>
Assign capacities 1 to the arcs <img src='http://s0.wp.com/latex.php?latex=%7Bv_%2B+v_-%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_+ v_-}' title='{v_+ v_-}' class='latex' />, and infinite capacities (it suffices to take this &#8220;infinity&#8221; to be bigger than, say, <img src='http://s0.wp.com/latex.php?latex=%7B10%7CE%5CGamma%7C%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{10|E&#92;Gamma|}' title='{10|E&#92;Gamma|}' class='latex' />) to the rest of the arcs. Due to the choice of capacities, a minimum <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> cut <img src='http://s0.wp.com/latex.php?latex=%7B%28S%2CV%5Csetminus+S%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(S,V&#92;setminus S)}' title='{(S,V&#92;setminus S)}' class='latex' /> will satisfy <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+cap%7D%28S%2CV%5Csetminus+S%29%5Cleq+%7CE%5CGamma%7C%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm cap}(S,V&#92;setminus S)&#92;leq |E&#92;Gamma|}' title='{{&#92;mathrm cap}(S,V&#92;setminus S)&#92;leq |E&#92;Gamma|}' class='latex' />, and thus the only arcs from <img src='http://s0.wp.com/latex.php?latex=%7BS%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{S}' title='{S}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7BV%5Csetminus+S%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{V&#92;setminus S}' title='{V&#92;setminus S}' class='latex' /> will be of type <img src='http://s0.wp.com/latex.php?latex=%7Bv_%2Bv_-%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_+v_-}' title='{v_+v_-}' class='latex' />. Say, there will be <img src='http://s0.wp.com/latex.php?latex=%7Bk%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{k}' title='{k}' class='latex' /> such arcs. By (a straightforward generalisation of) Menger Theorem for edge-disjoint paths (to directed graphs), there will be exactly <img src='http://s0.wp.com/latex.php?latex=%7Bk%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{k}' title='{k}' class='latex' /> arc-disjoint <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> paths in this digraph. By its construction, they cannot share a vertex <img src='http://s0.wp.com/latex.php?latex=%7Bv_-%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_-}' title='{v_-}' class='latex' /> (resp. <img src='http://s0.wp.com/latex.php?latex=%7Bv_%2B%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_+}' title='{v_+}' class='latex' />), as there is only one outgoing (resp. incoming) arc on it. Thus these paths are internally disjoint, and the corresponding <img src='http://s0.wp.com/latex.php?latex=%7Bk%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{k}' title='{k}' class='latex' /> paths in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> are internally disjoint, too. <img src='http://s0.wp.com/latex.php?latex=%5CBox&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;Box' title='&#92;Box' class='latex' /></p>
<p>
One more classical application is a maxflow-based algorithm to construct a maximum matching in a bipartite graph <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%3D%28V%2CE%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma=(V,E)}' title='{&#92;Gamma=(V,E)}' class='latex' />, with the bipartition <img src='http://s0.wp.com/latex.php?latex=%7BV%3DV_s%5Ccup+V_t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{V=V_s&#92;cup V_t}' title='{V=V_s&#92;cup V_t}' class='latex' />. We add two more vertices <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> to it, and connect <img src='http://s0.wp.com/latex.php?latex=%7Bx%5Cin%5C%7Bs%2Ct%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{x&#92;in&#92;{s,t&#92;}}' title='{x&#92;in&#92;{s,t&#92;}}' class='latex' /> to each <img src='http://s0.wp.com/latex.php?latex=%7Bv%5Cin+V_x%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v&#92;in V_x}' title='{v&#92;in V_x}' class='latex' /> by an edge. In the resulting new graph <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma&#039;}' title='{&#92;Gamma&#039;}' class='latex' /> we solve the <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' /> maxflow problem with all capacities set to 1. More precisely, we orient each edge so that each <img src='http://s0.wp.com/latex.php?latex=%7B%5C%7Bv_s%2Cv_t%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;{v_s,v_t&#92;}}' title='{&#92;{v_s,v_t&#92;}}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=%7B%5C%7Bs%2Cv_s%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;{s,v_s&#92;}}' title='{&#92;{s,v_s&#92;}}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=%7B%5C%7Bv_t%2Ct%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;{v_t,t&#92;}}' title='{&#92;{v_t,t&#92;}}' class='latex' /> becomes an arc <img src='http://s0.wp.com/latex.php?latex=%7Bv_sv_t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_sv_t}' title='{v_sv_t}' class='latex' />, respectively, <img src='http://s0.wp.com/latex.php?latex=%7Bsv_s%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{sv_s}' title='{sv_s}' class='latex' />, respectively <img src='http://s0.wp.com/latex.php?latex=%7Bv_tt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_tt}' title='{v_tt}' class='latex' />.</p>
<p>
Ford-Fulkerson algorithm, when started from the zero flow, will produce an integral maximal flow, of value <img src='http://s0.wp.com/latex.php?latex=%7Bk%3A%3D%7B%5Cmathrm+val%7D%28f%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{k:={&#92;mathrm val}(f)}' title='{k:={&#92;mathrm val}(f)}' class='latex' />. As we know from Menger&#8217;s theorem, we will have <img src='http://s0.wp.com/latex.php?latex=%7Bk%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{k}' title='{k}' class='latex' /> internally disjoint <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' />-paths. They will induce a matching <img src='http://s0.wp.com/latex.php?latex=%7BM_f%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M_f}' title='{M_f}' class='latex' /> on <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> (just look at the <img src='http://s0.wp.com/latex.php?latex=%7B%5C%7Bv_s%2Cv_t%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;{v_s,v_t&#92;}}' title='{&#92;{v_s,v_t&#92;}}' class='latex' /> edges only). On the other hand, any matching <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' /> on <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> can be used to construct an <img src='http://s0.wp.com/latex.php?latex=%7Bs-t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s-t}' title='{s-t}' class='latex' />-flow of value <img src='http://s0.wp.com/latex.php?latex=%7B%7CM%7C%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{|M|}' title='{|M|}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma&#039;}' title='{&#92;Gamma&#039;}' class='latex' /> with all capacities 1. Hence <img src='http://s0.wp.com/latex.php?latex=%7BM_f%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M_f}' title='{M_f}' class='latex' /> is a maximum matching in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' />.</p>
<p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/equatorialmaths.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/equatorialmaths.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/equatorialmaths.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/equatorialmaths.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/equatorialmaths.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/equatorialmaths.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/equatorialmaths.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/equatorialmaths.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/equatorialmaths.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/equatorialmaths.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/equatorialmaths.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/equatorialmaths.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/equatorialmaths.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/equatorialmaths.wordpress.com/390/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=390&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://equatorialmaths.wordpress.com/2010/10/14/integer-flows-and-graph-theory-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Dima</media:title>
		</media:content>
	</item>
		<item>
		<title>Augmenting paths for Maxflow and Mincut</title>
		<link>http://equatorialmaths.wordpress.com/2010/10/11/augmenting-paths-for-maxflow-and-mincut/</link>
		<comments>http://equatorialmaths.wordpress.com/2010/10/11/augmenting-paths-for-maxflow-and-mincut/#comments</comments>
		<pubDate>Sun, 10 Oct 2010 16:17:09 +0000</pubDate>
		<dc:creator>Dima</dc:creator>
				<category><![CDATA[undergrad maths]]></category>
		<category><![CDATA[graph theory]]></category>
		<category><![CDATA[MAS324]]></category>

		<guid isPermaLink="false">http://equatorialmaths.wordpress.com/?p=375</guid>
		<description><![CDATA[We discussed how to formulate the MAXFLOW problem for networks, i.e. arc-weighted digraphs with two specific vertices, source and sink and arc capacities , and treat it via linear programming. An alternative approach is via augmenting paths. The paths we talk about will disregard the arc directions in , i.e. they will be - paths [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=375&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>  We <a href="http://equatorialmaths.wordpress.com/2009/10/12/total-unimodularity-and-networks/#maxflow">discussed</a> how to formulate the MAXFLOW problem for networks, i.e. arc-weighted digraphs <img src='http://s0.wp.com/latex.php?latex=%7B%28V%2CD%2Cc%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(V,D,c)}' title='{(V,D,c)}' class='latex' /> with two specific vertices, <em>source</em> <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' /> and <em>sink</em> <img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> and arc capacities <img src='http://s0.wp.com/latex.php?latex=%7Bc%3AD%5Crightarrow%7B%5Cmathbb+R%7D_%2B%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{c:D&#92;rightarrow{&#92;mathbb R}_+}' title='{c:D&#92;rightarrow{&#92;mathbb R}_+}' class='latex' />, and treat it via linear programming. An alternative approach is via augmenting paths. The paths we talk about will disregard the arc directions in <img src='http://s0.wp.com/latex.php?latex=%7BD%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{D}' title='{D}' class='latex' />, i.e. they will be <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' />-<img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> paths in the underlying undirected graph. (When <img src='http://s0.wp.com/latex.php?latex=%7Be%5Cin+P%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{e&#92;in P}' title='{e&#92;in P}' class='latex' /> has the direction opposite to the arc in <img src='http://s0.wp.com/latex.php?latex=%7BD%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{D}' title='{D}' class='latex' />, we write <img src='http://s0.wp.com/latex.php?latex=%7Be%5Cin+P%5Csetminus+D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{e&#92;in P&#92;setminus D}' title='{e&#92;in P&#92;setminus D}' class='latex' />.) </p>
<blockquote><p><b>Definition 1</b> <em> Given an <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' />-<img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> flow <img src='http://s0.wp.com/latex.php?latex=%7Bf%3AD%5Crightarrow+%7B%5Cmathbb+R%7D_%2B%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f:D&#92;rightarrow {&#92;mathbb R}_+}' title='{f:D&#92;rightarrow {&#92;mathbb R}_+}' class='latex' />, an <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' />-<em>augmenting path</em> is an <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' />-<img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> path <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> in the underlying graph, such that for each <img src='http://s0.wp.com/latex.php?latex=%7Be%5Cin+P%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{e&#92;in P}' title='{e&#92;in P}' class='latex' /> </p>
<ul>
<li> if <img src='http://s0.wp.com/latex.php?latex=%7Be%5Cin+D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{e&#92;in D}' title='{e&#92;in D}' class='latex' /> then <img src='http://s0.wp.com/latex.php?latex=%7Bf%28e%29%3Cc%28e%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f(e)&lt;c(e)}' title='{f(e)&lt;c(e)}' class='latex' />;
<li> if <img src='http://s0.wp.com/latex.php?latex=%7Be%5Cnot%5Cin+D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{e&#92;not&#92;in D}' title='{e&#92;not&#92;in D}' class='latex' /> then <img src='http://s0.wp.com/latex.php?latex=%7Bf%28e%29%3E0%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f(e)&gt;0}' title='{f(e)&gt;0}' class='latex' />.
</ul>
<p> The <em>tolerance</em> of <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> is
<p align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+%5Ctau%28P%29%3A%3D%5Cmin%28%5Cmin_%7Be%5Cin+P%5Csetminus+D%7D+f%28e%29%2C+%5Cmin_%7Be%5Cin+P%5Ccap+D%7Dc%28e%29-f%28e%29%29.&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;displaystyle &#92;tau(P):=&#92;min(&#92;min_{e&#92;in P&#92;setminus D} f(e), &#92;min_{e&#92;in P&#92;cap D}c(e)-f(e)).' title='&#92;displaystyle &#92;tau(P):=&#92;min(&#92;min_{e&#92;in P&#92;setminus D} f(e), &#92;min_{e&#92;in P&#92;cap D}c(e)-f(e)).' class='latex' /></p>
<p> </em></p></blockquote>
<p> Note that the definition of tolerance extends unchanged to any path starting at <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' />.</p>
<p>
We can use <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> to improve <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' />, as follows. </p>
<blockquote><p><b>Lemma 2</b> <em> For each <img src='http://s0.wp.com/latex.php?latex=%7Be%5Cin+D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{e&#92;in D}' title='{e&#92;in D}' class='latex' />, let
<p align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+f%27%28e%29%3D%5Cbegin%7Bcases%7D+f%28e%29+%26+e%5Cnot%5Cin+P%5C%5C+f%28e%29-%5Ctau%28P%29+%26+e%5Cin+P%5Csetminus+D%5C%5C+f%28e%29%2B%5Ctau%28P%29+%26+e%5Cin+P%5Ccap+D+%5Cend%7Bcases%7D.&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;displaystyle f&#039;(e)=&#92;begin{cases} f(e) &amp; e&#92;not&#92;in P&#92;&#92; f(e)-&#92;tau(P) &amp; e&#92;in P&#92;setminus D&#92;&#92; f(e)+&#92;tau(P) &amp; e&#92;in P&#92;cap D &#92;end{cases}.' title='&#92;displaystyle f&#039;(e)=&#92;begin{cases} f(e) &amp; e&#92;not&#92;in P&#92;&#92; f(e)-&#92;tau(P) &amp; e&#92;in P&#92;setminus D&#92;&#92; f(e)+&#92;tau(P) &amp; e&#92;in P&#92;cap D &#92;end{cases}.' class='latex' /></p>
<p> Then <img src='http://s0.wp.com/latex.php?latex=%7Bf%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f&#039;}' title='{f&#039;}' class='latex' /> is an <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' />-<img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> flow in <img src='http://s0.wp.com/latex.php?latex=%7B%28V%2CD%2Cc%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(V,D,c)}' title='{(V,D,c)}' class='latex' />, of value greater than that of <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' /> by <img src='http://s0.wp.com/latex.php?latex=%7B%5Ctau%28P%29.%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;tau(P).}' title='{&#92;tau(P).}' class='latex' /> </em></p></blockquote>
<p> <em>Proof:</em>  It is immediate from the definition of <img src='http://s0.wp.com/latex.php?latex=%7B%5Ctau%28P%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;tau(P)}' title='{&#92;tau(P)}' class='latex' /> that <img src='http://s0.wp.com/latex.php?latex=%7B0%5Cleq+f%27%28e%29%5Cleq+c%28e%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{0&#92;leq f&#039;(e)&#92;leq c(e)}' title='{0&#92;leq f&#039;(e)&#92;leq c(e)}' class='latex' /> for any <img src='http://s0.wp.com/latex.php?latex=%7Be%5Cin+D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{e&#92;in D}' title='{e&#92;in D}' class='latex' />. We still need to check the flow conservation constraints
<p align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+%5Csum_%7Bx%3A+xv%5Cin+D%7D+f%27%28%28xv%29%29%3D%5Csum_%7Bx%3A+vx%5Cin+D%7D+f%27%28%28vx%29%29%5Cquad%5Cforall+v%5Cin+V%5Csetminus%5C%7Bs%2Ct%5C%7D.&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;displaystyle &#92;sum_{x: xv&#92;in D} f&#039;((xv))=&#92;sum_{x: vx&#92;in D} f&#039;((vx))&#92;quad&#92;forall v&#92;in V&#92;setminus&#92;{s,t&#92;}.' title='&#92;displaystyle &#92;sum_{x: xv&#92;in D} f&#039;((xv))=&#92;sum_{x: vx&#92;in D} f&#039;((vx))&#92;quad&#92;forall v&#92;in V&#92;setminus&#92;{s,t&#92;}.' class='latex' /></p>
<p> If <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> visits <img src='http://s0.wp.com/latex.php?latex=%7Bv%5Cin+V%5Csetminus%5C%7Bs%2Ct%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v&#92;in V&#92;setminus&#92;{s,t&#92;}}' title='{v&#92;in V&#92;setminus&#92;{s,t&#92;}}' class='latex' /> then there are two arcs, say, <img src='http://s0.wp.com/latex.php?latex=%7Bxv%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{xv}' title='{xv}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Bvy%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{vy}' title='{vy}' class='latex' /> on <img src='http://s0.wp.com/latex.php?latex=%7Bv%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v}' title='{v}' class='latex' /> that are affected when we change <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7Bf%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f&#039;}' title='{f&#039;}' class='latex' />, and the changes in flow values cancel each other in each of the four cases (recall that <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> is a path in the underlying undirected graph). Finally, the value of <img src='http://s0.wp.com/latex.php?latex=%7Bf%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f&#039;}' title='{f&#039;}' class='latex' /> is the net outflow from <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' />, and the latter is greater than that of <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' /> by <img src='http://s0.wp.com/latex.php?latex=%7B%5Ctau%28P%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;tau(P)}' title='{&#92;tau(P)}' class='latex' />. <img src='http://s0.wp.com/latex.php?latex=%5CBox&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;Box' title='&#92;Box' class='latex' /></p>
<p>
This suggests finding a maximum flow by repeatedly finding an augmenting path and improving the current flow with it, till no augmenting path is available (this is, for instance, how Ford-Fulkerson algorithm is working). For this to succeed, we obviously need to prove that <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' /> is maximum if and only if it does not have an <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' />-augmenting path.</p>
<p>
Augmenting paths are found by a breadth-first search from <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' />. At some point, if we did not succeed in reaching <img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' />, we would end up with the set of vertices <img src='http://s0.wp.com/latex.php?latex=%7BS%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{S}' title='{S}' class='latex' /> reachable, in the underlying non-oriented graph, by paths with positive tolerance. Each <img src='http://s0.wp.com/latex.php?latex=%7Be%5Cin+D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{e&#92;in D}' title='{e&#92;in D}' class='latex' /> crossing over from <img src='http://s0.wp.com/latex.php?latex=%7BS%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{S}' title='{S}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7BT%3DV%5Csetminus+S%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{T=V&#92;setminus S}' title='{T=V&#92;setminus S}' class='latex' /> satisfies the property that <img src='http://s0.wp.com/latex.php?latex=%7Bc%28e%29%3Df%28e%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{c(e)=f(e)}' title='{c(e)=f(e)}' class='latex' />, and each arc <img src='http://s0.wp.com/latex.php?latex=%7Be%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{e}' title='{e}' class='latex' /> crossing from <img src='http://s0.wp.com/latex.php?latex=%7BT%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{T}' title='{T}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7BS%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{S}' title='{S}' class='latex' /> satisfies <img src='http://s0.wp.com/latex.php?latex=%7Bf%28e%29%3D0%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f(e)=0}' title='{f(e)=0}' class='latex' /> &#8212; otherwise we would have added their vertices in <img src='http://s0.wp.com/latex.php?latex=%7BT%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{T}' title='{T}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7BS%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{S}' title='{S}' class='latex' />. Therefore,
<p align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+%7B%5Cmathrm+val%7D+%28f%29%3D%5Csum_%7Bxy%5Cin+D%3A+x%5Cin+S%2C+y%5Cin+T%7D+c%28%28xy%29%29%3D%3A%7B%5Cmathrm+cap%7D+%28S%2CT%29%2C&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;displaystyle {&#92;mathrm val} (f)=&#92;sum_{xy&#92;in D: x&#92;in S, y&#92;in T} c((xy))=:{&#92;mathrm cap} (S,T),' title='&#92;displaystyle {&#92;mathrm val} (f)=&#92;sum_{xy&#92;in D: x&#92;in S, y&#92;in T} c((xy))=:{&#92;mathrm cap} (S,T),' class='latex' /></p>
<p> where on the right we have the definition of <em>capacity</em> of an arbitrary <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' />-<img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> cut <img src='http://s0.wp.com/latex.php?latex=%7B%28S%2CT%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(S,T)}' title='{(S,T)}' class='latex' />.</p>
<p>
It is easy to show that for an arbitrary <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' />-<img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> cut <img src='http://s0.wp.com/latex.php?latex=%7B%28S%27%2CT%27%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(S&#039;,T&#039;)}' title='{(S&#039;,T&#039;)}' class='latex' />, one has <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+cap%7D+%28S%27%2CT%27%29%5Cgeq+%7B%5Cmathrm+val%7D+%28f%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm cap} (S&#039;,T&#039;)&#92;geq {&#92;mathrm val} (f)}' title='{{&#92;mathrm cap} (S&#039;,T&#039;)&#92;geq {&#92;mathrm val} (f)}' class='latex' />. Thus we have have obtained <a href="http://equatorialmaths.wordpress.com/2009/10/12/total-unimodularity-and-networks/#maxflow">the Maxflow-Mincut Theorem</a>, and also proved that our algorithm, to be described in more detail shortly, finds a maximum flow <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' />, and a corresponding to it minimum cut <img src='http://s0.wp.com/latex.php?latex=%7B%28S%2CT%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(S,T)}' title='{(S,T)}' class='latex' />.</p>
<p>
<p><b> Breadth-first search: Ford-Fulkerson algorithm </b></p>
<p> As usual in breadth-first search, we use a <em>queue</em>, i.e. a data structure <img src='http://s0.wp.com/latex.php?latex=%7B%28Q%2Cp%2Cq%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(Q,p,q)}' title='{(Q,p,q)}' class='latex' /> that has two indices, one, <img src='http://s0.wp.com/latex.php?latex=%7Bq%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{q}' title='{q}' class='latex' />, pointing to the end of the queue, for new arrivals, and the other, <img src='http://s0.wp.com/latex.php?latex=%7Bp%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{p}' title='{p}' class='latex' />, pointing to the beginning of the queue, i.e. to the first element to be processed. There will be elementary operations: </p>
<ul>
<li> <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+Insert%7D+%28Q%2Cx%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm Insert} (Q,x)}' title='{{&#92;mathrm Insert} (Q,x)}' class='latex' /> &#8211; adds a new element, <img src='http://s0.wp.com/latex.php?latex=%7Bx%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{x}' title='{x}' class='latex' />, to the queue, and icrements <img src='http://s0.wp.com/latex.php?latex=%7Bq%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{q}' title='{q}' class='latex' />. In this case we also do not allow an element to enter the queue twice, so <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+Insert%7D+%28Q%2Cx%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm Insert} (Q,x)}' title='{{&#92;mathrm Insert} (Q,x)}' class='latex' /> has no effect if <img src='http://s0.wp.com/latex.php?latex=%7Bx%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{x}' title='{x}' class='latex' /> already was these once.
<li> <img src='http://s0.wp.com/latex.php?latex=%7Bx%3A%3D%7B%5Cmathrm+First%7D+%28Q%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{x:={&#92;mathrm First} (Q)}' title='{x:={&#92;mathrm First} (Q)}' class='latex' /> &#8211; takes the (currently) first element, <img src='http://s0.wp.com/latex.php?latex=%7Bx%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{x}' title='{x}' class='latex' />, from the queue, and icrements <img src='http://s0.wp.com/latex.php?latex=%7Bp%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{p}' title='{p}' class='latex' />&#8212;this will fail if <img src='http://s0.wp.com/latex.php?latex=%7BQ%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{Q}' title='{Q}' class='latex' /> is empty, i.e. if <img src='http://s0.wp.com/latex.php?latex=%7Bp%3Dq%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{p=q}' title='{p=q}' class='latex' />.
</ul>
<p>
Now the algorithm is as follows: </p>
<ol>
<li> Input: a feasible flow <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7B%28V%2CD%2Cc%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(V,D,c)}' title='{(V,D,c)}' class='latex' /> with source <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' /> and sink <img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' />.
<li> Initialization: let <img src='http://s0.wp.com/latex.php?latex=%7B%28Q%2Cp%2Cq%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(Q,p,q)}' title='{(Q,p,q)}' class='latex' /> be an empty queue; <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+Insert%7D+%28Q%2Cs%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm Insert} (Q,s)}' title='{{&#92;mathrm Insert} (Q,s)}' class='latex' />, and set <img src='http://s0.wp.com/latex.php?latex=%7BS%3A%3D%5C%7B%28s%2C%5Cinfty%29%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{S:=&#92;{(s,&#92;infty)&#92;}}' title='{S:=&#92;{(s,&#92;infty)&#92;}}' class='latex' />.
<li> Loop: take <img src='http://s0.wp.com/latex.php?latex=%7Bx%3A%3D%7B%5Cmathrm+First%7D+%28Q%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{x:={&#92;mathrm First} (Q)}' title='{x:={&#92;mathrm First} (Q)}' class='latex' />. If this fails, <b>return</b> the first coordinates of the pairs in <img src='http://s0.wp.com/latex.php?latex=%7BS%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{S}' title='{S}' class='latex' />&#8212;a minimum cut.
<li> for <img src='http://s0.wp.com/latex.php?latex=%7Bv%5Cin+V%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v&#92;in V}' title='{v&#92;in V}' class='latex' /> s.t. <img src='http://s0.wp.com/latex.php?latex=%7B%28xv%29%5Cin+D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(xv)&#92;in D}' title='{(xv)&#92;in D}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Bf%28%28xv%29%29%3Cc%28%28xv%29%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f((xv))&lt;c((xv))}' title='{f((xv))&lt;c((xv))}' class='latex' />, or s.t. <img src='http://s0.wp.com/latex.php?latex=%7B%28vx%29%5Cin+D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(vx)&#92;in D}' title='{(vx)&#92;in D}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Bf%28%28vx%29%29%3E0%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f((vx))&gt;0}' title='{f((vx))&gt;0}' class='latex' />:</p>
<ul>
<li> <img src='http://s0.wp.com/latex.php?latex=%7B%7B%5Cmathrm+Insert%7D+%28Q%2Cv%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{{&#92;mathrm Insert} (Q,v)}' title='{{&#92;mathrm Insert} (Q,v)}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=%7BS%3A%3DS%5Ccup%5C%7B%28v%2Cx%29%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{S:=S&#92;cup&#92;{(v,x)&#92;}}' title='{S:=S&#92;cup&#92;{(v,x)&#92;}}' class='latex' />.
<li> if <img src='http://s0.wp.com/latex.php?latex=%7Bv%3Dt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v=t}' title='{v=t}' class='latex' /> then <b>return</b> the augmenting <img src='http://s0.wp.com/latex.php?latex=%7Bs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{s}' title='{s}' class='latex' />-<img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> path by tracing back the pairs <img src='http://s0.wp.com/latex.php?latex=%7B%28t%2Cv_t%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(t,v_t)}' title='{(t,v_t)}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=%7B%28v_t%2Cv_%7Bt-1%7D%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(v_t,v_{t-1})}' title='{(v_t,v_{t-1})}' class='latex' />,\dots, <img src='http://s0.wp.com/latex.php?latex=%7B%28v_1%2Cs%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(v_1,s)}' title='{(v_1,s)}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7BS%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{S}' title='{S}' class='latex' />.
</ul>
<li> <b>go to</b> Loop.
</ol>
<p> So if <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' /> is not maximum we get an <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' />-augmenting path, that can be used to improve <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' />, and repeat. However, the speed of this procedure becomes unacceptable when the capacities are large. If <img src='http://s0.wp.com/latex.php?latex=%7Bc%5Cin%5Cmathbb%7BQ%7D%5E%7B%7CD%7C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{c&#92;in&#92;mathbb{Q}^{|D|}}' title='{c&#92;in&#92;mathbb{Q}^{|D|}}' class='latex' /> then we are at least assured that it will converge after finitely many steps: indeed, we can multiply <img src='http://s0.wp.com/latex.php?latex=%7Bc%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{c}' title='{c}' class='latex' /> by the least common multiple of its denominators, reducing to the case <img src='http://s0.wp.com/latex.php?latex=%7Bc%5Cin%5Cmathbb%7BZ%7D%5E%7B%7CD%7C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{c&#92;in&#92;mathbb{Z}^{|D|}}' title='{c&#92;in&#92;mathbb{Z}^{|D|}}' class='latex' />. Each iteration in this case improves the flow by at least <img src='http://s0.wp.com/latex.php?latex=%7B1%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{1}' title='{1}' class='latex' />. However, the time would not be polynomial in the input of the problem. E.g. for the following graph the number of iterations can be as large as <img src='http://s0.wp.com/latex.php?latex=%7B2M%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{2M}' title='{2M}' class='latex' />, when <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' /> is a large integer.
<p align="center"><img width="180" src="http://equatorialmaths.files.wordpress.com/2010/10/ffslow.jpg?w=180"></p>
<p> For irrational <img src='http://s0.wp.com/latex.php?latex=%7Bc%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{c}' title='{c}' class='latex' /> the convergence not even need to be the case!</p>
<p>
If one chooses a <em>shortest</em> <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' />-augmenting path to improve <img src='http://s0.wp.com/latex.php?latex=%7Bf%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{f}' title='{f}' class='latex' /> with, then the running time becomes bounded by <img src='http://s0.wp.com/latex.php?latex=%7BO%28%7CV%7C%7CD%7C%5E2%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{O(|V||D|^2)}' title='{O(|V||D|^2)}' class='latex' />&#8212;that was shown by E.Dinitz in 1970 and independently by J.Edmonds and R.Karp in 1972. Details, and further improvements by A.Karzanov et.al can be found e.g. in A.Schrijver&#8217;s <a href="http://homepages.cwi.nl/~lex/files/dict.pdf">lecture notes</a>, Sect.4.4.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/equatorialmaths.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/equatorialmaths.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/equatorialmaths.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/equatorialmaths.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/equatorialmaths.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/equatorialmaths.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/equatorialmaths.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/equatorialmaths.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/equatorialmaths.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/equatorialmaths.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/equatorialmaths.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/equatorialmaths.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/equatorialmaths.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/equatorialmaths.wordpress.com/375/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=375&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://equatorialmaths.wordpress.com/2010/10/11/augmenting-paths-for-maxflow-and-mincut/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Dima</media:title>
		</media:content>

		<media:content url="http://equatorialmaths.files.wordpress.com/2010/10/ffslow.jpg" medium="image" />
	</item>
		<item>
		<title>Edmonds algorithm for maximum matchings</title>
		<link>http://equatorialmaths.wordpress.com/2010/10/05/edmonds-algorithm-for-maximum-matchings/</link>
		<comments>http://equatorialmaths.wordpress.com/2010/10/05/edmonds-algorithm-for-maximum-matchings/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 03:38:53 +0000</pubDate>
		<dc:creator>Dima</dc:creator>
				<category><![CDATA[undergrad maths]]></category>
		<category><![CDATA[graph theory]]></category>
		<category><![CDATA[MAS324]]></category>

		<guid isPermaLink="false">http://equatorialmaths.wordpress.com/?p=358</guid>
		<description><![CDATA[We continue with matchings in simple graphs, following the exposition in A.Schrijver&#8217;s 3-volume work, and his lecture notes available online, filling in few more details. While in a bipartite graph and a matching it is always the case that a shortest path from the set of -unsaturated vertices to itself (i.e. an --path) is always [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=358&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>  We continue with matchings in simple graphs, following the exposition in <a href="http://homepages.cwi.nl/~lex/co/">A.Schrijver&#8217;s 3-volume work</a>, and his <a href="http://homepages.cwi.nl/~lex/files/dict.pdf">lecture notes available online</a>, filling in few more details.</p>
<p>
While in a bipartite graph <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%3D%28V%2CE%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma=(V,E)}' title='{&#92;Gamma=(V,E)}' class='latex' /> and a matching <img src='http://s0.wp.com/latex.php?latex=%7BM%5Csubset+E%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M&#92;subset E}' title='{M&#92;subset E}' class='latex' /> it is always the case that a shortest path from the set <img src='http://s0.wp.com/latex.php?latex=%7BX%5Csubset+V%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X&#92;subset V}' title='{X&#92;subset V}' class='latex' /> of <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-unsaturated vertices to itself (i.e. an <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' />-<img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' />-path) is always <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-augmenting, this is no longer true in general graphs:
<p align="center"><img width="220" src="http://equatorialmaths.files.wordpress.com/2010/10/flower.jpg?w=220"></p>
<p> here <img src='http://s0.wp.com/latex.php?latex=%7BX%3D%5C%7Ba%2Cb%5C%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X=&#92;{a,b&#92;}}' title='{X=&#92;{a,b&#92;}}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' /> is indicated by thicker edges, and the shortest path (of length 4) between them is not augmenting. This precludes the algorithmic idea of augmenting a matching <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' /> using an augmenting path (found by a shortest path procedure in a digraph constructed from <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />) from working in the general case. Edmonds came up with an idea that one can allow for repeated vertices, and shink the arising in the process cycles to (new) vertices. </p>
<blockquote><p><b>Definition 1</b> <em> An <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-alternating walk <img src='http://s0.wp.com/latex.php?latex=%7BP%3D%28v_0%2C%5Cdots%2Cv_t%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P=(v_0,&#92;dots,v_t)}' title='{P=(v_0,&#92;dots,v_t)}' class='latex' /> is a sequence of vertices (some of which can repeat!) that is a walk (i.e. <img src='http://s0.wp.com/latex.php?latex=%7Bv_i+v_%7Bi%2B1%7D%5Cin+E%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_i v_{i+1}&#92;in E}' title='{v_i v_{i+1}&#92;in E}' class='latex' /> for all <img src='http://s0.wp.com/latex.php?latex=%7B0%5Cleq+i%5Cleq+t-1%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{0&#92;leq i&#92;leq t-1}' title='{0&#92;leq i&#92;leq t-1}' class='latex' />) so that exactly one of <img src='http://s0.wp.com/latex.php?latex=%7Bv_%7Bi-1%7D+v_i%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_{i-1} v_i}' title='{v_{i-1} v_i}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Bv_i+v_%7Bi%2B1%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_i v_{i+1}}' title='{v_i v_{i+1}}' class='latex' /> is in <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />. </em></p></blockquote>
<blockquote><p><b>Definition 2</b> <em> An <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-alternating walk <img src='http://s0.wp.com/latex.php?latex=%7BP%3D%28v_0%2C%5Cdots%2Cv_t%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P=(v_0,&#92;dots,v_t)}' title='{P=(v_0,&#92;dots,v_t)}' class='latex' /> is an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-<em>flower</em> if <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> has an even number of vertices (as a sequence, i.e. <img src='http://s0.wp.com/latex.php?latex=%7Bt%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t}' title='{t}' class='latex' /> is odd), <img src='http://s0.wp.com/latex.php?latex=%7Bv_0%5Cin+X%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_0&#92;in X}' title='{v_0&#92;in X}' class='latex' />, all the <img src='http://s0.wp.com/latex.php?latex=%7Bv_0%2C%5Cdots%2Cv_%7Bt-1%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_0,&#92;dots,v_{t-1}}' title='{v_0,&#92;dots,v_{t-1}}' class='latex' /> are distinct, and <img src='http://s0.wp.com/latex.php?latex=%7Bv_t%3Dv_%7B2k%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_t=v_{2k}}' title='{v_t=v_{2k}}' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=%7B2k%3Ct.%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{2k&lt;t.}' title='{2k&lt;t.}' class='latex' /> (Removing the vertex <img src='http://s0.wp.com/latex.php?latex=%7Bb%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{b}' title='{b}' class='latex' /> and the edge <img src='http://s0.wp.com/latex.php?latex=%7Bbs%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{bs}' title='{bs}' class='latex' /> on the picture above is an example of an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-flower).<br />
 The cycle <img src='http://s0.wp.com/latex.php?latex=%7B%28v_%7B2k%7D%2Cv_%7B2k%2B1%7D%2C%5Cdots%2C+v_t%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(v_{2k},v_{2k+1},&#92;dots, v_t)}' title='{(v_{2k},v_{2k+1},&#92;dots, v_t)}' class='latex' /> in an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-flower is an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-<em>blossom.</em> (<img src='http://s0.wp.com/latex.php?latex=%7B%28qvuts%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(qvuts)}' title='{(qvuts)}' class='latex' /> on the picture above is an example of an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-blossom.) </em></p></blockquote>
<p><p>
Once we have an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-blossom <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' />, we can <em>shrink</em> it by replacing all of its vertices <img src='http://s0.wp.com/latex.php?latex=%7BV%28B%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{V(B)}' title='{V(B)}' class='latex' /> with just one vertex (call it <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' />, too), replacing each edge <img src='http://s0.wp.com/latex.php?latex=%7Buv%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{uv}' title='{uv}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=%7Bv%5Cin+V%28B%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v&#92;in V(B)}' title='{v&#92;in V(B)}' class='latex' /> with the edge <img src='http://s0.wp.com/latex.php?latex=%7BuB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{uB}' title='{uB}' class='latex' /> (and ignoring any loops that arise on <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' />). The resulting graph is denoted by <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%2FB%3D%28V%2FB%2C+E%2FB%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma/B=(V/B, E/B)}' title='{&#92;Gamma/B=(V/B, E/B)}' class='latex' />. (E.g. shrinking the <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-blossom <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' /> on the picture above produces the graph that is the path <img src='http://s0.wp.com/latex.php?latex=%7BapBb%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{apBb}' title='{apBb}' class='latex' />). In <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma/B}' title='{&#92;Gamma/B}' class='latex' /> one will have the matching <img src='http://s0.wp.com/latex.php?latex=%7BM%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M/B}' title='{M/B}' class='latex' />, where <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' /> will become just a saturated vertex. </p>
<blockquote><p><b>Theorem 3</b> <em> <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' /> is a maximum matching in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> if and only if <img src='http://s0.wp.com/latex.php?latex=%7BM%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M/B}' title='{M/B}' class='latex' /> is a maximum matching in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma/B}' title='{&#92;Gamma/B}' class='latex' />, for an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-blossom <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' />. </em></p></blockquote>
<p> <em>Proof:</em>  If <img src='http://s0.wp.com/latex.php?latex=%7BM%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M/B}' title='{M/B}' class='latex' /> is not a maximum matching in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma/B}' title='{&#92;Gamma/B}' class='latex' /> then there will be an <img src='http://s0.wp.com/latex.php?latex=%7BM%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M/B}' title='{M/B}' class='latex' />-augmenting path <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%2FB.%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma/B.}' title='{&#92;Gamma/B.}' class='latex' /> If <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> does not meet <img src='http://s0.wp.com/latex.php?latex=%7BB%3D%28v_%7B2k%7D%2C%5Cdots%2Cv_t%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B=(v_{2k},&#92;dots,v_t)}' title='{B=(v_{2k},&#92;dots,v_t)}' class='latex' /> then it corresponds to an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-augmenting path <img src='http://s0.wp.com/latex.php?latex=%7BP%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P&#039;}' title='{P&#039;}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' />. So we can assume that <img src='http://s0.wp.com/latex.php?latex=%7BuB%5Cnot%5Cin+M%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{uB&#92;not&#92;in M}' title='{uB&#92;not&#92;in M}' class='latex' /> is an edge of <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' />, and <img src='http://s0.wp.com/latex.php?latex=%7BBu%27%5Cin+M%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{Bu&#039;&#92;in M}' title='{Bu&#039;&#92;in M}' class='latex' /> is also an edge of <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' />. As <img src='http://s0.wp.com/latex.php?latex=%7BuB%5Cin+E%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{uB&#92;in E/B}' title='{uB&#92;in E/B}' class='latex' />, there exists <img src='http://s0.wp.com/latex.php?latex=%7B2k%5Cleq+j%3Ct%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{2k&#92;leq j&lt;t}' title='{2k&#92;leq j&lt;t}' class='latex' /> so that <img src='http://s0.wp.com/latex.php?latex=%7Buv_j%5Cin+E.%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{uv_j&#92;in E.}' title='{uv_j&#92;in E.}' class='latex' /> Now, depending upon the parity of <img src='http://s0.wp.com/latex.php?latex=%7Bj%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{j}' title='{j}' class='latex' />, we replace <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> by the part of the blossom rim <img src='http://s0.wp.com/latex.php?latex=%7Bv_j%2Cv_%7Bj%5Cpm+1%7D%2Cv_%7Bj%5Cpm+2%7D%2C%5Cdots%2Cv_t%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_j,v_{j&#92;pm 1},v_{j&#92;pm 2},&#92;dots,v_t}' title='{v_j,v_{j&#92;pm 1},v_{j&#92;pm 2},&#92;dots,v_t}' class='latex' />, where the sign in the indices is <img src='http://s0.wp.com/latex.php?latex=%7B%2B%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{+}' title='{+}' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=%7Bj%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{j}' title='{j}' class='latex' /> odd, and <img src='http://s0.wp.com/latex.php?latex=%7B-%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{-}' title='{-}' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=%7Bj%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{j}' title='{j}' class='latex' /> even.</p>
<p>
Conversely, if <img src='http://s0.wp.com/latex.php?latex=%7BM%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M&#039;}' title='{M&#039;}' class='latex' /> is not a maximum matching in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' />, then
<p align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+M%3DM%27%5CDelta+%5C%7Bv_0v_1%2C%5Cdots%2Cv_%7B2k-1%7Dv_%7B2k%7D%5C%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;displaystyle M=M&#039;&#92;Delta &#92;{v_0v_1,&#92;dots,v_{2k-1}v_{2k}&#92;}' title='&#92;displaystyle M=M&#039;&#92;Delta &#92;{v_0v_1,&#92;dots,v_{2k-1}v_{2k}&#92;}' class='latex' /></p>
<p> is also a matching of the same size, and <img src='http://s0.wp.com/latex.php?latex=%7B%7CM%2FB%7C%3D%7CM%27%2FB%7C%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{|M/B|=|M&#039;/B|}' title='{|M/B|=|M&#039;/B|}' class='latex' />. Thus it suffices to show that <img src='http://s0.wp.com/latex.php?latex=%7BM%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M/B}' title='{M/B}' class='latex' /> is not maximal in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma/B}' title='{&#92;Gamma/B}' class='latex' />, and we will assume w.l.o.g. that <img src='http://s0.wp.com/latex.php?latex=%7Bk%3D0%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{k=0}' title='{k=0}' class='latex' />, i.e. <img src='http://s0.wp.com/latex.php?latex=%7Bv_%7B2k%7D%3Dv_0%5Cin+X%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_{2k}=v_0&#92;in X}' title='{v_{2k}=v_0&#92;in X}' class='latex' /> (our flower has no stem). There exists an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-augmenting path <img src='http://s0.wp.com/latex.php?latex=%7BP%3D%28u_0%2C%5Cdots%2Cu_s%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P=(u_0,&#92;dots,u_s)}' title='{P=(u_0,&#92;dots,u_s)}' class='latex' />. W.l.o.g. <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> does not start in <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' /> (we can reverse it if it does). If <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> does not contain a vertex in <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' />, it will continue to be an <img src='http://s0.wp.com/latex.php?latex=%7BM%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M/B}' title='{M/B}' class='latex' /> augmenting path in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma/B}' title='{&#92;Gamma/B}' class='latex' />. Otherwise let the first vertex of <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' /> be <img src='http://s0.wp.com/latex.php?latex=%7Bu_j%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{u_j}' title='{u_j}' class='latex' />. Then <img src='http://s0.wp.com/latex.php?latex=%7B%28u_0%2C%5Cdots%2Cu_%7Bj-1%7D%2CB%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(u_0,&#92;dots,u_{j-1},B)}' title='{(u_0,&#92;dots,u_{j-1},B)}' class='latex' /> is an augmenting path in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma/B}' title='{&#92;Gamma/B}' class='latex' />. <img src='http://s0.wp.com/latex.php?latex=%5CBox&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;Box' title='&#92;Box' class='latex' /></p>
<p>
For the algorithm we will need </p>
<blockquote><p><b>Theorem 4</b> <em> A shortest <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' /> <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-alternating walk is either a path or its initial segment is an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-flower. </em></p></blockquote>
<p> <em>Proof:</em>  Assume <img src='http://s0.wp.com/latex.php?latex=%7BP%3D%28v_0%2C%5Cdots%2Cv_t%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P=(v_0,&#92;dots,v_t)}' title='{P=(v_0,&#92;dots,v_t)}' class='latex' /> is not a path, and let <img src='http://s0.wp.com/latex.php?latex=%7Bi%3Cj%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{i&lt;j}' title='{i&lt;j}' class='latex' /> be such that <img src='http://s0.wp.com/latex.php?latex=%7Bv_i%3Dv_j%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_i=v_j}' title='{v_i=v_j}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Bj%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{j}' title='{j}' class='latex' /> as small as possible. We will show that <img src='http://s0.wp.com/latex.php?latex=%7B%28v_0%2C%5Cdots%2Cv_j%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(v_0,&#92;dots,v_j)}' title='{(v_0,&#92;dots,v_j)}' class='latex' /> is an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-flower, and we immediately have it if <img src='http://s0.wp.com/latex.php?latex=%7Bi%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{i}' title='{i}' class='latex' /> is even and <img src='http://s0.wp.com/latex.php?latex=%7Bj%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{j}' title='{j}' class='latex' /> is odd.</p>
<p><p align="center"><img width="220" src="http://equatorialmaths.files.wordpress.com/2010/10/walk.jpg?w=220"></p>
<p> If <img src='http://s0.wp.com/latex.php?latex=%7Bj-i%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{j-i}' title='{j-i}' class='latex' /> were even, as shown above, where the walk might have been <img src='http://s0.wp.com/latex.php?latex=%7B%28apqstpqb%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(apqstpqb)}' title='{(apqstpqb)}' class='latex' />, and so <img src='http://s0.wp.com/latex.php?latex=%7Bj%3D5%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{j=5}' title='{j=5}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=%7Bi%3D1%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{i=1}' title='{i=1}' class='latex' />, then the path <img src='http://s0.wp.com/latex.php?latex=%7B%28v_i%2C%5Cdots%2Cv_%7Bj-1%7D%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{(v_i,&#92;dots,v_{j-1})}' title='{(v_i,&#92;dots,v_{j-1})}' class='latex' /> is <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-alternating, so we would simply delete it from <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> and obtain a shorter <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-alternating walk. </p>
<p>
If <img src='http://s0.wp.com/latex.php?latex=%7Bi%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{i}' title='{i}' class='latex' /> were odd and <img src='http://s0.wp.com/latex.php?latex=%7Bj%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{j}' title='{j}' class='latex' /> even, we would have <img src='http://s0.wp.com/latex.php?latex=%7Bv_iv_%7Bi%2B1%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_iv_{i+1}}' title='{v_iv_{i+1}}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Bv_%7Bj-1%7Dv_j%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_{j-1}v_j}' title='{v_{j-1}v_j}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />, so <img src='http://s0.wp.com/latex.php?latex=%7Bv_%7Bi%2B1%7D%3Dv_%7Bj-1%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_{i+1}=v_{j-1}}' title='{v_{i+1}=v_{j-1}}' class='latex' />, contradicting the choice of <img src='http://s0.wp.com/latex.php?latex=%7Bj%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{j}' title='{j}' class='latex' />. <img src='http://s0.wp.com/latex.php?latex=%5CBox&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;Box' title='&#92;Box' class='latex' /></p>
<p>
Combining these two observations, we obtain the following augmenting path algorithm: </p>
<ol>
<li> Input: a graph <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> and a matching <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />.
<li> Let <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' /> be the set of vertices unsaturated by <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />. Construct, if possible, a positive length shortest walk <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> from <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' />.<a name="XtoX"></a>
<li> If no <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> was constructed, return <img src='http://s0.wp.com/latex.php?latex=%7B%5Cemptyset%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;emptyset}' title='{&#92;emptyset}' class='latex' /> &#8212; <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' /> is maximum.
<li> If <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> is a path then return it.
<li> Otherwise take the first blossom <img src='http://s0.wp.com/latex.php?latex=%7BB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{B}' title='{B}' class='latex' /> from <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' />, call the algorithm recursively on <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma/B}' title='{&#92;Gamma/B}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7BM%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M/B}' title='{M/B}' class='latex' />, and return the expanded to an augmenting path in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma}' title='{&#92;Gamma}' class='latex' /> resulting path in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%2FB%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma/B}' title='{&#92;Gamma/B}' class='latex' />.
</ol>
<p> Applying the algorithm starting from <img src='http://s0.wp.com/latex.php?latex=%7BM%3D%5Cemptyset%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M=&#92;emptyset}' title='{M=&#92;emptyset}' class='latex' />, and augmenting <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' /> with the path it returns, we obtain an efficient algorithm, running in fact in <img src='http://s0.wp.com/latex.php?latex=%7BO%28%7CV%7C%5E2%7CE%7C%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{O(|V|^2|E|)}' title='{O(|V|^2|E|)}' class='latex' /> operations.</p>
<p>
We still need to discuss here how to do Step 2. To this end we construct a directed graph <img src='http://s0.wp.com/latex.php?latex=%7BD_M%3D%28V%2CA%5Ccup+A%27%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{D_M=(V,A&#92;cup A&#039;)}' title='{D_M=(V,A&#92;cup A&#039;)}' class='latex' /> with
<p align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+A%3A%3D%5C%7B%28u%2Cv%29%5Cmid+u%5Cneq+v%5Cin+V%2C+%5Cexists+ux%5Cin+E%2C+xv%5Cin+M%5C%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;displaystyle A:=&#92;{(u,v)&#92;mid u&#92;neq v&#92;in V, &#92;exists ux&#92;in E, xv&#92;in M&#92;}' title='&#92;displaystyle A:=&#92;{(u,v)&#92;mid u&#92;neq v&#92;in V, &#92;exists ux&#92;in E, xv&#92;in M&#92;}' class='latex' /></p>
<p align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+A%27%3A%3D%5C%7B%28u%2Cv%29%5Cmid+u%5Cneq+v%5Cin+X%2C+%5Cexists+uv%5Cin+E%5C%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;displaystyle A&#039;:=&#92;{(u,v)&#92;mid u&#92;neq v&#92;in X, &#92;exists uv&#92;in E&#92;}' title='&#92;displaystyle A&#039;:=&#92;{(u,v)&#92;mid u&#92;neq v&#92;in X, &#92;exists uv&#92;in E&#92;}' class='latex' /></p>
<blockquote><p><b>Lemma 5</b> <em> Each <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' /> <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-alternating path, resp. each <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-flower, corresponds to a directed path in <img src='http://s0.wp.com/latex.php?latex=%7BD%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{D}' title='{D}' class='latex' /> from <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%28X%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma(X)}' title='{&#92;Gamma(X)}' class='latex' />&#8212;the set of neighbours of <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma.%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma.}' title='{&#92;Gamma.}' class='latex' /> Conversely, each <img src='http://s0.wp.com/latex.php?latex=%7BX%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{X}' title='{X}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7B%5CGamma%28X%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{&#92;Gamma(X)}' title='{&#92;Gamma(X)}' class='latex' /> directed path in <img src='http://s0.wp.com/latex.php?latex=%7BA%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{A}' title='{A}' class='latex' /> corresponds either to an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-augmenting path or to an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-flower. </em></p></blockquote>
<p> <em>Proof:</em>  (Sketch) Each length 1 <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-augmenting path <img src='http://s0.wp.com/latex.php?latex=%7Buv%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{uv}' title='{uv}' class='latex' /> obviously corresponds to the pair of arcs <img src='http://s0.wp.com/latex.php?latex=%7Buv%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{uv}' title='{uv}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%7Bvu%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{vu}' title='{vu}' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=%7BA%27%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{A&#039;}' title='{A&#039;}' class='latex' />.</p>
<p>
If <img src='http://s0.wp.com/latex.php?latex=%7Bu_0%2Cu_1%2C%5Cdots%2Cu_s%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{u_0,u_1,&#92;dots,u_s}' title='{u_0,u_1,&#92;dots,u_s}' class='latex' /> is a <img src='http://s0.wp.com/latex.php?latex=%7BA%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{A}' title='{A}' class='latex' />-path in <img src='http://s0.wp.com/latex.php?latex=%7BD%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{D}' title='{D}' class='latex' />, so that <img src='http://s0.wp.com/latex.php?latex=%7Bu_0%5Cin+X%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{u_0&#92;in X}' title='{u_0&#92;in X}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=%7Bu_t%5Cin%5CGamma%28X%29%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{u_t&#92;in&#92;Gamma(X)}' title='{u_t&#92;in&#92;Gamma(X)}' class='latex' />, then there is a unique, up to the choice of <img src='http://s0.wp.com/latex.php?latex=%7Bu_%7Bs%2B1%7D%5Cin+X%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{u_{s+1}&#92;in X}' title='{u_{s+1}&#92;in X}' class='latex' />, lifting of it to an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-alternating walk <img src='http://s0.wp.com/latex.php?latex=%7BP%3Du_0%2Cv_1%2Cu_1%2Cv_2%2Cu_2%2C%5Cdots%2Cv_s%2Cu_s%2Cu_%7Bs%2B1%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P=u_0,v_1,u_1,v_2,u_2,&#92;dots,v_s,u_s,u_{s+1}}' title='{P=u_0,v_1,u_1,v_2,u_2,&#92;dots,v_s,u_s,u_{s+1}}' class='latex' />, with <img src='http://s0.wp.com/latex.php?latex=%7Bv_iu_i%5Cin+M%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{v_iu_i&#92;in M}' title='{v_iu_i&#92;in M}' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=%7B1%5Cleq+i%5Cleq+s%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{1&#92;leq i&#92;leq s}' title='{1&#92;leq i&#92;leq s}' class='latex' />. If <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> is a path then it is <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-augmenting.</p>
<p>
If <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> has repeated vertices, this repetition occurs in a regular way, corresponding to an <img src='http://s0.wp.com/latex.php?latex=%7BM%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{M}' title='{M}' class='latex' />-flower. As we move along <img src='http://s0.wp.com/latex.php?latex=%7BP%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{P}' title='{P}' class='latex' /> from <img src='http://s0.wp.com/latex.php?latex=%7Bu_0%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{u_0}' title='{u_0}' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%7Bu_s%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{u_s}' title='{u_s}' class='latex' />, let <img src='http://s0.wp.com/latex.php?latex=%7Bu_t%3Dv_i%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{u_t=v_i}' title='{u_t=v_i}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=%7Bt%3Ei%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{t&gt;i}' title='{t&gt;i}' class='latex' />, be the first repetition. Then <img src='http://s0.wp.com/latex.php?latex=%7Bu_i%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{u_i}' title='{u_i}' class='latex' /> is the beginning of the blossom, and <img src='http://s0.wp.com/latex.php?latex=%7Bu_%7Bt-1%7D%7D&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='{u_{t-1}}' title='{u_{t-1}}' class='latex' /> the last vertex of the blossom. <img src='http://s0.wp.com/latex.php?latex=%5CBox&amp;bg=ffffff&amp;fg=000000&amp;s=0' alt='&#92;Box' title='&#92;Box' class='latex' /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/equatorialmaths.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/equatorialmaths.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/equatorialmaths.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/equatorialmaths.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/equatorialmaths.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/equatorialmaths.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/equatorialmaths.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/equatorialmaths.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/equatorialmaths.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/equatorialmaths.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/equatorialmaths.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/equatorialmaths.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/equatorialmaths.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/equatorialmaths.wordpress.com/358/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=358&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://equatorialmaths.wordpress.com/2010/10/05/edmonds-algorithm-for-maximum-matchings/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Dima</media:title>
		</media:content>

		<media:content url="http://equatorialmaths.files.wordpress.com/2010/10/flower.jpg" medium="image" />

		<media:content url="http://equatorialmaths.files.wordpress.com/2010/10/walk.jpg" medium="image" />
	</item>
		<item>
		<title>Installing CPLEX 12.2 on Debian amd64 and MacOSX 10.6 (64-bit)</title>
		<link>http://equatorialmaths.wordpress.com/2010/09/24/installing-cplex-12-2-on-debian-amd64/</link>
		<comments>http://equatorialmaths.wordpress.com/2010/09/24/installing-cplex-12-2-on-debian-amd64/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 12:02:51 +0000</pubDate>
		<dc:creator>Dima</dc:creator>
				<category><![CDATA[maths software]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://equatorialmaths.wordpress.com/?p=343</guid>
		<description><![CDATA[IBM now gives CPLEX to academics for free; as I am computing LP bounds for quantum codes, I got myself one. However, it refused to install on my amd64 Debian system, saying "libgcc_s.so.1 must be installed for pthread_cancel to work". After much googling, it turned out that the installer is a 32-bit program, that needs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=343&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>IBM now gives <a href="https://www.ibm.com/developerworks/university/academicinitiative/">CPLEX to academics for free</a>; as I am computing LP bounds for quantum codes, I got myself one. However, it refused to install on my amd64 Debian system, saying </p>
<p><code>"libgcc_s.so.1 must be installed for pthread_cancel to work"</code>. </p>
<p>After much googling, it turned out that the installer is a 32-bit program, that needs the right 32-bit libgcc_s.so to work.<br />
To get this on  Debian (squeeze), I just did<br />
<code>$ apt-get install ia32-libs</code><br />
Then<br />
<code>$ LD_LIBRARY_PATH=/usr/lib32; <br /> sh cplex_studio122.acad.linux-x86.bin</code><br />
worked as it should.</p>
<p>The installation goes smoothly on a 64-bit MacOSX 10.6.  But running is not: one has problems when doing<br />
<code><br />
&gt;&gt;&gt; import cplex<br />
...<br />
    from cplex._internal.py1013_cplex122 import *<br />
ImportError: dlopen(/Library/Python/2.6/site-packages/cplex/_internal/py1013_cplex122.so, 2): no suitable image found.  Did find:<br />
	/Library/Python/2.6/site-packages/cplex/_internal/py1013_cplex122.so: mach-o, but wrong architecture<br />
</code></p>
<p>One can make it work on by setting<br />
<code>$ export VERSIONER_PYTHON_PREFER_32_BIT=yes</code><br />
before starting the Python session (as IBM/CPLEX Support kindly told me; they promised a fix in an upgrade, too).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/equatorialmaths.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/equatorialmaths.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/equatorialmaths.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/equatorialmaths.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/equatorialmaths.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/equatorialmaths.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/equatorialmaths.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/equatorialmaths.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/equatorialmaths.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/equatorialmaths.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/equatorialmaths.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/equatorialmaths.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/equatorialmaths.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/equatorialmaths.wordpress.com/343/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=343&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://equatorialmaths.wordpress.com/2010/09/24/installing-cplex-12-2-on-debian-amd64/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Dima</media:title>
		</media:content>
	</item>
		<item>
		<title>Is C++ the worst 1st programming language for maths majors?</title>
		<link>http://equatorialmaths.wordpress.com/2010/05/07/is-c-the-worst-1st-programming-language-for-maths-majors/</link>
		<comments>http://equatorialmaths.wordpress.com/2010/05/07/is-c-the-worst-1st-programming-language-for-maths-majors/#comments</comments>
		<pubDate>Thu, 06 May 2010 16:50:12 +0000</pubDate>
		<dc:creator>Dima</dc:creator>
				<category><![CDATA[maths software]]></category>
		<category><![CDATA[undergrad maths]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[teaching]]></category>

		<guid isPermaLink="false">http://equatorialmaths.wordpress.com/?p=335</guid>
		<description><![CDATA[In our department we have a 1-semester course called &#8220;Introduction to scientific programming&#8221;, that is taught to the 1st year undergrads. It is C++-based. I am arguing for years that it is a real waste, and only good for getting people dazed and confused, and that instead something like Python should be used. The choice [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=335&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In our department we have a 1-semester course called &#8220;Introduction to scientific programming&#8221;, that is taught to the 1st year undergrads. It is C++-based. I am arguing for years that it is a real waste, and only good for getting people dazed and confused, and that instead something like Python should be used.</p>
<p>The choice of Python is basically due to it being interpreted, (largely) untyped, and higher level than C/C++.<br />
(And last but not least, free, unlike  Maple,  Matlab, and Mathematica, which might be marginally more useful to a maths major).</p>
<p>Here is <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">a ranking of programming languages in industry.</a> Inevitably biased in some ways, I suppose it still demonstrates that claimed &#8220;superiority&#8221; of C++ is nowhere to be seen&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/equatorialmaths.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/equatorialmaths.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/equatorialmaths.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/equatorialmaths.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/equatorialmaths.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/equatorialmaths.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/equatorialmaths.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/equatorialmaths.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/equatorialmaths.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/equatorialmaths.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/equatorialmaths.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/equatorialmaths.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/equatorialmaths.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/equatorialmaths.wordpress.com/335/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=335&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://equatorialmaths.wordpress.com/2010/05/07/is-c-the-worst-1st-programming-language-for-maths-majors/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Dima</media:title>
		</media:content>
	</item>
		<item>
		<title>Total unimodularity and networks</title>
		<link>http://equatorialmaths.wordpress.com/2009/10/12/total-unimodularity-and-networks/</link>
		<comments>http://equatorialmaths.wordpress.com/2009/10/12/total-unimodularity-and-networks/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 07:27:40 +0000</pubDate>
		<dc:creator>Dima</dc:creator>
				<category><![CDATA[undergrad maths]]></category>
		<category><![CDATA[combinatorics]]></category>
		<category><![CDATA[graph theory]]></category>
		<category><![CDATA[MAS324]]></category>
		<category><![CDATA[MAS445]]></category>

		<guid isPermaLink="false">http://equatorialmaths.wordpress.com/?p=318</guid>
		<description><![CDATA[Total unimodularity is a tool to show that a linear programming problem (LP) has integer optimal solutions. In our discussion on bipartite matchings and linear programming we saw how this is possible to do by hand in a particular case, but as the structure of the LP gets more complicated the details can get very [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=318&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Total unimodularity is a tool to show that a linear programming problem (LP) has integer optimal solutions. In our discussion on <a href="http://equatorialmaths.wordpress.com/2009/09/14/bipartite-matchings-via-linear-programming/">bipartite matchings and linear programming</a> we saw how this is possible to do by hand in a particular case, but as the structure of the LP gets more complicated the details can get very messy. Fortunately, there is a general tool that sometimes gives what is needed.</p>
<blockquote><p>
<b>Definition</b>. A matrix <img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A' title='A' class='latex' /> is called <i>totally unimodular</i> if each of its subdeterminants equals 0, 1, or -1. (In particular, each entry of <img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A' title='A' class='latex' /> is 0, 1, or -1.)
</p></blockquote>
<blockquote><p>
<b>Proposition.</b> Let <img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A' title='A' class='latex' /> be totally unimodular and <img src='http://s0.wp.com/latex.php?latex=b%5Cin%5Cmathbb%7BZ%7D%5En.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='b&#92;in&#92;mathbb{Z}^n.' title='b&#92;in&#92;mathbb{Z}^n.' class='latex' /> Then the polyhedron <img src='http://s0.wp.com/latex.php?latex=P%3D%5C%7Bx%5Cmid+Ax%5Cleq+b%5C%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='P=&#92;{x&#92;mid Ax&#92;leq b&#92;}' title='P=&#92;{x&#92;mid Ax&#92;leq b&#92;}' class='latex' /> is integral (i.e. each face has an integer point.)
</p></blockquote>
<p><b>Proof.</b> For a minimal (w.r.t. inclusion) face <img src='http://s0.wp.com/latex.php?latex=F&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='F' title='F' class='latex' /> of <img src='http://s0.wp.com/latex.php?latex=P&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='P' title='P' class='latex' /> one has <img src='http://s0.wp.com/latex.php?latex=F%3D%5C%7Bx%5Cmid+A%27x%3Db%27%5C%7D%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='F=&#92;{x&#92;mid A&#039;x=b&#039;&#92;},' title='F=&#92;{x&#92;mid A&#039;x=b&#039;&#92;},' class='latex' /> where <img src='http://s0.wp.com/latex.php?latex=A%27%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;,' title='A&#039;,' class='latex' /> resp. <img src='http://s0.wp.com/latex.php?latex=b%27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='b&#039;' title='b&#039;' class='latex' /> is a submatrix, resp. subvector, of <img src='http://s0.wp.com/latex.php?latex=A%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A,' title='A,' class='latex' /> resp. of <img src='http://s0.wp.com/latex.php?latex=b%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='b,' title='b,' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=A%27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;' title='A&#039;' class='latex' /> has full row rank. Then, possibly after permuting coordinates, we have <img src='http://s0.wp.com/latex.php?latex=A%27%3D%28U%3B+V%29%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;=(U; V),' title='A&#039;=(U; V),' class='latex' /> with <img src='http://s0.wp.com/latex.php?latex=%7CU%7C%5Cneq+0.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='|U|&#92;neq 0.' title='|U|&#92;neq 0.' class='latex' /> By total unimodularity, <img src='http://s0.wp.com/latex.php?latex=%7CU%7C%3D%5Cpm+1.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='|U|=&#92;pm 1.' title='|U|=&#92;pm 1.' class='latex' /> Then <img src='http://s0.wp.com/latex.php?latex=x%3A%3D%28U%5E%7B-1%7Db%27%5C+0%29%5Cin+%5Cmathbb%7BZ%7D%5Em&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x:=(U^{-1}b&#039;&#92; 0)&#92;in &#92;mathbb{Z}^m' title='x:=(U^{-1}b&#039;&#92; 0)&#92;in &#92;mathbb{Z}^m' class='latex' /> and satisfies <img src='http://s0.wp.com/latex.php?latex=A%27x%3Db%27.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;x=b&#039;.' title='A&#039;x=b&#039;.' class='latex' /> </p>
<p>To complete the proof we need to check that <img src='http://s0.wp.com/latex.php?latex=x%5Cin+P.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x&#92;in P.' title='x&#92;in P.' class='latex' /> This is where the minimality of <img src='http://s0.wp.com/latex.php?latex=F&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='F' title='F' class='latex' /> is needed. In the simplest case <img src='http://s0.wp.com/latex.php?latex=F&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='F' title='F' class='latex' /> is a vertex, and <img src='http://s0.wp.com/latex.php?latex=%5C%7Bx%5C%7D%3DF%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;{x&#92;}=F,' title='&#92;{x&#92;}=F,' class='latex' /> implying the claim. In general, <img src='http://s0.wp.com/latex.php?latex=F%3Dv%2BNull%28A%29%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='F=v+Null(A),' title='F=v+Null(A),' class='latex' /> i.e. a translate of the nullspace of <img src='http://s0.wp.com/latex.php?latex=A.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A.' title='A.' class='latex' /> So one can reduce to the vertex case by adding equations of the form <img src='http://s0.wp.com/latex.php?latex=x_j%3D0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x_j=0' title='x_j=0' class='latex' /> for each column <img src='http://s0.wp.com/latex.php?latex=j&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='j' title='j' class='latex' /> of the submatrix <img src='http://s0.wp.com/latex.php?latex=V%3B&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='V;' title='V;' class='latex' /> this does not destroy the feasibility of <img src='http://s0.wp.com/latex.php?latex=Ax%5Cleq+b.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='Ax&#92;leq b.' title='Ax&#92;leq b.' class='latex' /> QED.</p>
<p>As a corollary, the LP <img src='http://s0.wp.com/latex.php?latex=%5Cmax_%7Bx%5Cin+P%7D+c%5ET+x&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;max_{x&#92;in P} c^T x' title='&#92;max_{x&#92;in P} c^T x' class='latex' /> has integer optimum (and optimiser) whenever <img src='http://s0.wp.com/latex.php?latex=c%5Cin+%5Cmathbb%7BZ%7D%5Em.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='c&#92;in &#92;mathbb{Z}^m.' title='c&#92;in &#92;mathbb{Z}^m.' class='latex' /> Moreover, the same holds for its LP dual <img src='http://s0.wp.com/latex.php?latex=%5Cmin+b%5ET+y%2C+y%5Cin+P%5E%2A%3D%5C%7Bz%5Cgeq+0%5Cmid+A%5ETz%3Dc%5C%7D%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;min b^T y, y&#92;in P^*=&#92;{z&#92;geq 0&#92;mid A^Tz=c&#92;},' title='&#92;min b^T y, y&#92;in P^*=&#92;{z&#92;geq 0&#92;mid A^Tz=c&#92;},' class='latex' /> by rewriting <img src='http://s0.wp.com/latex.php?latex=P%5E%2A%3D%5C%7Bz%5Cmid+%28I%3BA%5ET%3B-A%5ET%29z%5Cleq+%28%5Coverline%7B0%7D%2Cc%2C-c%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='P^*=&#92;{z&#92;mid (I;A^T;-A^T)z&#92;leq (&#92;overline{0},c,-c)' title='P^*=&#92;{z&#92;mid (I;A^T;-A^T)z&#92;leq (&#92;overline{0},c,-c)' class='latex' /> and applying the proposition above.</p>
<p><b>Hoffman-Kruskal Theorem.</b> It turns out that this property characterises<br />
total unimodularity:</p>
<blockquote>
<ol>
<li><img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A' title='A' class='latex' /> is totally unimodular iff for any <img src='http://s0.wp.com/latex.php?latex=b%5Cin%5Cmathbb%7BZ%7D%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='b&#92;in&#92;mathbb{Z}^n' title='b&#92;in&#92;mathbb{Z}^n' class='latex' /> the polyhedron <img src='http://s0.wp.com/latex.php?latex=P%3D%5C%7Bx%5Cmid+Ax%5Cleq+b%5C%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='P=&#92;{x&#92;mid Ax&#92;leq b&#92;}' title='P=&#92;{x&#92;mid Ax&#92;leq b&#92;}' class='latex' /> is integral.
<li><img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A' title='A' class='latex' /> is totally unimodular iff for any <img src='http://s0.wp.com/latex.php?latex=b%5Cin%5Cmathbb%7BZ%7D%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='b&#92;in&#92;mathbb{Z}^n' title='b&#92;in&#92;mathbb{Z}^n' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=c%5Cin%5Cmathbb%7BZ%7D%5Em&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='c&#92;in&#92;mathbb{Z}^m' title='c&#92;in&#92;mathbb{Z}^m' class='latex' /> the equality in the LP duality equation <img src='http://s0.wp.com/latex.php?latex=%5Cmax_%7Bx%5Cin+P%7D+c%5ET+x%3D%5Cmin_%7By%5Cin+P%5E%2A%7Db%5ET+y&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;max_{x&#92;in P} c^T x=&#92;min_{y&#92;in P^*}b^T y' title='&#92;max_{x&#92;in P} c^T x=&#92;min_{y&#92;in P^*}b^T y' class='latex' />  is achieved by integral vectors (assuming these min and max are finite).
</ol>
</blockquote>
<p>The second obviously follows from the first.<br />
The first will follow from the following:</p>
<blockquote><p>
A full rank matrix <img src='http://s0.wp.com/latex.php?latex=A%27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;' title='A&#039;' class='latex' /> is totally unimodular iff for any <img src='http://s0.wp.com/latex.php?latex=b%27%5Cin%5Cmathbb%7BZ%7D%5E%7Bn%27%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='b&#039;&#92;in&#92;mathbb{Z}^{n&#039;}' title='b&#039;&#92;in&#92;mathbb{Z}^{n&#039;}' class='latex' /> the polyhedron <img src='http://s0.wp.com/latex.php?latex=%5C%7Bx%5Cmid+x%5Cgeq+0%2C+A%27x%3Db%27%5C%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;{x&#92;mid x&#92;geq 0, A&#039;x=b&#039;&#92;}' title='&#92;{x&#92;mid x&#92;geq 0, A&#039;x=b&#039;&#92;}' class='latex' /> is integral.
</p></blockquote>
<p>We omit the proof here.</p>
<p><b>Examples of totally unimodular matrices.</b></p>
<blockquote><p>
(Vertex-edge) incidence matrix <img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A' title='A' class='latex' /> of a graph <img src='http://s0.wp.com/latex.php?latex=%5CGamma%3D%28V%2CE%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Gamma=(V,E)' title='&#92;Gamma=(V,E)' class='latex' /> is totally unimodular iff <img src='http://s0.wp.com/latex.php?latex=%5CGamma&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Gamma' title='&#92;Gamma' class='latex' /> is bipartite.
</p></blockquote>
<p><b>Sketch of the proof.</b><br />
1) Prove that the incidence matrix of an odd cycle is not totally unimodular, e.g. by considering the vertex numbering such that the edges are <img src='http://s0.wp.com/latex.php?latex=%281%2C2%29%2C+%282%2C3%29%2C%5Cdots%2C%28n-1%2Cn%29%2C%281%2Cn%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(1,2), (2,3),&#92;dots,(n-1,n),(1,n)' title='(1,2), (2,3),&#92;dots,(n-1,n),(1,n)' class='latex' /> and arranging the columns of the matrix in this order, while arranging the rows in the order <img src='http://s0.wp.com/latex.php?latex=2%2C3%2C%5Cdots%2Cn-1%2Cn%2C1.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='2,3,&#92;dots,n-1,n,1.' title='2,3,&#92;dots,n-1,n,1.' class='latex' /> Then the usual decomposition of the determinant w.r.t. all the permutations of <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> symbols will have only 2 nonzero summands, that will not cancel each other (actually, in the case  of <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> even they will cancel each other).<br />
This shows that <img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A' title='A' class='latex' /> cannot be totally unimodular if <img src='http://s0.wp.com/latex.php?latex=%5CGamma&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Gamma' title='&#92;Gamma' class='latex' /> is not bipartite. <br />
2) Let <img src='http://s0.wp.com/latex.php?latex=A%27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;' title='A&#039;' class='latex' /> be a square submatrix of <img src='http://s0.wp.com/latex.php?latex=A.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A.' title='A.' class='latex' /> If it has a 0 column its determinant is 0. If it has a column with just one 1, we can decompose the determinant w.r.t. this column and apply induction on the size of <img src='http://s0.wp.com/latex.php?latex=A.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A.' title='A.' class='latex' /> This leaves one with the case of <img src='http://s0.wp.com/latex.php?latex=A%27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;' title='A&#039;' class='latex' /> having exactly two 1s per column. Same argument can be applied to argue that <img src='http://s0.wp.com/latex.php?latex=A%27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;' title='A&#039;' class='latex' /> has, w.l.o.g., at least two 1s per row, and thus exactly two 1s, by counting 1s of <img src='http://s0.wp.com/latex.php?latex=A%27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;' title='A&#039;' class='latex' /> in two ways. It follows that <img src='http://s0.wp.com/latex.php?latex=A%27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;' title='A&#039;' class='latex' /> is the incidence matrix of a disjoint union of (even, as <img src='http://s0.wp.com/latex.php?latex=%5CGamma&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Gamma' title='&#92;Gamma' class='latex' /> is bipartite) cycles. By reordering the rows and columns we and make <img src='http://s0.wp.com/latex.php?latex=A%27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#039;' title='A&#039;' class='latex' /> to be block-diagonal, with each block the incidence matrix of an even cycle. The determinant of a block-diagonal matrix equals the product of determinants of the blocks, and so it remains to show that the incidence matrix of an even cycle is totally unimodular; this can be done as above. Q.E.D.</p>
<blockquote><p>
<b>Excercise.</b> Combine this with the result on the total unimodularity above to show that the <a href="http://equatorialmaths.wordpress.com/2009/09/14/bipartite-matchings-via-linear-programming/"> maximum matching LP for bipartite graphs</a> has an integer solution. Construct the LP dual for this problem and interpret its integer solutions (show that they exist first!) in graph-theoretic terms.
</p></blockquote>
<blockquote><p>
<b>Excercise.</b> The incidence matrix <img src='http://s0.wp.com/latex.php?latex=M&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='M' title='M' class='latex' /> of a digraph <img src='http://s0.wp.com/latex.php?latex=%5CGamma%3D%28V%2CA%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Gamma=(V,A)' title='&#92;Gamma=(V,A)' class='latex' /> is a 0,1,-1 matrix of size <img src='http://s0.wp.com/latex.php?latex=%7CV%7C%5Ctimes+%7CA%7C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='|V|&#92;times |A|' title='|V|&#92;times |A|' class='latex' /> so that <img src='http://s0.wp.com/latex.php?latex=A_%7Bv%2Cd%7D%3D0%2C1%2C-1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A_{v,d}=0,1,-1' title='A_{v,d}=0,1,-1' class='latex' /> if, respectively, <img src='http://s0.wp.com/latex.php?latex=d%5Cin+A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d&#92;in A' title='d&#92;in A' class='latex' /> misses <img src='http://s0.wp.com/latex.php?latex=v%5Cin+V%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='v&#92;in V,' title='v&#92;in V,' class='latex' /> or <img src='http://s0.wp.com/latex.php?latex=d&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d' title='d' class='latex' /> arrives to <img src='http://s0.wp.com/latex.php?latex=v%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='v,' title='v,' class='latex' /> or <img src='http://s0.wp.com/latex.php?latex=d&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d' title='d' class='latex' /> leaves <img src='http://s0.wp.com/latex.php?latex=v.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='v.' title='v.' class='latex' /> Show that <img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A' title='A' class='latex' /> is totally unimodular.
</p></blockquote>
<p></p>
<p><a name="maxflow"><b>Network flows and max-flow min-cut theorem.</b></a><br />
Armed with the above, we can easily prove the max-flow min-cut theorem for networks. Recall that a <i>network</i> is a directed graph <img src='http://s0.wp.com/latex.php?latex=%5CGamma%3D%28V%2CA%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Gamma=(V,A)' title='&#92;Gamma=(V,A)' class='latex' /> with two marked nodes <img src='http://s0.wp.com/latex.php?latex=s%2Ct%5Cin+V%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s,t&#92;in V,' title='s,t&#92;in V,' class='latex' /> and arc <i>capacities</i> <img src='http://s0.wp.com/latex.php?latex=c%3A+A%5Cto+%5Cmathbb%7BR%7D_%2B.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='c: A&#92;to &#92;mathbb{R}_+.' title='c: A&#92;to &#92;mathbb{R}_+.' class='latex' /> An <img src='http://s0.wp.com/latex.php?latex=s-t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s-t' title='s-t' class='latex' />-<i>flow</i> on the network <img src='http://s0.wp.com/latex.php?latex=%28%5CGamma%2Cs%2Ct%2Cc%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(&#92;Gamma,s,t,c)' title='(&#92;Gamma,s,t,c)' class='latex' /> is a function <img src='http://s0.wp.com/latex.php?latex=f%3A+A%5Cto+%5Cmathbb%7BR%7D_%2B&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f: A&#92;to &#92;mathbb{R}_+' title='f: A&#92;to &#92;mathbb{R}_+' class='latex' /> satisfying <img src='http://s0.wp.com/latex.php?latex=f%28a%29%5Cleq+c%28a%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f(a)&#92;leq c(a)' title='f(a)&#92;leq c(a)' class='latex' /> for all <img src='http://s0.wp.com/latex.php?latex=a%5Cin+A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a&#92;in A' title='a&#92;in A' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=f_%2B%28v%29%3Df_-%28v%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f_+(v)=f_-(v)' title='f_+(v)=f_-(v)' class='latex' /> for any <img src='http://s0.wp.com/latex.php?latex=v%5Cin+V%5Csetminus%5C%7Bs%2Ct%5C%7D%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='v&#92;in V&#92;setminus&#92;{s,t&#92;},' title='v&#92;in V&#92;setminus&#92;{s,t&#92;},' class='latex' /> where <img src='http://s0.wp.com/latex.php?latex=f_%2B%3D%5Csum_%7Bu%5Cin+V%5Cmid+%28uv%29%5Cin+A%7D+f%28uv%29%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f_+=&#92;sum_{u&#92;in V&#92;mid (uv)&#92;in A} f(uv),' title='f_+=&#92;sum_{u&#92;in V&#92;mid (uv)&#92;in A} f(uv),' class='latex' /> and   <img src='http://s0.wp.com/latex.php?latex=f_-%3D%5Csum_%7Bu%5Cin+V%5Cmid+%28vu%29%5Cin+A%7D+f%28vu%29.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f_-=&#92;sum_{u&#92;in V&#92;mid (vu)&#92;in A} f(vu).' title='f_-=&#92;sum_{u&#92;in V&#92;mid (vu)&#92;in A} f(vu).' class='latex' /> (The latter is called <i>conservation law</i>.) The <i>value</i> of <img src='http://s0.wp.com/latex.php?latex=f&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f' title='f' class='latex' /> is <img src='http://s0.wp.com/latex.php?latex=f_%2B%28s%29-f_-%28s%29%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f_+(s)-f_-(s),' title='f_+(s)-f_-(s),' class='latex' /> i.e. the &#8220;amount&#8221; of <img src='http://s0.wp.com/latex.php?latex=f&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f' title='f' class='latex' /> that &#8220;leaves&#8221; <img src='http://s0.wp.com/latex.php?latex=s.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s.' title='s.' class='latex' /><br />
And <img src='http://s0.wp.com/latex.php?latex=s-t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s-t' title='s-t' class='latex' /> <i>cut</i> is a partition of <img src='http://s0.wp.com/latex.php?latex=V&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='V' title='V' class='latex' /> into two parts <img src='http://s0.wp.com/latex.php?latex=S&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='S' title='S' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=T&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='T' title='T' class='latex' /> so that <img src='http://s0.wp.com/latex.php?latex=s%5Cin+S%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s&#92;in S,' title='s&#92;in S,' class='latex' /> <img src='http://s0.wp.com/latex.php?latex=t%5Cin+T.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='t&#92;in T.' title='t&#92;in T.' class='latex' /> The <i>capacity of the cut</i> is the sum of the capacities of the arc leaving <img src='http://s0.wp.com/latex.php?latex=T.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='T.' title='T.' class='latex' /></p>
<blockquote><p>
<b>Max-flow min-cut theorem.</b>  Given the network <img src='http://s0.wp.com/latex.php?latex=%28%5CGamma%2Cs%2Ct%2Cc%29%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(&#92;Gamma,s,t,c),' title='(&#92;Gamma,s,t,c),' class='latex' /> the maximum value of an <img src='http://s0.wp.com/latex.php?latex=s-t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s-t' title='s-t' class='latex' />-flow is equal to the minimum capacity of an <img src='http://s0.wp.com/latex.php?latex=s-t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s-t' title='s-t' class='latex' />-cut.
</p></blockquote>
<p>In order to formulate this as an LP, we introduce the function <img src='http://s0.wp.com/latex.php?latex=w%3AA%5Cto+%5Cmathbb%7BZ%7D_%2B&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='w:A&#92;to &#92;mathbb{Z}_+' title='w:A&#92;to &#92;mathbb{Z}_+' class='latex' /> so that <img src='http://s0.wp.com/latex.php?latex=w%28a%29%3D0%2C1%2C%5Ctext%7B+or+%7D-1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='w(a)=0,1,&#92;text{ or }-1' title='w(a)=0,1,&#92;text{ or }-1' class='latex' /> if, respectively, <img src='http://s0.wp.com/latex.php?latex=a&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a' title='a' class='latex' /> misses <img src='http://s0.wp.com/latex.php?latex=s%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s,' title='s,' class='latex' /> or resp. <img src='http://s0.wp.com/latex.php?latex=a&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a' title='a' class='latex' /> enters <img src='http://s0.wp.com/latex.php?latex=s%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s,' title='s,' class='latex' /> or resp. <img src='http://s0.wp.com/latex.php?latex=a&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a' title='a' class='latex' /> leaves <img src='http://s0.wp.com/latex.php?latex=s.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s.' title='s.' class='latex' /> Now we can formulate the max-flow problem as follows:</p>
<blockquote><p>
<img src='http://s0.wp.com/latex.php?latex=%5Cmax+%5Csum_%7Ba%5Cin+A%7D+w%28a%29f%28a%29%5Cquad%5Ctext%7Bsubject+to%7D%5C%5C+0%5Cleq+f%28a%29%5Cleq+c%28a%29%2C+%5Ctext%7B+for+%7D+a%5Cin+A%2C%5C%5C+f_%2B%28v%29%3Df_-%28v%29%5Ctext%7B+for+%7D+v%5Cin+V%5Csetminus%5C%7Bs%2Ct%5C%7D.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;max &#92;sum_{a&#92;in A} w(a)f(a)&#92;quad&#92;text{subject to}&#92;&#92; 0&#92;leq f(a)&#92;leq c(a), &#92;text{ for } a&#92;in A,&#92;&#92; f_+(v)=f_-(v)&#92;text{ for } v&#92;in V&#92;setminus&#92;{s,t&#92;}.' title='&#92;max &#92;sum_{a&#92;in A} w(a)f(a)&#92;quad&#92;text{subject to}&#92;&#92; 0&#92;leq f(a)&#92;leq c(a), &#92;text{ for } a&#92;in A,&#92;&#92; f_+(v)=f_-(v)&#92;text{ for } v&#92;in V&#92;setminus&#92;{s,t&#92;}.' class='latex' />
</p></blockquote>
<p>Let <img src='http://s0.wp.com/latex.php?latex=M%27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='M&#039;' title='M&#039;' class='latex' /> be the sumbatrix of the incidence matrix <img src='http://s0.wp.com/latex.php?latex=M&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='M' title='M' class='latex' /> of <img src='http://s0.wp.com/latex.php?latex=%5CGamma&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Gamma' title='&#92;Gamma' class='latex' /> obtained by removing the rows with indices <img src='http://s0.wp.com/latex.php?latex=s&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s' title='s' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=t.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='t.' title='t.' class='latex' /> Then the latter can be rewritten as</p>
<blockquote><p>
<img src='http://s0.wp.com/latex.php?latex=%5Cmax+w%5ET+f%5Cmid+0%5Cleq+f%5Cleq+c%2C%5C+M%27f%3D0.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;max w^T f&#92;mid 0&#92;leq f&#92;leq c,&#92; M&#039;f=0.' title='&#92;max w^T f&#92;mid 0&#92;leq f&#92;leq c,&#92; M&#039;f=0.' class='latex' />
</p></blockquote>
<p>The matrix of this LP is totally unimodular. If <img src='http://s0.wp.com/latex.php?latex=c%3AA%5Cto+%5Cmathbb%7BZ%7D_%2B&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='c:A&#92;to &#92;mathbb{Z}_+' title='c:A&#92;to &#92;mathbb{Z}_+' class='latex' /> then we can apply the integrality result directly, and establish along the way that there exists an optimal integral flow. In general, we cannot apply the unimodularity directly. But we can  take the LP dual. It is as follows:</p>
<blockquote><p>
<img src='http://s0.wp.com/latex.php?latex=%5Cmin+y%5ET+c+%5Cmid+y%5Cgeq+0%2C+y%5ET%2Bz%5ET+M%27%5Cgeq+w%5ET.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;min y^T c &#92;mid y&#92;geq 0, y^T+z^T M&#039;&#92;geq w^T.' title='&#92;min y^T c &#92;mid y&#92;geq 0, y^T+z^T M&#039;&#92;geq w^T.' class='latex' />
</p></blockquote>
<p>Here the minimum is attained by <i>integer</i> vectors, as the polytope describing the feasible set is integral. We can extend <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' /> by defining <img src='http://s0.wp.com/latex.php?latex=z_s%3A%3D-1%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z_s:=-1,' title='z_s:=-1,' class='latex' /> <img src='http://s0.wp.com/latex.php?latex=z_t%3A%3D0.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z_t:=0.' title='z_t:=0.' class='latex' /> Then <img src='http://s0.wp.com/latex.php?latex=y%5ET%2Bz%5ET+M%5Cgeq+0.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='y^T+z^T M&#92;geq 0.' title='y^T+z^T M&#92;geq 0.' class='latex' /> The set <img src='http://s0.wp.com/latex.php?latex=U%3A%3D%5C%7Bv%5Cin+V%7C+z_v%5Cgeq+0%5C%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='U:=&#92;{v&#92;in V| z_v&#92;geq 0&#92;}' title='U:=&#92;{v&#92;in V| z_v&#92;geq 0&#92;}' class='latex' />  satisfies <img src='http://s0.wp.com/latex.php?latex=t%5Cin+U%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='t&#92;in U,' title='t&#92;in U,' class='latex' /> <img src='http://s0.wp.com/latex.php?latex=s%5Cnot%5Cin+U.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s&#92;not&#92;in U.' title='s&#92;not&#92;in U.' class='latex' /> So it is a cut. To show the claim of the theorem, it suffices to show that the total capacity of the arcs leaving <img src='http://s0.wp.com/latex.php?latex=U&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='U' title='U' class='latex' /> is bounded from above (the opposite direction is easy) by <img src='http://s0.wp.com/latex.php?latex=y%5ET+c%3D%5Ctext%7Bmaxflow%7D.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='y^T c=&#92;text{maxflow}.' title='y^T c=&#92;text{maxflow}.' class='latex' /> Let <img src='http://s0.wp.com/latex.php?latex=a%3D%28u%2Cv%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a=(u,v)' title='a=(u,v)' class='latex' /> is such an arc. Then <img src='http://s0.wp.com/latex.php?latex=z_u%5Cgeq+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z_u&#92;geq 0' title='z_u&#92;geq 0' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=z_v%5Cleq+-1.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z_v&#92;leq -1.' title='z_v&#92;leq -1.' class='latex' /> Then <img src='http://s0.wp.com/latex.php?latex=y%5ET%2Bz%5ET+M%5Cgeq+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='y^T+z^T M&#92;geq 0' title='y^T+z^T M&#92;geq 0' class='latex' /> implies <img src='http://s0.wp.com/latex.php?latex=v_a%2Bz_u-z_v%5Cgeq+0%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='v_a+z_u-z_v&#92;geq 0,' title='v_a+z_u-z_v&#92;geq 0,' class='latex' /> so <img src='http://s0.wp.com/latex.php?latex=y_a%5Cgeq+1.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='y_a&#92;geq 1.' title='y_a&#92;geq 1.' class='latex' /> Q.E.D.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/equatorialmaths.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/equatorialmaths.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/equatorialmaths.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/equatorialmaths.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/equatorialmaths.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/equatorialmaths.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/equatorialmaths.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/equatorialmaths.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/equatorialmaths.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/equatorialmaths.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/equatorialmaths.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/equatorialmaths.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/equatorialmaths.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/equatorialmaths.wordpress.com/318/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=equatorialmaths.wordpress.com&amp;blog=3331367&amp;post=318&amp;subd=equatorialmaths&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://equatorialmaths.wordpress.com/2009/10/12/total-unimodularity-and-networks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Dima</media:title>
		</media:content>
	</item>
	</channel>
</rss>
