Programming, website development forum Get latest updates by RSS Follow TechnicalTalk on Twitter Follow TechnicalTalk on Facebook 
HomeSearchRecent PostsLoginRegisterContact Us

Username  
Password    
  Forgot your password?  

Pages: [1]   Go Down
 
  Email this topic  |  Print
0 Members and 1 Guest are viewing this topic.

Coding a Program for Dijkstra's Algorithm

 
webmaster forum
KateAnne  Offline
Activity
0%
 
New Poster
Posts: 1
Topics: 1
February 21, 2009, 07:19:12 PM

Alright so I'm a student taking a computer math course at my school, and we're being taught with VB. We have a group project that we will work on throughout the course and it's due at the end of the semester. My group is trying to write a program that will help calculate shorter distances between a set of locations to help the Meals On Wheels Association, and we're trying to use Dijkstra's algorithm to achieve this.

I'd like to know if anyone out there has ever attempted to do something like this before, be it with VB or some other language, and if so, if you could give me some advice on how to go about coding the program? Any opinions or advice would be greatly helpful to me. I know that VB might not be the best language for this sort of thing but my instructor assures me that it is in fact possible with the knowledge we'll gain throughout the course.

If anyone has any experience or knowledge of coding with the algorithm, or has an idea of how difficult this will be with VB or any tips they can share, I'd be much obliged.
 
webmaster forum
polas  Offline
Activity
33.33%
 
Code Guru
Gender: Male
Posts: 1399
Topics: 85
WWW
February 27, 2009, 02:32:20 AM

Yes, this algorithm is often used in routing. 6 or 7 years ago I had to implement it in Java for a networking course.... been a while though Wink

For a given node in a graph the algorithm will find the shorted path between that one and every other node. I had a quick google search you and found this link which will probably help http://www.codeproject.com/KB/recipes/GcDijkstra.aspx - it is an example already coded in VB, which you can look at and figure out.

Also the pseudo code below described the algorithm quite well

Code:
1  function Dijkstra(Graph, source):
 2      for each vertex v in Graph:           // Initializations
 3          dist[v] := infinity               // Unknown distance function from source to v
 4          previous[v] := undefined          // Previous node in optimal path from source
 5      dist[source] := 0                     // Distance from source to source
 6      Q := the set of all nodes in Graph    // All nodes in the graph are unoptimized - thus are in Q
 7      while Q is not empty:                 // The main loop
 8          u := vertex in Q with smallest dist[]
 9          remove u from Q
10          for each neighbor v of u:         // where v has not yet been removed from Q.
11              alt := dist[u] + dist_between(u, v)       // be careful in 1st step - dist[u] is infinity yet
12              if alt < dist[v]              // Relax (u,v,a)
13                  dist[v] := alt
14                  previous[v] := u
15      return previous[]

Give us a shout if you have any questions

Mesham Type Oriented Parallel Programming Language, Free online technical support
 
webmaster forum
polas  Offline
Activity
33.33%
 
Code Guru
Gender: Male
Posts: 1399
Topics: 85
WWW
March 04, 2009, 03:12:43 AM

How are you getting along with this, any luck?

Mesham Type Oriented Parallel Programming Language, Free online technical support
 
webmaster forum
Activity
0%
 
New Poster
Posts: 10
Topics: 5
August 21, 2010, 10:52:01 PM

Minimax is a much more efficient way to walk through the decision tree, then brute force as only those nodes are visited that might still contain a better solution, contrary to brute force where *all* nodes are visited, without any pruning.
« Last Edit: August 25, 2011, 07:47:42 PM by Admin »
 
webmaster forum
Admin  Offline
*
 
Code Guru
Location: India
Gender: Male
Posts: 1387
Topics: 105
NaviBuster NaviBuster
WWW
August 26, 2010, 02:58:24 AM

Is it Minimax better than Dijkstra's Algorithm?
 
webmaster forum
Life Is Good!
Activity
0%
 
Professional Coder
Gender: Female
Posts: 242
Topics: 3
WWW
August 17, 2011, 07:36:40 AM

i am very interested in this too..

Affordable Custom Web Design Services
 
  Email this topic  |  Print
Pages: [1]   Go Up
 
Jump to:  



Powered by SMF 1.1.15 | SMF © 2011, Simple Machines


Google visited last this page February 07, 2012, 04:05:24 PM