公交换乘算法 编程语言 编程语言 清风亭

公交换乘算法 编程语言 编程语言 清风亭

ID:41037464

大小:31.50 KB

页数:5页

时间:2019-08-14

公交换乘算法 编程语言 编程语言 清风亭_第1页
公交换乘算法 编程语言 编程语言 清风亭_第2页
公交换乘算法 编程语言 编程语言 清风亭_第3页
公交换乘算法 编程语言 编程语言 清风亭_第4页
公交换乘算法 编程语言 编程语言 清风亭_第5页
资源描述:

《公交换乘算法 编程语言 编程语言 清风亭》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、公交换乘算法编程语言编程语言清风亭注册设为首页帮助首页

2、博客群

3、公社

4、专栏

5、论坛

6、图片

7、商城

8、交友

9、博客联播

10、投稿

11、随机访问

12、订阅用户名注册密 码忘记密码保存密码用户名注册密 码忘记密码保存密码清风亭复制我的GIS生活首页个人资料日志图片视频(测)好友博客群百科我的日志公交换乘算法分类:编程语言2007.5.2316:56作者:清风

13、评论:4

14、阅读:统计失败公交换乘简单算法:三个表(最简单化,不考虑模糊查询,单行线等其他东西):1,站点表stop(stop_id,stop_name)2,路线表line(line_id,line_name)3,路线站点表(点

15、线路关系表)linestops(line_id,stop_id,seq)此处的seq指某站点在某线路中的顺序。现在分析算法:1,直达线路首先根据两个站点名获取两个站点各自的id,这里定义为id1,id2然后查询selectline_idfrom(selectline_idfromlinestopswherestop_id=id1)A,(selectline_idfromlinestopswherestop_id=id2)BwhereA.line_id=B.line_id即得到可直达的线路列表2,一次换乘首先根据两个站点名获取两个站点各自的id,这里定义为i

16、d1,id2然后搜寻两个站点通过直达方式各自能够到达的站点集合,最后他们的交集就是我们所需要的换乘站点。selectstop_idfrom(selectdistinctstop_idfromlinestopswhereline_idin(selectline_idfromlinestopswherestop_id=id1))A,(selectdistinctstop_idfromlinestopswhereline_idin(selectline_idfromlinestopswherestop_id=id1))BwhereA.stop_id=B.stop

17、_id得到换乘站(可能有多个或0个)后,剩下的就是显示能够到达换乘站的两边线路,这通过前面的直达查询即可。3,二次换乘首先根据两个站点名获取两个站点各自的id,这里定义为id1,id2算法的中心思想是:站点1能够通过直达到达的所有站点集合A,站点2能够通过直达到达的所有站点集合B,A和B之间有直达的线路。一步一步来:站点1能够通过直达到达的所有站点集合A:selectdistinctstop_idfromlinestopswhereline_idin(selectline_idfromlinestopswherestop_id=id1)站点2能够通过直达到

18、达的所有站点集合B:selectdistinctstop_idfromlinestopswhereline_idin(selectline_idfromlinestopswherestop_id=id2)而直达的查询是selectline_idfrom(selectline_idfromlinestopswherestop_id=id1)C,(selectline_idfromlinestopswherestop_id=id2)DwhereC.line_id=D.line_id我们把=id1和=id2换成in(select....)A和in(select.

19、..)B这样最后我们的查询是selectline_idfrom(selectdistinctline_idfromlinestopswherestop_idin【A】)C,(selectdistinctline_idfromlinestopswherestop_idin【B】)DwhereC.line_id=D.line_id其中【A】是(selectdistinctstop_idfromlinestopswhereline_idin(selectline_idfromlinestopswherestop_id=id1))其中【B】是(selectdist

20、inctstop_idfromlinestopswhereline_idin(selectline_idfromlinestopswherestop_id=id2))这样子我们找到了作为中间换乘的线路(可能有多条或者0条),对列举的的每一条假设命名为X线,下一步就是找出可以从站点1到达X任意一个站点的直达线路、和可以从站点2到达X任意一个站点的直达线路即可。那么与前面的算法相似,我们在站点1所有能够到达的站点中去寻找和线路X相交的站点,然后再去找这两个点的线路selectstop_idfrom(selectdistinctstop_idfromlinest

21、opswhereline_idin(selectline_idfr

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。