<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Graph Colouring, Part Four</title><link>http://blogs.msdn.com/b/ericlippert/archive/2010/07/26/graph-colouring-part-four.aspx</link><description>Let's give it a try. Can we colour South America with only four colours? Let's start by stating what all the edges are in the graph of South America: 
 
 const int Brazil = 0; const int FrenchGuiana = 1; const int Suriname = 2; const int Guyana = 3;</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Graph Colouring, Part Four</title><link>http://blogs.msdn.com/b/ericlippert/archive/2010/07/26/graph-colouring-part-four.aspx#10043856</link><pubDate>Thu, 29 Jul 2010 15:35:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10043856</guid><dc:creator>Rick C</dc:creator><description>&lt;p&gt;Ha!&lt;/p&gt;
&lt;p&gt;Ok, thanks. &amp;nbsp;Wasn&amp;#39;t trying to cause trouble, just wondering if I had missed something of significance.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10043856" width="1" height="1"&gt;</description></item><item><title>re: Graph Colouring, Part Four</title><link>http://blogs.msdn.com/b/ericlippert/archive/2010/07/26/graph-colouring-part-four.aspx#10043533</link><pubDate>Wed, 28 Jul 2010 18:59:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10043533</guid><dc:creator>Rick C</dc:creator><description>&lt;p&gt;Maybe I missed something but is there any significance to the fact that you draw your graphs such that sometimes you have multiple lines leading out from a single point and sometimes not? &amp;nbsp;Consider Chile which has 3 lines leading out from two points. &amp;nbsp;Does that mean anything?&lt;/p&gt;
&lt;div class="yellowbox"&gt;
&lt;p&gt;It means that I am (1) not very good at using PowerPoint, and (2) too lazy to install Visio. - Eric&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10043533" width="1" height="1"&gt;</description></item><item><title>re: Graph Colouring, Part Four</title><link>http://blogs.msdn.com/b/ericlippert/archive/2010/07/26/graph-colouring-part-four.aspx#10042821</link><pubDate>Tue, 27 Jul 2010 02:36:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10042821</guid><dc:creator>Peter M</dc:creator><description>&lt;p&gt;...and the commenting software ate the leading spaces in my awful ascii diagrams. I should really know better.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10042821" width="1" height="1"&gt;</description></item><item><title>re: Graph Colouring, Part Four</title><link>http://blogs.msdn.com/b/ericlippert/archive/2010/07/26/graph-colouring-part-four.aspx#10042818</link><pubDate>Tue, 27 Jul 2010 02:34:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10042818</guid><dc:creator>Peter M</dc:creator><description>&lt;p&gt;Everyone makes the &amp;quot;map requiring 7 colours&amp;quot; on the torus look so complicated and ugly, but it isn&amp;#39;t really.&lt;/p&gt;
&lt;p&gt;Start with a hexagonal tiling of the plane (pardon what follows...each &amp;quot;*&amp;quot; is a tile but it should really be in a monospaced font):&lt;/p&gt;
&lt;p&gt; * * * * * * *&lt;/p&gt;
&lt;p&gt;* * * * * * * *&lt;/p&gt;
&lt;p&gt; * * * * * * * &lt;/p&gt;
&lt;p&gt;* * * * * * * *&lt;/p&gt;
&lt;p&gt;Now number the tiles in each row from 0 to 6, but stagger each row differently. Each &amp;quot;0&amp;quot; tile in each row should be two and a half tiles to the right of a &amp;quot;0&amp;quot; tile in the row below it:&lt;/p&gt;
&lt;p&gt; 5 6 0 1 2 3 4&lt;/p&gt;
&lt;p&gt;0 1 2 3 4 5 6 0&lt;/p&gt;
&lt;p&gt; 3 4 5 6 0 1 2&lt;/p&gt;
&lt;p&gt;5 6 0 1 2 3 4 5&lt;/p&gt;
&lt;p&gt;Now (this is the part where ascii fails me) draw a parallelogram with vertices in the centre of four tiles marked &amp;quot;0&amp;quot; (such as the four leftmost &amp;quot;0&amp;quot; tiles in the diagram above), and identify opposite edges as before. There&amp;#39;s your map. If you want your torus to be constructed from a square instead of a parallelogram you can apply an affine transformation.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10042818" width="1" height="1"&gt;</description></item><item><title>re: Graph Colouring, Part Four</title><link>http://blogs.msdn.com/b/ericlippert/archive/2010/07/26/graph-colouring-part-four.aspx#10042715</link><pubDate>Mon, 26 Jul 2010 19:34:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10042715</guid><dc:creator>Erik</dc:creator><description>&lt;p&gt;Eric - thanks. I mis-read your original statement - hence the confusion. =)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10042715" width="1" height="1"&gt;</description></item><item><title>re: Graph Colouring, Part Four</title><link>http://blogs.msdn.com/b/ericlippert/archive/2010/07/26/graph-colouring-part-four.aspx#10042664</link><pubDate>Mon, 26 Jul 2010 17:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10042664</guid><dc:creator>RossM</dc:creator><description>&lt;p&gt;If you didn&amp;#39;t want to write the backtracking algorithm yourself, you could also solve this problem using Microsoft Solver Foundation:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;var context = SolverContext.GetContext();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;var model = context.CreateModel();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;var domain = Domain.IntegerRange(1, 4);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Brazil = new Decision(domain, &amp;quot;Brazil&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision FrenchGuinea = new Decision(domain, &amp;quot;FrenchGuinea&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Suriname = new Decision(domain, &amp;quot;Suriname&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Guyana = new Decision(domain, &amp;quot;Guyana&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Venezuela = new Decision(domain, &amp;quot;Venezuela&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Colombia = new Decision(domain, &amp;quot;Colombia&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Ecuador = new Decision(domain, &amp;quot;Ecuador&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Peru = new Decision(domain, &amp;quot;Peru&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Chile = new Decision(domain, &amp;quot;Chile&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Bolivia = new Decision(domain, &amp;quot;Bolivia&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Paraguay = new Decision(domain, &amp;quot;Paraguay&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Uruguay = new Decision(domain, &amp;quot;Uruguay&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Decision Argentina = new Decision(domain, &amp;quot;Argentina&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;model.AddDecisions(Brazil, FrenchGuinea, Suriname, Guyana, Venezuela, Colombia, Ecuador, Peru, Chile, Bolivia, Paraguay, Uruguay, Argentina);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;model.AddConstraints(&amp;quot;neighbors&amp;quot;,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Brazil != FrenchGuinea, Brazil != Suriname, Brazil != Guyana, Brazil != Venezuela, Brazil != Colombia, Brazil != Peru, Brazil != Bolivia,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Brazil != Paraguay, Brazil != Uruguay, Brazil != Argentina, FrenchGuinea != Suriname, Suriname != Guyana, Guyana != Venezuela,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Venezuela != Colombia, Colombia != Ecuador, Ecuador != Peru, Peru != Bolivia, Peru != Chile, Chile != Bolivia, Chile != Argentina,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Bolivia != Paraguay, Bolivia != Argentina, Paraguay != Argentina, Argentina != Uruguay);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;var solution = context.Solve();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.Out.Write(solution.GetReport());&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10042664" width="1" height="1"&gt;</description></item><item><title>re: Graph Colouring, Part Four</title><link>http://blogs.msdn.com/b/ericlippert/archive/2010/07/26/graph-colouring-part-four.aspx#10042653</link><pubDate>Mon, 26 Jul 2010 17:25:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10042653</guid><dc:creator>Erik</dc:creator><description>&lt;p&gt;How could a fully connected subset of size n require more than n colors? That doesn&amp;#39;t seem to make sense.&lt;/p&gt;
&lt;div class="yellowbox"&gt;
&lt;p&gt;I didn&amp;#39;t say that a fully connected subset of size n ever requires more than n colours. I said &amp;quot;if any graph has a fully connected subset of size n then the graph requires at least n colours (and perhaps more)&amp;quot; which is a completely different statement than your statement.&lt;/p&gt;
&lt;p&gt;For example, consider the graph A--B--C--D--E--back to A. That graph has five fully connected subgraphs of size two:&amp;nbsp;{A, B}, {B, C}, {C, D}, {D, E} and {E, A}. It has no fully connected subgraphs of any size larger than two. We therefore know that it requires &lt;strong&gt;at least&lt;/strong&gt; two colours; in fact, it requires &lt;em&gt;three&lt;/em&gt;. Knowing the&amp;nbsp;size of the largest clique only gives us a lower bound; the topology of the rest of the graph is also relevant.&amp;nbsp;- Eric&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10042653" width="1" height="1"&gt;</description></item><item><title>re: Graph Colouring, Part Four</title><link>http://blogs.msdn.com/b/ericlippert/archive/2010/07/26/graph-colouring-part-four.aspx#10042588</link><pubDate>Mon, 26 Jul 2010 15:31:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10042588</guid><dc:creator>nick</dc:creator><description>&lt;p&gt;&amp;quot;Let&amp;#39;s call a subset of a graph where every node in the subset is connected to every other node in the subset a &amp;quot;fully connected subset&amp;quot;&lt;/p&gt;
&lt;p&gt;Is that not just a clique?&lt;/p&gt;
&lt;div class="yellowbox"&gt;
&lt;p&gt;Yes. - Eric&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10042588" width="1" height="1"&gt;</description></item></channel></rss>