English 中文(简体)
我怎样做简单的车道搜索引擎?
原标题:How do I make a simple bus route search Engine?

[Not:e user is asking this again at Development of railway enquiry system, how to model Trains, Stations and Stops? ] My Problem Description:

Suppose I have a BUS-123 in ROUTE-1 it will travel through A, B, C, D, E, F, G, H and BUS-321 in ROUTE-2 through D, E, F, X, Y, Z . if someone enters B as a source point and F as a destination point then ROUTE-1 with BUS-123 should display in the result. But if someone enters H as a source and A as destination result should not display, because returning may not always same with one that is traveled. But if a person enters A as a source and Z as destination then BUS-123 with ROUTE-1 and BUS-321 with ROUTE-2 should display.

My Problem is: How do I store that route information in Database? if i store in RDBMS like the following

BUS_NUMBER   ROUTE_NUMBER    VIA_ROUTES
BUS-123      ROUTE-1         A, B, C, D, E, F, G, H
BUS-321      ROUTE-2         D, E, F, X, Y, Z

Then how my search will work. I mean how to search it in a string. And if I store all the VIA_ROUTES in different different columns then how it will be..? Please suggest me with your own technique. It is not urgent but I am planning to make a basic bus route search, so your comment with help is appreciated.

最佳回答

页: 1 每个公共汽车站都有一个vert。 两条路段之间的每一条直接连接均以标有线号的对口标示;因此,每一条路段是一系列连接的对口。 引导边缘。 并非所有从A号行驶到B号行道的航线也必然要从B号行驶,从A号行驶向另一个方向。

也许想把估计旅行时间的每一个边都集中在一起,这是对该腿有差异的一项措施(或措施)——星期天晚上有2am,差异可能较低,但星期五晚上有5点,可能非常高,离境时间也很多。

接着,你选择确定“东方费用”路线,然后确定“东方费用”。 您可能希望考虑的因素包括:

  • Total travel time
  • Total time spent waiting for the next leg to depart.
  • Wait time at any individual stop.
  • Distance?

我们应该指出,等待时间太短(每1月份,每辆公共汽车需要40分钟时间,每辆汽车是10 F车)。 由于公交车往往对时间表有很大差异,因为它们对当地交通条件波动非常敏感,因此也没有什么坏,因为这增加了失去联系的可能性。

这是我如何做的。

不过,我并不认为我试图直接在Kall解决这一问题。

模型是适合结构的。 你需要以下实体,然后需要一些实体,因为你需要代表时间表等:

  • Stop. A Bus stop. The vertices of the graph.
  • Route. A bus route.
  • Segment. The direct link between two stops. The edges of the graph.
  • RouteSegment. An associative entity representing ordered sequence of segments that composes the route.
问题回答

我认为,这辆汽车——数目很重要,因为你可以 later。 也许你们需要的是建立一个有汽车的2个矩阵,把车放在一个有车面的大型矩阵中,然后使用像D dijkstra这样的图表模拟算法,找到从A到B的最短路。 当你去看看客车时,你可以方便地看看客车号,并向客户显示。 因此,我认为你的数据库已经非常好。

页: 1 后者将提及路线,加上分类的字数,并提及<条码>,<>>>。 因此,你可以储存任何路线。

在搜查方面,如果你想在两条路之间寻找一条路,你可以看看<条码>/部分表中的两条路段,看看看看是否在任何情况下在同一航道上(考虑到一条路可能有一个方向,而不是另一个方向)。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签