It is currently Thu Sep 09, 2010 3:01 am

All times are UTC - 8 hours


php-forum reccomends that you find a reliable php hosting solution


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: please help me ...
PostPosted: Thu Mar 04, 2010 7:58 am 
New php-forum User
New php-forum User
Joined: Thu Mar 04, 2010 7:41 am
Posts: 2

i want make php script using minimum spanning tree algorithm, the start node is define from user input, and the end nodes are from database table. the distance is calculated between Start node (koord_x, koord_y) and end nodes (koord_x2, koord_y2).
The output are the minimun distance, name start node and end node include distance between them.

please help me, i'm working on my thesis...


Offline
 Profile  
 Post subject: Re: please help me ...
PostPosted: Wed Jun 02, 2010 5:59 am 
New php-forum User
New php-forum User
User avatar
Joined: Wed Jun 02, 2010 5:02 am
Posts: 3

I think the distance between two points {A(x1,x2) and B(x2,y2)} is equal of square root of((x1-x2)^2+(y1-y2)^2). But this is suitable only for finding the shortest distance between two points, which is a straight line. If that is your condition (distance between two points - which is a straight line) this is must be the way. in this case you just can get the consumer co-ordinates of point, after that you can fetch from DB the rest of pints (co-ordinates of points). Then you just have to do this formula for every one pair of customer point and point of DB and result have to save in na array. After end of calculation you have to sort the array of result and the first element of array will be the shortest distance between two points - which is a straight line.

If you have to find shortest paths in a graph, you must exploit the Dijkstra Algorithm .
Something usefully




Nothing's imposible imagination is everything!
Benchmark Software | world's fastest database


Offline
 Profile  
 Post subject: Re: please help me ...
PostPosted: Sun Jun 06, 2010 7:24 am 
New php-forum User
New php-forum User
Joined: Thu Mar 04, 2010 7:41 am
Posts: 2

thanx Pollux, its very useful.


Offline
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


 Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: