Click here to Skip to main content
15,893,668 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dijkstra algorithm Pin
leppie18-Aug-03 7:27
leppie18-Aug-03 7:27 
GeneralRe: Dijkstra algorithm Pin
jphuphilly18-Aug-03 8:02
jphuphilly18-Aug-03 8:02 
GeneralRe: Dijkstra algorithm Pin
leppie18-Aug-03 8:24
leppie18-Aug-03 8:24 
GeneralRe: Dijkstra algorithm Pin
devvvy18-Aug-03 15:12
devvvy18-Aug-03 15:12 
GeneralRe: Dijkstra algorithm Pin
J. Dunlap18-Aug-03 15:20
J. Dunlap18-Aug-03 15:20 
GeneralRe: Dijkstra algorithm Pin
Julian Bucknall [MSFT]18-Aug-03 12:55
Julian Bucknall [MSFT]18-Aug-03 12:55 
GeneralRe: Dijkstra algorithm Pin
jphuphilly19-Aug-03 2:27
jphuphilly19-Aug-03 2:27 
GeneralRe: Dijkstra algorithm Pin
Julian Bucknall [MSFT]19-Aug-03 6:56
Julian Bucknall [MSFT]19-Aug-03 6:56 
So take it step by step.

Dijkstra's algorithm is a "shortest path" algorithm for a network of nodes. So it requires a collection of nodes (doh! Smile | :) ) or vertices connected with edges that have costs associated with them. So think about how that could be represented. A vertex could be a simple class, the edges could be a class containing the from vertex, the to vertex and the cost. Or you might use a sparse matrix of vertices where the edges are defined at the intersection of column and row vertices.

It also requires a container into which you can push all the nodes and that will pop them out in lowest cost order (the cost of a node being the cost of the path to get there from the start node). Think about how you'd write that (it's called a priority queue).

That's pretty much it, just some glue code to run the algorithm and you're away.

So look at any code you find on the web that purports to implement Dijkstra's and try and identify these two parts and understand how the programmer implemented them. Try and find a Java example rather than a C++ example, you'll have a better chance of understanding it.


Cheers, Julian
Program Manager, C#

This posting is provided "AS IS" with no warranties, and confers no rights.
GeneralTyped DataSet Generation Fine-tuning Pin
sirovsky18-Aug-03 1:54
sirovsky18-Aug-03 1:54 
GeneralCtrl-C with error Pin
A.Wegierski17-Aug-03 23:33
A.Wegierski17-Aug-03 23:33 
GeneralRe: Ctrl-C with error Pin
sirovsky18-Aug-03 3:02
sirovsky18-Aug-03 3:02 
GeneralRe: Ctrl-C with error Pin
A.Wegierski19-Aug-03 19:20
A.Wegierski19-Aug-03 19:20 
GeneralRe: Ctrl-C with error Pin
Ista18-Aug-03 5:58
Ista18-Aug-03 5:58 
GeneralWhat's the point of Remoting if you need to "Add Reference" Pin
devvvy17-Aug-03 22:20
devvvy17-Aug-03 22:20 
GeneralRe: What's the point of Remoting if you need to "Add Reference" Pin
James T. Johnson18-Aug-03 3:27
James T. Johnson18-Aug-03 3:27 
GeneralRe: What's the point of Remoting if you need to "Add Reference" Pin
devvvy18-Aug-03 5:20
devvvy18-Aug-03 5:20 
GeneralRe: What's the point of Remoting if you need to "Add Reference" Pin
James T. Johnson18-Aug-03 5:44
James T. Johnson18-Aug-03 5:44 
GeneralRe: What's the point of Remoting if you need to "Add Reference" Pin
devvvy18-Aug-03 6:51
devvvy18-Aug-03 6:51 
GeneralRe: What's the point of Remoting if you need to "Add Reference" Pin
James T. Johnson18-Aug-03 11:27
James T. Johnson18-Aug-03 11:27 
GeneralRe: What's the point of Remoting if you need to "Add Reference" Pin
devvvy18-Aug-03 15:07
devvvy18-Aug-03 15:07 
GeneralRe: What's the point of Remoting if you need to "Add Reference" Pin
James T. Johnson18-Aug-03 15:26
James T. Johnson18-Aug-03 15:26 
GeneralRe: What's the point of Remoting if you need to "Add Reference" Pin
devvvy18-Aug-03 18:05
devvvy18-Aug-03 18:05 
QuestionWhere r the Shape and Line Controls??? Pin
pShay17-Aug-03 21:43
pShay17-Aug-03 21:43 
AnswerRe: Where r the Shape and Line Controls??? Pin
Sascha Andres17-Aug-03 23:27
Sascha Andres17-Aug-03 23:27 
AnswerRe: Where r the Shape and Line Controls??? Pin
Ista18-Aug-03 16:59
Ista18-Aug-03 16:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.