Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi If we have a graph of cities in a country,which algorithm will be best for finding shortest path between 2 cities?
Dijkstra or Floyd-Warshall
Posted

shiny1366 wrote:
which algorithm will be best for finding shortest path between 2 cities?
Dijkstra or Floyd-WarshallT
Google[^].
 
Share this answer
 
Comments
thatraja 15-Jul-11 23:22pm    
5!
I think you also should take a look at A*[^]

Fast A-Star (2D) Implementation for C#[^]

[Update]
It appears that someone was less than happy with my suggestion, perhaps a look at the following article would serve to clarify things a bit:
WPF: A* search[^]

Best regards
Espen Harlinn
 
Share this answer
 
v3
Comments
thatraja 15-Jul-11 23:22pm    
Good one, 5!
Espen Harlinn 16-Jul-11 4:39am    
Thank you, thatraja!
Sergey Alexandrovich Kryukov 15-Jul-11 23:28pm    
Agree, a 5.
--SA
Espen Harlinn 16-Jul-11 4:39am    
Thank you, Sergey!
shiny1366 21-Jul-11 4:03am    
thanks.
Basically Dijkstra gives shortest path of a node in a directed graph

and Floyd Warshall gives all nodes shortest path know you can choose as

per your requirement.
 
Share this answer
 
Comments
thatraja 15-Jul-11 23:22pm    
5!
Why not try coding it for yourself? This would be great fun, and a great learning exercise where you can form your own conclusions rather than accepting the findings of some third party. Along the way, you get to show your coding chops, and you have the satisfaction of knowing that the knowledge you have gained along the way is all your own work.

Good luck.
 
Share this answer
 
Comments
thatraja 15-Jul-11 23:21pm    
Counter 5!
 
Share this answer
 
Comments
thatraja 15-Jul-11 23:21pm    
Looks like OP couldn't get it.
Counter 5!
Sergey Alexandrovich Kryukov 15-Jul-11 23:28pm    
I don't know what's wrong.
Thank you Raja.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900