Me and my two friends are developing this system as a part of our college project. Our city is a very large one with 800+ bus stops.
The method Mike has suggested is similar to Dijkstra's Shortest Path Algorithm. But the problem is we cannot implement it for 800+ nodes as it'll be inefficient. What we thought as a solution was to link each bus stop with a junction bus stop(a bus stop where two or more bus routes diverge or converge) and then considering only these nodes in the algorithm. But we're not sure that this method will give the right solution. So, please suggest some method for our problem. On May 30, 7:20 pm, Mike Williams <[email protected]> wrote: > There's nothing in the API that will help with that. You'd have to write > your own direction finder. > > A bus route direction finder is easier to write than a general purpose > route finder because you have a much smaller set of nodes, the bus > stops, where the route can change. If your city isn't too large, it's > feasible to perform a brute force search. > > Allocate a "cost" to travelling each segment of bus route, from one stop > to the next. GDirections uses estimated elapsed time as the cost, but > you can use whatever you want to minimise. In particular, it would make > sense to add a high cost factor to changing busses, so that your system > would prefer a longer route with one change of bus to a shorter route > which involved two changes. It would also make sense to include the > frequency of the busses on the route, so that your system would prefer a > longer route that involved a bus that runs every 10 minutes to a shorter > route where there's only one bus per hour. > > Once you've created your "cost" metric, and assigned costs to each > segment, assign a cost of zero to the destination node and Infinity to > all the others. > > Repeat: > Find the unprocessed node with the lowest cost, call it node A. > Loop through all the nodes (B) that are one segment away from node A. > Calculate their costs via this route by adding the cost of the segment > to the cost of node A. > If this cost is less than the previous cost assigned to node B, assign > node B that cost, and record that the route goes via node A. > Mark node A as processed. > Until: the start node is the unprocessed node with the lowest cost. > > At that point you have the route from start to destination that gives > the lowest cost. > > -- > Mike Williamshttp://econym.org.uk/gmap --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
