tag:blogger.com,1999:blog-7394321342583943115.post6672795366621563644..comments2023-07-19T23:10:12.122-07:00Comments on Geek: Single Source Shortest Path : Dijkstra's AlgorithmVikashhttp://www.blogger.com/profile/11059616688071310835noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-7394321342583943115.post-25967414429687016112013-12-10T03:09:22.416-08:002013-12-10T03:09:22.416-08:00@Jenny Perhaps your vertices indicate cartesian co...@Jenny Perhaps your vertices indicate cartesian coordinate system and d represent the distance between two vertices. Let me know if I'm right. <br />Although I have not written this blog to print path but You can solve this as follows...<br /><br />--> Transform all your vertices in simple form by giving them name like A, B, C etc.<br />--> Make appropriate representation of graph viz. adjacency list or matrix. You will need two matrix, one containing distance between vertices and other containing name of vertices.<br />--> Apply shortest path algorithm and update the second matrix at appropriate place e.g. at 100th line of code in above program.<br />Vikashhttps://www.blogger.com/profile/11059616688071310835noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-47966036557037679652013-12-06T07:50:13.855-08:002013-12-06T07:50:13.855-08:00hello. i saw your writing and was very impressed....hello. i saw your writing and was very impressed.<br />i have a little request about coding.<br /><br />let me introduce myself first.<br />i'm a student learning datastructure and algorithm.<br />i have little curiosity that how can i code dijkstra more useful.<br /><br />Your code was greatly operated. <br />if it won't be bother you, can you tell me how to code or show me coding example <br />about 'finding the shortest path from the single source to all the other vertices in G(V,E)<br /><br />here are some condition we must satisfy.<br /><br />1. V has 100 vertices<br />(x, x^2 mod 100) where x=1,2, ...,100<br />e.g. (1.1), (2,4), (3,9), ...(30,0), ...<br /><br /><br />2. E is defined as<br />if d<= 13 between v and w, then edge(v,w) exists<br />if d> 13 between v and w, then edge(v,w) does not exists<br /><br />3. the start poin(single source) is (1,1)<br /><br /><br />this is all that i want to add to your code.<br />Again, i'm very impressed with your coding.<br />that's why i ask help even thogh my request seems like rude.<br />please help me if you could. and it would be nice let me know until Dec. 14.<br />Thank you so much !<br />Anonymoushttps://www.blogger.com/profile/10040114983008926693noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-65597779587598651062013-11-12T18:49:40.889-08:002013-11-12T18:49:40.889-08:00@Dimofte Here I have printed only distance of shor...@Dimofte Here I have printed only distance of shortest path and u can modify this algorithm to print the shortest path. I have not stored vertices here to print the shortest path as the problem statement was to print the shortest distance. Vikashhttps://www.blogger.com/profile/11059616688071310835noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-69383143457401378432013-11-12T12:35:51.362-08:002013-11-12T12:35:51.362-08:00Hi, this exemple print the path (vertices visited)...Hi, this exemple print the path (vertices visited) of the shortest road too ? If yes, where are you storing the vertices to print them later. I'm having problem with understanding how to print/compute the path. Thanks.Anonymoushttps://www.blogger.com/profile/14165950621297389500noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-30094138274829630112013-11-11T20:40:04.154-08:002013-11-11T20:40:04.154-08:00@sureddy Either you have not downloaded the text f...@sureddy Either you have not downloaded the text file or kept in.txt file in the same directory where your source file resides. Vikashhttps://www.blogger.com/profile/11059616688071310835noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-67627993593001814492013-11-11T20:37:07.141-08:002013-11-11T20:37:07.141-08:00@prakash click on the red colored "here"...@prakash click on the red colored "here" above to download the text file.Vikashhttps://www.blogger.com/profile/11059616688071310835noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-15867086614817573522013-11-07T21:51:56.928-08:002013-11-07T21:51:56.928-08:00Z:\3rd year\ADS>javac Dijkstra.java
Z:\3rd yea...Z:\3rd year\ADS>javac Dijkstra.java<br /><br />Z:\3rd year\ADS>java Dijkstra<br />Exception in thread "main" java.io.FileNotFoundException: .\in.txt (The system c<br />annot find the file specified)<br /> at java.io.FileInputStream.open(Native Method)<br /> at java.io.FileInputStream.(FileInputStream.java:138)<br /> at java.util.Scanner.(Scanner.java:656)<br /> at Dijkstra.main(Dijkstra.java:15)<br /><br />Z:\3rd year\ADS>Anonymoushttps://www.blogger.com/profile/05753745210208085681noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-47551355581236178692013-11-05T04:51:38.274-08:002013-11-05T04:51:38.274-08:00where is the text filewhere is the text filePrakashl1991https://www.blogger.com/profile/12435314817529455131noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-60640903768188313742013-09-23T23:02:23.377-07:002013-09-23T23:02:23.377-07:00@Rupavathy There was tab error in input file. I h...@Rupavathy There was tab error in input file. I have rectified<br />the input file. Now there is no problem... :)Vikashhttps://www.blogger.com/profile/11059616688071310835noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-30423389134777732502013-09-22T08:56:58.421-07:002013-09-22T08:56:58.421-07:00java Dijkstra
Exception in thread "main"...java Dijkstra<br />Exception in thread "main" java.lang.NumberFormatException: For input string: "1<br /> 80,982"<br /> at java.lang.NumberFormatException.forInputString(NumberFormatException.<br />java:48)<br /> at java.lang.Integer.parseInt(Integer.java:458)<br /> at java.lang.Integer.parseInt(Integer.java:499)<br /> at Dijkstra.main(Dijkstra.java:25)<br /><br />Help me to clear this errorAnonymoushttps://www.blogger.com/profile/13761813077497754792noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-6711647626959581682013-08-10T12:20:48.750-07:002013-08-10T12:20:48.750-07:00What exactly you want to store... ?What exactly you want to store... ?Vikashhttps://www.blogger.com/profile/11059616688071310835noreply@blogger.comtag:blogger.com,1999:blog-7394321342583943115.post-69301626116305306252013-08-10T07:41:14.606-07:002013-08-10T07:41:14.606-07:00I'm impressed about the description of the alg...I'm impressed about the description of the algorithm.<br />the animated gif helps to get an idea of working - very nice.<br />--<br />graphs are very useful today. I'm just starting on working with them. <br />Do you have a good technique to store them persistent (in a database)?<br />Anonymoushttps://www.blogger.com/profile/00372095175165856425noreply@blogger.com