<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://www.bytemycode.com/rssformat.xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>byteMyCode: Snippet Revisions</title>
		<link>http://www.bytemycode.com</link>
		<description>Revisions for this snippet.</description>
		<pubDate>Fri, 29 Aug 2008 15:56:32 +0000</pubDate>
		<copyright>1998-2008 </copyright>
		<language>en-us</language>
		<image>
		      <link>http://www.bytemycode.com</link>
		      <url>http://www.bytemycode.com/img/rss_title.gif</url>
		      <title>byteMyCode</title>
		</image>

	
	<item>
		<title>DIJKSTRA ALGORITHM IN JAVA 1</title>
		<link>http://www.bytemycode.com/snippets/snippet/490/1/</link>
		<comments>http://www.bytemycode.com/snippets/snippet/490/comments/</comments>
		<pubDate>Wed, 25 Oct 2006 09:57:01 +0000</pubDate>
		<dc:creator>fastmike</dc:creator>
		<category>C, File, Java, String</category>
		<guid isPermaLink="false">http://www.bytemycode.com/snippets/snippet/490/</guid>
		<description>
			<![CDATA[
				<p>What is Dijkstra Algorithm? click on the link above and first understand what the algorithm is all about. in short it calculates the shortest path from A to F or vise versa. This code i can guarantee is the simplest and easiest code to understand. just search on google and try to compare this code and other dijkstra code and you will see what i am talking about. i spent alot of time myself and my instructor to guide me on the rite path.<br />http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm(Description)<br />to see how the algorithm really works go on this website it tells you step by step how to update the cost and which path to choose.<br />http://renaud.waldura.com/doc/java/dijkstra/<br />Please give some time to understand the algorithm first and then you can see my code. if you done understand the algorithm it is very useless. i know alot of people need Dijkstra algorithm in java for their HW assignment or Test. i am giving you the solution step by step. anyone who wants to understand please go to the url i have posted above and once you have understand then run the code and for those people who just want to copy so that they can get 90% in their test No Problem Here it is <img src="http://www.bytemycode.com/img/wysiwyg/emo-smile.gif" />.<br />First open a notepad and name that file anything like data.txt or datas.txt and make sure the file looks something like this and in this format. <br />0 3 100 5 100 100 (100 represents infinity)<br />3 0 6 7 7 100<br />100 6 0 5 5 3<br />5 7 5 0 1 100<br />100 7 5 1 0 2<br />100 100 3 100 2 0<br />i name this file as a data.txt file. i have 6 nodes. and A is always the starting node which has the cost of 0 so by looking at the first line i <br />know that A to A have distance 0, A to B is 3, A to c is Infinity, A to D is 5, A to E is Infinity(means no edge connected with A), A to F is Infinity.<br />for second line(B to A is 3, and then vise versa) and for the 3rd line it starts for C and etc..<br />save the txt file by any name and then copy the code which i have posted and then to run type this:<br />javac routing.java<br />java routing data.txt <br />you will get the output. i will say this one more time understand how the algorithm works or ......................</p>
			]]>
		</description>
	</item>

	
	</channel>
</rss>