Design of background database of bus route query system--improvement and optimization of transfer algorithm

Source: Internet
Author: User

In the article "Query algorithm" has implemented the transfer algorithm, but, using stored procedures InquiryT2 query from "Dong Pu" to "car road intersection" of the bus route, found that it took 5 minutes to find out the results, such efficiency is clearly not suitable for practical applications. Therefore, it is necessary to optimize and improve the original transfer algorithm. In this paper, we will give an improved transfer algorithm, compared with the original algorithm, the improved algorithm is more powerful and more efficient.

1. "Compression" RouteT0

Suppose RouteT0 has the following lines

As shown in the following figure, when the query S1 to S4 two transfer routes, will produce 3x2x4=24 results

As you can see from the diagram, the 3 lines in the 1th segment are the same starting point and site (2nd, 3), in fact, the transfer query is concerned about the two sites have wireless access, and do not care what route, so you can compress RouteT0 to:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.