简体   繁体   中英

Algorithms find bus route

I working in my thesis, the project is support user find busline in my city in android. So i don't know i should use what algorithm to find the busline. I have 2 table : First table : BusStop:

BusStop_Id
BusLine_Id (connect to BusLine table)
Name
Latlng
Next_id(ID of next busstop)

Second table : BusLine:

ID
Name
ArrayList<BusStop> (all busstop of that busline)

I tried many algorithm a long time but i can't complete it. Can you tell me what's the algorithm i need?

Use Dijkstra's shortest path algorithm. It's pretty simple and should do the trick. You could assign costs for things like switching bus lines, if that's allowable but undesirable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM