简体   繁体   English

算法找到公交路线

[英]Algorithms find bus route

I working in my thesis, the project is support user find busline in my city in android.我在我的论文中工作,该项目是支持用户在 android 中找到我所在城市的公交线路。 So i don't know i should use what algorithm to find the busline.所以我不知道我应该使用什么算法来找到总线。 I have 2 table : First table : BusStop:我有 2 张桌子:第一张桌子: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.使用 Dijkstra 的最短路径算法。 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.如果允许但不可取,您可以为诸如切换公交线路之类的事情分配成本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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