Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 11th, 2005, 1:22 PM   #1
JimmyJaconi
Newbie
 
Join Date: May 2005
Posts: 1
Rep Power: 0 JimmyJaconi is on a distinguished road
Distance Finder Problem!

http://www.wrestlefury.com/DataFiles.zip

The zip file contains a map, a spread sheet of distances between these towns and two files of data extracted from the spread sheet. The extracted data is a list of the towns and a table of distances. Both these files have the number of entries in the file on the first line. Click the following link to see a picture of the program:

http://www.wrestlefury.com/distancefinder.jpg

I was wondering if anyone can help with the coding, i've got a bit of code which is underneath, but i still think this is fairly hard. I've created the Interface, just need to do the remainder of the code. Any code or hints will be very much appreciated.

[PHP]
private Hashtable _distances;

int[,] distances

_distances=new Hashtable();

Hashtable birminghamDistances=new Hashtable();
birminghamDistances.Add("Birmingham",0);
birminghamDistances.Add("Cardiff",103);
...
_distances.Add("Birmingham",birminghamDistances);

// repeat for all towns

[/PHP]
JimmyJaconi is offline   Reply With Quote
Old May 11th, 2005, 5:30 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Look up Dijkstra's shortest path algorithm. A Google search for "Dijkstra" should do it.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 12th, 2005, 1:44 AM   #3
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
The easiest thing to do is plot each town on a grid of the scale that you want the distance in.

Then take the two towns and use this to calculate distance

Distance = sqrt(abs(Town1.x - Town2.x) + (Town1.Y - Town2.y)))
__________________

tempest is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:12 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC