Click here to Skip to main content
14,635,895 members
Rate this:
Please Sign up or sign in to vote.
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
Rate this:
Please Sign up or sign in to vote.

Solution 1

shiny1366 wrote:
which algorithm will be best for finding shortest path between 2 cities?
Dijkstra or Floyd-WarshallT
Google[^].
   
Comments
thatraja 15-Jul-11 23:22pm
   
5!
Rate this:
Please Sign up or sign in to vote.

Solution 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
   
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.
Rate this:
Please Sign up or sign in to vote.

Solution 4

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.
   
Comments
thatraja 15-Jul-11 23:22pm
   
5!
Rate this:
Please Sign up or sign in to vote.

Solution 2

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.
   
Comments
thatraja 15-Jul-11 23:21pm
   
Counter 5!
Rate this:
Please Sign up or sign in to vote.

Solution 3

   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100