<?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>Nav&#039;s Blog</title>
	<atom:link href="http://nexdevelopment.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nexdevelopment.wordpress.com</link>
	<description>Code, Tutorials and Life!</description>
	<lastBuildDate>Sun, 20 Dec 2009 13:45:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='nexdevelopment.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Nav&#039;s Blog</title>
		<link>http://nexdevelopment.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://nexdevelopment.wordpress.com/osd.xml" title="Nav&#039;s Blog" />
	<atom:link rel='hub' href='http://nexdevelopment.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Kruskal&#8217;s Algorithm</title>
		<link>http://nexdevelopment.wordpress.com/2009/12/20/kruskals-algorithm/</link>
		<comments>http://nexdevelopment.wordpress.com/2009/12/20/kruskals-algorithm/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 13:10:32 +0000</pubDate>
		<dc:creator>nexdevelopment</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Kruskal]]></category>
		<category><![CDATA[Kruskal's algorithm programming]]></category>
		<category><![CDATA[Kruskal's algorithm tutorial]]></category>

		<guid isPermaLink="false">http://nexdevelopment.wordpress.com/?p=4</guid>
		<description><![CDATA[Definition Kruskal’s Algorithm Given an undirected, connected and weighted graph with ‘n’ vertices, Kruskal’s algorithm will produce a minimum spanning tree Relevant Definitions Weight – The weight of a graph is the sum of all the edges of that graph Spanning tree – A subset of a graph which connects all the vertices together Minimal [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nexdevelopment.wordpress.com&amp;blog=10934349&amp;post=4&amp;subd=nexdevelopment&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>
<strong>Definition</strong></p>
<table style="height:71px;" border="1" cellspacing="0" cellpadding="0" width="450">
<tbody>
<tr>
<td width="568" valign="top"><strong>Kruskal’s Algorithm</strong></p>
<p><strong><br />
Given an undirected, connected and weighted graph with ‘n’ vertices,   Kruskal’s algorithm will produce a minimum spanning tree</strong></td>
</tr>
</tbody>
</table>
<p><strong> </strong></p>
<p><strong>Relevant Definitions</strong></p>
<ul>
<li>Weight – The weight of a graph is the sum of      all the edges of that graph</li>
<li>Spanning tree – A subset of a graph which      connects all the vertices together</li>
<li>Minimal Spanning Tree – A subset of a graph      which connects all the vertices together and has a weight less than or      equal to any spanning tree</li>
<li>Circuit – A circuit is a path whose first and      last vertices are the same</li>
</ul>
<p><strong>Procedure</strong></p>
<table style="height:155px;" border="1" cellspacing="0" cellpadding="0" width="450">
<tbody>
<tr>
<td width="568" valign="top">
<ol>
<li><strong>Sort        the edges of the graph in increasing order of weight in a table with 3        columns (Edge, Weight, Chosen)</strong></li>
<li><strong>Go        down through the list and add an edge to the spanning tree iff It does        not form a circuit in the minimal spanning tree</strong></li>
<li><strong>Repeat        step 2 until (n-1) edges have been chosen for the spanning tree</strong>
<ul>
<li><strong>A         ‘Y’ denotes a chosen edge</strong></li>
<li><strong>An         ‘N’ denotes a non-chosen edge</strong></li>
</ul>
</li>
</ol>
</td>
</tr>
</tbody>
</table>
<p><strong>Example</strong></p>
<p><strong><a href="http://nexdevelopment.files.wordpress.com/2009/12/originalgraph3.jpg"><img class="aligncenter size-full wp-image-23" title="originalGraph" src="http://nexdevelopment.files.wordpress.com/2009/12/originalgraph3.jpg?w=111&#038;h=141" alt="" width="111" height="141" /></a><br />
</strong></p>
<p><strong>Produce the minimal spanning tree for the following graph</strong></p>
<p><strong>Step 1. Sort the edges into the table</strong></p>
<p><strong> </strong></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="189" valign="top"><strong>Edge</strong></td>
<td width="189" valign="top"><strong>Weight</strong></td>
<td width="189" valign="top"><strong>Chosen</strong><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>CD</strong></td>
<td width="189" valign="top"><strong>1</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>AB</strong></td>
<td width="189" valign="top"><strong>2</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>CE</strong></td>
<td width="189" valign="top"><strong>2</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>DE</strong></td>
<td width="189" valign="top"><strong>3</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>AC</strong></td>
<td width="189" valign="top"><strong>3</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>AD</strong></td>
<td width="189" valign="top"><strong>4</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>BD</strong></td>
<td width="189" valign="top"><strong>5</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>CB</strong></td>
<td width="189" valign="top"><strong>6</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
</tbody>
</table>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>Step 2 and 3</strong></p>
<ul>
<li>By step 3, As we have n = 5 vertices in the      original graph we can stop the process when we have n – 1= 4 chosen edges      (i.e. 4 Y’s in the table)</li>
</ul>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="189" valign="top"><strong>Edge</strong></td>
<td width="189" valign="top"><strong>Weight</strong></td>
<td width="189" valign="top"><strong>Chosen</strong><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>CD</strong></td>
<td width="189" valign="top"><strong>1</strong></td>
<td width="189" valign="top"><strong>Y</strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>AB</strong></td>
<td width="189" valign="top"><strong>2</strong></td>
<td width="189" valign="top"><strong>Y</strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>CE</strong></td>
<td width="189" valign="top"><strong>2</strong></td>
<td width="189" valign="top"><strong>Y</strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>DE</strong></td>
<td width="189" valign="top"><strong>3</strong></td>
<td width="189" valign="top"><strong>N   (Circuit: CDE)</strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>AC</strong></td>
<td width="189" valign="top"><strong>3</strong></td>
<td width="189" valign="top"><strong>Y –   Stop</strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>AD</strong></td>
<td width="189" valign="top"><strong>4</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>BD</strong></td>
<td width="189" valign="top"><strong>5</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
<tr style="text-align:center;">
<td width="189" valign="top"><strong>CB</strong></td>
<td width="189" valign="top"><strong>6</strong></td>
<td width="189" valign="top"><strong> </strong></td>
</tr>
</tbody>
</table>
<p><strong>The following minimal spanning tree is obtained</strong></p>
<p style="text-align:center;"><strong><a href="http://nexdevelopment.files.wordpress.com/2009/12/spanningtreegraph.jpg"><img class="size-full wp-image-6 aligncenter" title="spanningtreeGraph" src="http://nexdevelopment.files.wordpress.com/2009/12/spanningtreegraph.jpg?w=106&#038;h=144" alt="spanningtreeGraph" width="106" height="144" /></a></strong></p>
<pre class="brush: cpp;">
#include &lt;stdio.h&gt;
int main(int argc, char *argv[]) {
    printf(&quot;Hello World!\n&quot;);
    return (0);
}
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nexdevelopment.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nexdevelopment.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nexdevelopment.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nexdevelopment.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nexdevelopment.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nexdevelopment.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nexdevelopment.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nexdevelopment.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nexdevelopment.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nexdevelopment.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nexdevelopment.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nexdevelopment.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nexdevelopment.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nexdevelopment.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nexdevelopment.wordpress.com&amp;blog=10934349&amp;post=4&amp;subd=nexdevelopment&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nexdevelopment.wordpress.com/2009/12/20/kruskals-algorithm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdc28c55f712194ed6ff70a8c0c69393?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Nav</media:title>
		</media:content>

		<media:content url="http://nexdevelopment.files.wordpress.com/2009/12/originalgraph3.jpg" medium="image">
			<media:title type="html">originalGraph</media:title>
		</media:content>

		<media:content url="http://nexdevelopment.files.wordpress.com/2009/12/spanningtreegraph.jpg" medium="image">
			<media:title type="html">spanningtreeGraph</media:title>
		</media:content>
	</item>
	</channel>
</rss>
