14,635,895 members
Rate this:
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:

## Solution 1

shiny1366 wrote:
which algorithm will be best for finding shortest path between 2 cities?
Dijkstra or Floyd-WarshallT
thatraja 15-Jul-11 23:22pm

5!
Rate this:

## 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
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:

## 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

thatraja 15-Jul-11 23:22pm

5!
Rate this:

## 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.
thatraja 15-Jul-11 23:21pm

Counter 5!
Rate this:

## Solution 3

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)

Top Experts
Last 24hrsThis month
 Sandeep Mewara 140 Patrice T 140 Jon McKee 115 Richard MacCutchan 105 OriginalGriff 75
 OriginalGriff 4,230 Sandeep Mewara 2,537 CPallini 1,378 Richard Deeming 1,245 Richard MacCutchan 1,139

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100