Dijkstra Algorithm

A

arlef

Can somebody please explain and provide pseudocode for the Dijkstra
algorithm?

I'm trying to implement the Dijkstra shortest path algorithm. However, I'm
finding it extremely difficult to understand.

I've a node class that hold the node name, and the x,y coordinate.
I've an edge class the takes two(2) nodes, from and to, and a name for the
edge.
I'm using only simple arrays to store the nodes and the edges, no priority
queues.

I've also read the pseudocode on:
http://en.wikipedia.org/wiki/Dijkstra's_algorithm
but find it too mathematical.

Can somebody please provide me with pseudocode and comments/exlanation that
uses simple arrays and programming contructs?

Many thanks

James
 
M

Marc Gravell

How about googling +Dijkstra +c# +"shortest path" - yields a good hit:

http://cs.nerdbank.net/blogs/jmpinline/archive/2006/01/27/127.aspx?Ajax_CallBack=true
(I cannot vouch for the quality of code / math)

However; graph theory is by definition quite math orientated; if you don't
understand the math, I would advise sticking to pre-written code - otherwise
you will struggle to maintain it. Or - go to the library and get a book on
graph theory; some books make it quite easy to follow with visualisations
etc - note that "quite easy" in this context is subjective.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top