<?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/"
	>

<channel>
	<title>LAMBDAPHONE &#187; Graph Theory</title>
	<atom:link href="http://coder.bsimmons.name/blog/tag/graph-theory/feed/" rel="self" type="application/rss+xml" />
	<link>http://coder.bsimmons.name/blog</link>
	<description>fragmentary ideas  ䷿  intellectual what-nots  ䷷  and haskell programming  ䷴</description>
	<lastBuildDate>Sun, 29 Jan 2012 17:24:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>17&#215;17: some Simulated Annealing updates</title>
		<link>http://coder.bsimmons.name/blog/2010/07/17x17-some-simulated-annealing-updates/</link>
		<comments>http://coder.bsimmons.name/blog/2010/07/17x17-some-simulated-annealing-updates/#comments</comments>
		<pubDate>Sun, 01 Aug 2010 02:46:06 +0000</pubDate>
		<dc:creator>jberryman</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[17x17]]></category>
		<category><![CDATA[Graph Theory]]></category>
		<category><![CDATA[heuristics]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[theory]]></category>

		<guid isPermaLink="false">http://coder.bsimmons.name/blog/?p=459</guid>
		<description><![CDATA[<blockquote><p><em>Note: this is part of a <a href="http://coder.bsimmons.name/blog/tag/17x17/">series of posts</a> is related to the &#8220;<a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">17&#215;17 Challenge</a>&#8221; posted by Bill Gasarch. The goal is to color cells of a 17 by 17 grid, using only four colors, such that no</em></p></blockquote><p>&#8230; <a href="http://coder.bsimmons.name/blog/2010/07/17x17-some-simulated-annealing-updates/" class="read_more">   [ R E A D &#124; M O R E ]</a></p>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em>Note: this is part of a <a href="http://coder.bsimmons.name/blog/tag/17x17/">series of posts</a> is related to the &#8220;<a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">17&#215;17 Challenge</a>&#8221; posted by Bill Gasarch. The goal is to color cells of a 17 by 17 grid, using only four colors, such that no rectangle is formed from four cells of the same color.</em></p></blockquote>
<p>Just a few follow-ups to my previous <a href="http://coder.bsimmons.name/blog/2010/07/17x17-a-simulated-annealing-approach-using-thresholds/">post in which I use a simulated annealing-type algorithm</a> to find a good (hopefully complete) cover of a grid by swapping rows and columns from four identical sub-grids of 74 colors.</p>
<h2>Easing into new thresholds</h2>
<p>I modified my algorithm so that the likelihood of jumping into the highest permitted energy level is decreased over time; thus instead of having an abrupt transition to a new threshold, resulting in a steep dive, we instead <em>ease into</em> the new energy level. </p>
<p>Here is a graph of a run with the adjusted meta-heuristic (in blue) alongside a previous abrupt threshold transition run (in black). You can check compare it to the <a href="http://coder.bsimmons.name/blog/wp-content/uploads/5-2.combined-annotated.png">graph from the previous post</a>:</p>
<p><a href="http://coder.bsimmons.name/blog/wp-content/uploads/output.10000.5.smooth_vs_jagged.png"><img src="http://coder.bsimmons.name/blog/wp-content/uploads/output.10000.5.smooth_vs_jagged-300x81.png" alt="a more smooth graph vs. a graph with abrupt changes at each threshold change" title="output.10000.5.smooth_vs_jagged" width="300" height="81" class="aligncenter size-medium wp-image-460" /></a></p>
<p><span id="more-459"></span></p>
<p>Unfortunately this change didn&#8217;t cause any improvement in the solutions generated. They still seem to flatten at a grid with 19 &#8211; 22 uncolored cells.</p>
<h2>Testing a combination of sub-grids with known good solution</h2>
<p>I wondered if the lower bound I was smacking into was caused by the fact that I was trying to find a combination of four permutations <em>of the same subset</em>, and perhaps this particular subset didn&#8217;t mesh all that well with itself.</p>
<p>In the original blog posting laying out this challenge there is four-coloring of 17&#215;17 with only one cell left un-colorable in a truly painful refactoring process, I modified my script to take four separate and distinct sub-grids and perform the same shuffling procedure.</p>
<p>Rather than find the original arrangement of the colored subsets or one nearly as good, the program settles on a solution with around 30 uncolored cells. That is worse than my original version, corresponding to the fact that there are fewer cells to work with in this latter set of colored subsets: 288 vs. 296.</p>
<h2>Conclusion</h2>
<p>This doesn&#8217;t say anything about whether a full-cover can likely be obtained by permuting four overlapping copies of a single subset of colors. It does tell us that either my code is flawed, this isn&#8217;t a particularly effective method for this kind of search, or it needs to be tuned better.</p>
]]></content:encoded>
			<wfw:commentRss>http://coder.bsimmons.name/blog/2010/07/17x17-some-simulated-annealing-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>17&#215;17: Further Thoughts &amp; Some Pretty Pictures</title>
		<link>http://coder.bsimmons.name/blog/2010/06/17x17-further-thoughts-some-pretty-pictures/</link>
		<comments>http://coder.bsimmons.name/blog/2010/06/17x17-further-thoughts-some-pretty-pictures/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 20:35:06 +0000</pubDate>
		<dc:creator>jberryman</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[17x17]]></category>
		<category><![CDATA[Graph Theory]]></category>

		<guid isPermaLink="false">http://coder.bsimmons.name/blog/?p=421</guid>
		<description><![CDATA[<blockquote><p><em>Note: this is part of a <a href="http://coder.bsimmons.name/blog/tag/17x17/">series of posts</a> is related to the &#8220;<a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">17&#215;17 Challenge</a>&#8221; posted by Bill Gasarch. The goal is to color cells of a 17 by 17 grid, using only four colors, such that no</em></p></blockquote><p>&#8230; <a href="http://coder.bsimmons.name/blog/2010/06/17x17-further-thoughts-some-pretty-pictures/" class="read_more">   [ R E A D &#124; M O R E ]</a></p>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em>Note: this is part of a <a href="http://coder.bsimmons.name/blog/tag/17x17/">series of posts</a> is related to the &#8220;<a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">17&#215;17 Challenge</a>&#8221; posted by Bill Gasarch. The goal is to color cells of a 17 by 17 grid, using only four colors, such that no rectangle is formed from four cells of the same color.</em></p></blockquote>
<p>An almost silly amount of time passes between my new ideas on this problem and investigating/coding those ideas, but I&#8217;m trying to be better about helping my thoughts see the light of day before I get entirely bored of them. </p>
<p>So in that spirit, here are a few more thoughts on the 17&#215;17 Problem investigated.</p>
<h3>Will Graph Layout Algorithms show Symmetry?</h3>
<p><a href="http://en.wikipedia.org/wiki/Force-based_algorithms_%28graph_drawing%29">Force-based algorithms</a> tend to be good at creating symmetrical layouts of graphs. The idea is to translate a Graph into a system of springs (edges) and charged particles (nodes). You then run a simulation of this 2-dimensional sytem and the graph eventually should work itself out into some equilibrium state. </p>
<p>At that point hopefully you get a layout which is more clear and perhaps makes clear some important relationships of the Graph.</p>
<p>I used the <a href="http://www.graphviz.org/">graphviz software suite</a> to do the force-directed layouts and wrote some ugly code to coax some rectangle-free single-colorings into the graphviz file format. I hoped that some of the <a href="http://coder.bsimmons.name/blog/2010/03/17x17-some-thoughts-on-the-problem/">single-</a> and <a href="http://coder.bsimmons.name/blog/2010/04/17x17-some-attempts-at-doubly-symmetrical-rotations/">double-symmetrical</a> relationships that I noticed would emerge in the process.</p>
<p><span id="more-421"></span></p>
<p>This worked perfectly for a small 5&#215;5 cell single-coloring:</p>
<p><a href="http://coder.bsimmons.name/blog/wp-content/uploads/5x5.graph.png"><img src="http://coder.bsimmons.name/blog/wp-content/uploads/5x5.graph-231x300.png" alt="A graph showing symmetry of a 5x5 grid" title="5x5.graph" width="231" height="300" class="aligncenter size-medium wp-image-424" /></a></p>
<p>Since what we&#8217;re really looking for are symmetrical relationships between <em>rows and columns</em> rather than between cells, I&#8217;ve expressed the graph above as colored cell nodes connected to nodes representing the row and the column in which the cell resides.</p>
<p>I realized I could tighten up the graph by getting rid of the nodes for the cells themselves and just showing Column nodes connecting to Row nodes, where an edge exists between the two when a colored cell lies on their intersection. (note: the rows and columns here don&#8217;t correspond to the ones above):</p>
<p><a href="http://coder.bsimmons.name/blog/wp-content/uploads/5x5.csv_.graph.png"><img src="http://coder.bsimmons.name/blog/wp-content/uploads/5x5.csv_.graph-300x245.png" alt="A tighter graph of the same" title="5x5.csv.graph" width="300" height="245" class="aligncenter size-medium wp-image-425" /></a></p>
<p>Unfortunately this wasn&#8217;t effective for the 17&#215;17 single-coloring:</p>
<p><a href="http://coder.bsimmons.name/blog/wp-content/uploads/17x17-small1.png"><img src="http://coder.bsimmons.name/blog/wp-content/uploads/17x17-small1-290x300.png" alt="A messy graph with 74 nodes" title="17x17-small" width="290" height="300" class="aligncenter size-medium wp-image-428" /></a></p>
<p>I suppose there were too many nodes and the symmetrical relationships are too tenuous to emerge. That said, I&#8217;m no graphviz expert so it&#8217;s quite possible that this could work with the right black magic.</p>
<h3>Investigating Weights of Colored and &#8220;Toxic&#8221; Cells</h3>
<blockquote><p>Note: I&#8217;ve started calling cells which have been made un-colorable (because they would form a rectangle of that color) <strong>&#8220;toxic&#8221;</strong>; so that&#8217;s how I&#8217;ll refer to them here.</p></blockquote>
<p>I wanted to investigate the relationships between colored cells and the cells that they make toxic (and vice versa), so I coded up a Haskell script that parsed a CSV format grid and did the following:</p>
<ol>
<li>For each colored cell, show the toxic cells that it has a part in making toxic</li>
<li>For each toxic cell, list all the triplets of colored cells that each make this cell toxic</li>
</ol>
<p>What I was primarily looking for were some insights that could lead to an heuristic to guide some kind of ladder-climbing search algorithm. For example if all the colored cells </p>
<p>The first point wasn&#8217;t particularly interesting to me: in the 17&#215;17 grid of 74 colored, each colored cell helped toxify between 31 and 40 un-colorable cells, which corresponded with the number of row/column neighbors that a colored cell had.</p>
<p>What was more interesting was when I looked at the graph from the perspective of the toxic (blank) cells. </p>
<p>Each toxic cell had 3, 4 or 5 unique triplets of colored cells making it toxic. Here you can see a kind of heatmap with the toxic cells in shades of gray, corresponding to how many different 3-groups of colored cells help make this toxic:</p>
<p><iframe width='500' height='500' frameborder='0' src='http://spreadsheets.google.com/pub?key=0AifWmvDBLwGodFdwVHVPNDI1WC1LbzNpQXd0VDlpLWc&#038;hl=en&#038;output=html&#038;widget=true'></iframe></p>
<h3>An Obvious Property of Toxic Cells</h3>
<p>Looking at toxic cells helped me realize an interesting property of those cells: </p>
<blockquote><p>
There is a one-to-one correspondence between a toxic cell&#8217;s row neighbors and its column neighbors in rendering the cell in question toxic.
</p></blockquote>
<p>That is for a toxic cell <em>T</em> a colored cell in <em>T</em>&#8216;s column will team up with at most a single colored cell from <em>T</em>&#8216;s row (and vice versa) in toxifying our cell. If this weren&#8217;t the case, it would imply a rectangle on our grid (you can work it out on paper if you like).</p>
<p>To go further, this means that if <em>T</em> contains a colored cell in its row and its column, <em>both of which</em> don&#8217;t contribute to making <em>T</em> toxic, then <em>T</em> is essentially not doing it&#8217;s job as well as it can. That is we might be able to add a new colored cell to form a triplet with those two colored cells, adding a new colored cell to our graph and making <em>T</em> a more effective &#8220;rectangle sink&#8221;. </p>
<p>Here&#8217;s an illustration of two different toxic cells and their respective (and partially overlapping) sets of toxifying triplets. The second tab shows how we might &#8220;improve&#8221; one of the toxic cells:</p>
<p><iframe width='500' height='500' frameborder='0' src='http://spreadsheets.google.com/pub?key=0AifWmvDBLwGodG5xNUtOajVnb3EwUlJqOXFnS005ZEE&#038;output=html&#038;widget=true'></iframe></p>
<p>Of course adding a colored cell to form a triplet with the two cells in <em>T</em>&#8216;s row, but not affecting <em>T</em> would very likely cause other currently colored cells to become toxic in the process.</p>
<h3>Conclusion</h3>
<p>I&#8217;m going to try code up an algorithm that attempts to produce an optimal single-coloring by trying to make toxic cells as effective as possible, e.g. by looking at where we can add a single colored cell and bridge several ineffective pairs at one time. I&#8217;ll also look at some other more conventional search strategies.</p>
<p>My next and hopefully last post on this junk should be of shorter and of more general compsci interest.</p>
]]></content:encoded>
			<wfw:commentRss>http://coder.bsimmons.name/blog/2010/06/17x17-further-thoughts-some-pretty-pictures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>17&#215;17: Some Attempts at Doubly-Symmetrical Rotations</title>
		<link>http://coder.bsimmons.name/blog/2010/04/17x17-some-attempts-at-doubly-symmetrical-rotations/</link>
		<comments>http://coder.bsimmons.name/blog/2010/04/17x17-some-attempts-at-doubly-symmetrical-rotations/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 00:58:23 +0000</pubDate>
		<dc:creator>jberryman</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[17x17]]></category>
		<category><![CDATA[giving up]]></category>
		<category><![CDATA[Graph Theory]]></category>

		<guid isPermaLink="false">http://coder.bsimmons.name/blog/?p=400</guid>
		<description><![CDATA[<blockquote><p><em>Note: this is part of a <a href="http://coder.bsimmons.name/blog/tag/17x17/">series of posts</a> is related to the &#8220;<a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">17&#215;17 Challenge</a>&#8221; posted by Bill Gasarch. The goal is to color cells of a 17 by 17 grid, using only four colors, such that no</em></p></blockquote><p>&#8230; <a href="http://coder.bsimmons.name/blog/2010/04/17x17-some-attempts-at-doubly-symmetrical-rotations/" class="read_more">   [ R E A D &#124; M O R E ]</a></p>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em>Note: this is part of a <a href="http://coder.bsimmons.name/blog/tag/17x17/">series of posts</a> is related to the &#8220;<a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">17&#215;17 Challenge</a>&#8221; posted by Bill Gasarch. The goal is to color cells of a 17 by 17 grid, using only four colors, such that no rectangle is formed from four cells of the same color.</em></p></blockquote>
<p>In a <a href="http://coder.bsimmons.name/blog/2010/03/17x17-symmetric-single-colorings-and-some-graph-theory/">previous post</a> I presented rotations of some single-color rectangle-free grids which were symmetrical along a diagonal axis. I also noticed that, of the single-colorings of optimal size which I could generate, all with an odd number side-length could be made symmetrical along <em>both</em> diagonals (the evens could not):</p>
<blockquote><p>
<iframe width='400' height='400' frameborder='0' src='http://spreadsheets.google.com/pub?key=tZ-BHhZDGdOR5g1-dbBTr0w&#038;output=html&#038;widget=true'></iframe></p></blockquote>
<p>Perhaps <em>all</em> odd-sided optimal single-colorings are doubly-symmetrical in one of their rotations! That would be a cool thing to learn, and it would also mean that if we wanted to generate an optimal coloring, then our search space would be roughly 1/4 of the grid.</p>
<p><span id="more-400"></span></p>
<p>So I thought I would see if I could rotate the known 74-color grid into a doubly-symmetrical arrangement&#8230; and I have to admit defeat.:</p>
<blockquote><p>
<iframe width='400' height='400' frameborder='0' src='http://spreadsheets.google.com/pub?key=t8iZEIZLeWWsxiRabkJvIDQ&#038;single=true&#038;gid=7&#038;output=html&#038;widget=true'></iframe></p></blockquote>
<p>The orange squares mark discrepancies I couldn&#8217;t resolve. It could be that it is true that all optimal (having the greatest number of colored cells possible for the grid size) single colorings <em>can</em> be made doubly symmetrical and that the 74 colors in 17&#215;17 grid is less than optimal. It could also mean I suck at moving rows and columns around in google spreadsheet. Either way, I&#8217;m done with this line of investigation for now.</p>
<p>Next I would like to jump into actually trying to generate 4-colorings of 17&#215;17, using some informed search algorithms and ladder climbing techniques. </p>
]]></content:encoded>
			<wfw:commentRss>http://coder.bsimmons.name/blog/2010/04/17x17-some-attempts-at-doubly-symmetrical-rotations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>17&#215;17: Symmetric Single-Colorings and some Graph Theory</title>
		<link>http://coder.bsimmons.name/blog/2010/03/17x17-symmetric-single-colorings-and-some-graph-theory/</link>
		<comments>http://coder.bsimmons.name/blog/2010/03/17x17-symmetric-single-colorings-and-some-graph-theory/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 17:44:07 +0000</pubDate>
		<dc:creator>jberryman</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[17x17]]></category>
		<category><![CDATA[Graph Theory]]></category>
		<category><![CDATA[short]]></category>

		<guid isPermaLink="false">http://coder.bsimmons.name/blog/?p=355</guid>
		<description><![CDATA[<blockquote><p><em>Note: this is part of a <a href="http://coder.bsimmons.name/blog/tag/17x17/">series of posts</a> is related to the &#8220;<a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">17&#215;17 Challenge</a>&#8221; posted by Bill Gasarch. The goal is to color cells of a 17 by 17 grid, using only four colors, such that no</em></p></blockquote><p>&#8230; <a href="http://coder.bsimmons.name/blog/2010/03/17x17-symmetric-single-colorings-and-some-graph-theory/" class="read_more">   [ R E A D &#124; M O R E ]</a></p>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em>Note: this is part of a <a href="http://coder.bsimmons.name/blog/tag/17x17/">series of posts</a> is related to the &#8220;<a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">17&#215;17 Challenge</a>&#8221; posted by Bill Gasarch. The goal is to color cells of a 17 by 17 grid, using only four colors, such that no rectangle is formed from four cells of the same color.</em></p></blockquote>
<p>In my <a href="http://coder.bsimmons.name/blog/2010/03/17x17-some-thoughts-on-the-problem/">last post</a> I noticed that all of the smaller optimal single-colorings I generated showed diagonal symmetry, meaning that row 1 is the same as column 1, row 8 is the same as column 8, etc. It&#8217;s my hypothesis that all complete single-colorings are symmetrical in this way. </p>
<p>I decided to play with making the known 74-cell subset symmetrical by applying rotations and came up with this:</p>
<blockquote><p><iframe width='425' height='400' frameborder='0' src='http://spreadsheets.google.com/pub?key=t-3KjM7Nt7-9AmYg9uCi5Xg&#038;single=true&#038;gid=0&#038;output=html&#038;widget=true'></iframe></p></blockquote>
<p><span id="more-355"></span></p>
<p>Figuring out an <a href="http://en.wikipedia.org/wiki/Graph_automorphism">automorphism</a> that would give me that diagonal symmetry was easier than inputting the original points into Google Spreadsheet. The colors show the hints that helped anchor the rotations. (I&#8217;m going to try to come up with an algorithm for permuting a grid into a symmetrical form).</p>
<p>It seems that symmetry is a very interesting quality in a <a href="http://en.wikipedia.org/wiki/Graph_%28mathematics%29">graph</a>, but when the Graph Theorists study <a href="http://en.wikipedia.org/wiki/Symmetric_graph">symmetric graphs</a>, they are looking at graphs with where (as I understand it)</p>
<blockquote><p>
any two linked vertices can be mapped onto any to other linked vertices, resulting in essentially the same graph</p></blockquote>
<p>&#8230;which is much cooler. Another interesting thing to mention is that a valid coloring is essentially a <a href="http://en.wikipedia.org/wiki/Hypergraph">hypergraph</a> where the higher dimensional edges are the row/column relationship. It can be flattened into a graph in any number of ways, for example by connecting every colored cell with it&#8217;s four neighbors (possibly itself).</p>
<p>So up next for me is a brute force algorithm for single-colorings generated symmetrically. </p>
]]></content:encoded>
			<wfw:commentRss>http://coder.bsimmons.name/blog/2010/03/17x17-symmetric-single-colorings-and-some-graph-theory/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk
Database Caching 6/15 queries in 14.539 seconds using disk

Served from: coder.bsimmons.name @ 2012-02-05 12:24:11 -->
