A method for querying transfer itinerary
By constructing the path data of the transfer itinerary as graph data and conducting real-time graph searches in the graph data, the problem of low efficiency when users query the transfer itinerary is solved, and fast and efficient transfer itinerary planning and seamless travel experience are achieved.
Patent Information
- Application Number
- CN202510210482.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-02-25
AI Technical Summary
When users query the transit itinerary, it is difficult for the prior art to quickly and efficiently plan the transit itinerary for users to meet their travel needs.
By obtaining the full amount of transit itinerary path data, building it into graph data, and conducting real-time graph search in the graph data, querying the transit itinerary path that meets users' travel needs, and updating itinerary information in real time.
It improves the query efficiency when querying transit itineraries that meet travel needs for users, avoids storage redundancy, and provides a more seamless travel experience.
Smart Images

Figure CN119719429B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of artificial intelligence technology, and more particularly to a method for querying a transfer itinerary. Background Art
[0002] As the tourism industry has ushered in an unprecedented recovery, people's travel needs have surged, and a single direct flight or train can no longer meet the increasingly diverse needs of users. More passengers expect to travel through a variety of transportation modes, such as a flexible combination of airplane to train, train to train, train to car, etc. This solution of using multiple transportation modes for transit travel can effectively solve the needs of different users in terms of time, cost and convenience, and greatly improve the travel experience. Whether it is a short trip or a cross-border trip, flexible and diverse transportation options allow every passenger to find the most suitable travel mode and enjoy a more seamless travel experience. Therefore, in actual applications, how to quickly and efficiently plan a transit itinerary that meets the travel needs of users when users query the transit itinerary becomes very meaningful. Summary of the invention
[0003] This specification proposes a method for querying a transfer itinerary, the method comprising:
[0004] Acquire a full amount of transit trip path data, and construct the transit trip path data into graph data; wherein the nodes in the graph data represent stations; the edges in the graph data represent the transit relationship between stations; and the attribute information of the edges records the trip information of the transit trip corresponding to the transit relationship;
[0005] In response to a query request input by a user, performing a real-time graph search in the graph data to query at least one transit trip path that meets the travel needs of the user;
[0006] The at least one transit trip path found and at least part of the trip information recorded in the attribute information of the edge included in the at least one transit trip path are output and displayed to the user.
[0007] Optionally, the graph data is real-time graph data constructed based on a real-time graph database; the itinerary information includes real-time travel data related to the transfer itinerary; and the at least part of the information is the real-time travel data included in the itinerary information;
[0008] The method further comprises:
[0009] In response to a change in the real-time travel data recorded in the attribute information, the real-time travel data recorded in the attribute information of the edge is updated in real time based on a real-time update mechanism supported by the graph database.
[0010] Optionally, the graph data includes multiple types of sites; the edges in the graph data include first-type edges for representing transfer relationships between sites of the same type or different types; and second-type edges for representing travel relationships between sites of the same type; wherein the attribute information of the first-type edges records transfer information of transfer trips corresponding to the transfer relationship; and the attribute information of the second-type edges records the real-time travel data of the transfer trips corresponding to the travel relationship;
[0011] The real-time travel data recorded in the attribute information of the edge is updated in real time, including:
[0012] The real-time travel data recorded in the attribute information of the second-type edge is updated in real time.
[0013] Optionally, the graph data contains multiple types of public transportation stations; the real-time travel data includes the schedule information of the public transportation used for the transfer trip; the travel relationship is represented by the schedule of the public transportation used for the transfer trip between stations of the same type; and the attribute information of the second type of edge records the schedule information of the public transportation used for the transfer trip between stations of the same type.
[0014] Optionally, the query request includes query data indicating a starting point and a destination that meet the travel needs of the user;
[0015] In response to a query request input by a user, a real-time graph search is performed in the graph data to query at least one transit itinerary path that meets the travel needs of the user, including:
[0016] In response to a query request input by a user, determining a starting site corresponding to the starting point on the graph data, and a destination site corresponding to the destination on the graph data;
[0017] The starting site is used as the starting point of the graph search, and real-time graph traversal is performed on the graph data in parallel to search for all edges from the starting node to the destination site, and at least one transit trip path from the starting node to the destination site is generated based on all the searched edges.
[0018] Optionally, the starting site is used as the starting point of the graph search, and real-time graph traversal is performed on the graph data in parallel to search for all edges from the starting node to the destination site, and at least one transit trip path from the starting node to the destination site is generated based on all the searched edges, including:
[0019] If the starting point corresponds to multiple starting sites on the graph data, and the destination also corresponds to multiple destination sites on the graph data, the multiple starting sites are respectively used as starting points for graph search, and real-time graph traversal is performed on the graph data in parallel to search for all edges from each starting site in the multiple starting points to each destination site in the multiple destination sites, and multiple transit trip paths are generated from each starting site in the multiple starting points to each destination site in the multiple destination sites based on all the searched edges.
[0020] Optionally, in response to a query request input by a user, before performing a real-time graph search in the graph data to query at least one transfer itinerary path that meets the travel needs of the user, the method further includes:
[0021] Based on a preset asynchronous pruning strategy, determining invalid edges in the graph data, and performing pruning processing on the determined invalid edges;
[0022] In response to a query request input by a user, a real-time graph search is performed in the graph data to query at least one transit itinerary path that meets the travel needs of the user, including:
[0023] In response to a query request input by a user, based on a preset real-time pruning strategy, determining invalid edges in the graph data, and performing pruning processing on the determined invalid edges;
[0024] A real-time graph search is performed in the graph data after pruning to query at least one transfer travel path that meets the travel needs of the user.
[0025] Optionally, the transfer information recorded in the attribute information of the first-type edge includes the transfer time of the transfer trip corresponding to the transfer relationship; the asynchronous pruning strategy includes pruning the first-type edge whose transfer time reaches a preset threshold;
[0026] Based on a preset asynchronous pruning strategy, determining invalid edges contained in the graph data, and performing pruning processing on the determined invalid edges, including:
[0027] The first type of edges in the graph data are traversed, and it is determined whether the transfer time contained in the transfer information recorded in the attribute information of the traversed first type of edges reaches a preset threshold; if so, the first type of edges are treated as invalid edges for pruning.
[0028] Optionally, the real-time travel data recorded in the attribute information of the second type of edge includes the duration of the transfer trip corresponding to the travel relationship; the asynchronous pruning strategy includes pruning the edges in the transfer path whose total duration reaches a preset threshold;
[0029] Based on a preset asynchronous pruning strategy, determining invalid edges contained in the graph data, and performing pruning processing on the determined invalid edges, including:
[0030] Traverse the transfer trip path in the graph data, calculate the total consuming time of the transfer trip path based on the transfer time contained in the transfer information recorded in the attribute information of the first type of edge contained in the transfer trip path, and the consuming time contained in the real-time travel data recorded in the attribute information of the second type of edge contained in the transfer trip path, and determine whether the total consuming time reaches a preset threshold; if so, prune the edges in the transfer trip path as invalid edges.
[0031] Optionally, based on a preset real-time pruning strategy, determining invalid edges in the graph data, and performing pruning processing on the determined invalid edges, includes:
[0032] Traversing the second-type edges in the graph data, and determining whether the transfer trip corresponding to the second-type edges can travel normally based on the real-time travel data recorded in the attribute information of the traversed second-type edges; if not, pruning the second-type edges as invalid edges; or,
[0033] The second-type edges in the graph data are traversed, and based on the real-time travel data recorded in the attribute information of the traversed second-type edges, a prediction is made as to whether the transfer trip corresponding to the second-type edges can be traveled normally within a preset time in the future; if not, the second-type edges are treated as invalid edges for pruning.
[0034] Optionally, the real-time travel data includes the schedule information of the public transportation used for the transfer trip; the travel relationship is represented by the schedule of the public transportation used for the transfer trip between the same type of stations; the attribute information of the second type of edge records the schedule information of the public transportation used for the transfer trip between the same type of stations; the schedule information includes the schedule identifier; and the remaining ticket information of the schedule corresponding to the schedule identifier;
[0035] Determining whether a transfer trip corresponding to the second-type edge can be traveled normally based on the real-time travel data recorded in the attribute information of the traversed second-type edge includes:
[0036] Based on the remaining ticket information contained in the flight information recorded in the attribute information of the traversed second-type edge, determine whether the transfer trip corresponding to the second-type edge has no ticket; if so, determine that the transfer trip corresponding to the second-type edge cannot be traveled normally; or,
[0037] Based on the remaining ticket information contained in the flight information recorded in the attribute information of the traversed second-type edge, it is predicted whether there are no tickets for the transfer trip corresponding to the second-type edge within a preset time in the future; if so, it is determined that the transfer trip corresponding to the second-type edge cannot be traveled normally.
[0038] Optionally, based on a preset real-time pruning strategy, determining invalid edges in the graph data, and performing pruning processing on the determined invalid edges, includes:
[0039] If the starting place corresponds to multiple starting sites on the graph data, determine a target starting site that is outside the administrative area corresponding to the starting place among the multiple starting sites, and prune the edge where the target starting site is located in the graph data as an invalid edge;
[0040] If the destination corresponds to multiple destination sites on the graph data, determine a target destination site among the multiple destination sites that is outside the administrative area corresponding to the destination, and prune the edge where the target destination site is located in the graph data as an invalid edge.
[0041] Optionally, based on a preset real-time pruning strategy, determining invalid edges in the graph data, and performing pruning processing on the determined invalid edges, includes:
[0042] Obtaining at least one optimal transfer station from the starting point to the destination that is calculated in advance;
[0043] The sites in the graph data are traversed, and the edges where the traversed sites except the at least one optimal transfer site are located are treated as invalid edges for pruning.
[0044] In the above embodiment, by using graph data to store the full amount of transit trip path data, and performing real-time graph search in the graph data to query the transit trip path that meets the user's travel needs, on the one hand, the performance advantage of graph data in complex query scenarios can be utilized to improve the query efficiency when querying for transit trips that meet the user's travel needs; on the other hand, the storage characteristics of graph data can be utilized to avoid storage redundancy when storing the full amount of transit trip path data. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0046] Figure 1 It is a schematic diagram of the architecture of an Internet service system shown in an embodiment of this specification;
[0047] Figure 2 is a flow chart of a method for querying a transfer itinerary shown in an embodiment of this specification;
[0048] Figure 3 It is a schematic diagram of an algorithm framework for searching a transfer itinerary path based on graph data shown in an embodiment of this specification;
[0049] Figure 4 It is a schematic diagram of performing real-time graph search on graph data in a multi-path parallel manner shown in an embodiment of this specification;
[0050] Figure 5 It is a schematic diagram of graph data constructed based on a full amount of transit trip path data shown in an embodiment of this specification;
[0051] Figure 6 is a schematic structural diagram of an electronic device shown in an embodiment of this specification;
[0052] Figure 7 It is a block diagram of a transfer itinerary query device shown in an embodiment of this specification. DETAILED DESCRIPTION
[0053] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0054] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0055] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0056] This specification aims to propose a technical solution that uses graph data to store a full amount of transit itinerary path data, and uses real-time graph search in the graph data to query and plan transit itinerary paths that meet the user's travel needs.
[0057] Figure 1 FIG. 1 is a schematic diagram of an Internet service system architecture provided by an exemplary embodiment. Figure 1 As shown, the system may include a server 11, a network 12, and several electronic devices, such as a PC (Personal Computer) 13, a mobile phone 14, and the like.
[0058] The server 11 may be a physical server including an independent host, or the server 11 may be a virtual server carried by a host cluster. During operation, the server 11 may run a server-side program of a certain application to implement the relevant functions of the application. For example, when the server 11 runs a program of a certain Internet service, it may be implemented as a corresponding Internet service platform.
[0059] PC 13 and mobile phone 14 are only some types of electronic devices that users can use. In fact, users can obviously also use electronic devices such as the following types: tablet devices, laptops, PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smart watches, etc.), etc., and one or more embodiments of this specification do not limit this. During operation, the electronic device can run a program on the client side of an application to implement the relevant functions of the application. For example, when the electronic device runs a program for an Internet service, it can be implemented as a client of the Internet service. Among them, the application program of the client of the above-mentioned Internet service can be started and run on the electronic device. The program on the client side can be a native application installed on the electronic device, or the program on the client side can be a small program, a quick application or other similar forms.
[0060] Of course, when using web technologies such as HTML5 or similar, relevant functions can be implemented through pages displayed by browsers. The browser here can be an independent browser application or a browser module embedded in certain applications.
[0061] As for the network 12 for interaction between electronic devices such as PC 13 and mobile phone 14 and server 11, it is possible to select a wired or wireless network to achieve communication based on the communication mode supported by the corresponding electronic device, and this specification does not limit this. For example, PC 13 can support both wired and wireless communication, so it can use a wired or wireless network to achieve communication as needed, while mobile phone 14 usually only supports wireless communication, so it can use a wireless network to achieve communication.
[0062] It should be noted that the above-mentioned Internet services may include any services implemented on the Internet; for example, the above-mentioned Internet services may specifically include user services such as transit itinerary query services, transit itinerary planning services, or other types of services, etc., and this specification does not limit this.
[0063] The technical solution of this specification is described in detail below with reference to the accompanying drawings.
[0064] See also Figure 2 , Figure 2 The flowchart of a method for querying a transfer itinerary shown in this specification includes the following execution process:
[0065] Step 202: Acquire the full amount of transit trip path data, and construct the transit trip path data into graph data; wherein the nodes in the graph data represent stations; the edges in the graph data represent the transit relationship between stations; and the attribute information of the edges records the trip information of the transit trip corresponding to the transit relationship;
[0066] The above-mentioned transfer itinerary may specifically include a itinerary composed of multiple segments and requiring transfers at multiple transfer stations. In practical applications, in order to meet the increasingly diverse travel needs of users, the above-mentioned transfer itinerary may specifically be a transfer itinerary composed of multiple segments corresponding to different modes of transportation that are flexibly combined.
[0067] For example, in one example, the above-mentioned transfer itinerary may specifically include the transfer itinerary provided to the user by the travel transaction service platform; in this service scenario, the user may enter the required ODD (Origin Destination Departure time) information in the query interface provided by the travel transaction service platform to query the relevant transfer itinerary. The travel transaction service platform may process the user's query request, sequentially combine multiple itineraries corresponding to different modes of transportation, query the user in real time for the optimal N transfer itineraries that meet the user's travel requirements for the ODD, and then output these planned transfer itineraries to the user for selection.
[0068] The above-mentioned transit itinerary path may specifically include a transit path formed by splicing multiple segments of itinerary constituting the transit itinerary; correspondingly, the above-mentioned transit itinerary path data may specifically include path data formed by splicing the itinerary data of the multiple segments of itinerary constituting the transit itinerary.
[0069] For example, after specifying a certain starting point and a certain destination, assuming that there is no direct journey between the starting point and the destination, you can first obtain all valid multiple-segment journeys from the starting point to the destination, and then splice the travel data of the multiple segments as the transit journey path data between the starting point and the destination.
[0070] In actual applications, in order to improve the query efficiency when querying transfer itineraries that meet the travel needs of users, the full amount of transfer itinerary path data can be constructed into the form of graph data, and then real-time graph search can be performed in the constructed graph data to query the transfer itinerary path that meets the user's travel needs.
[0071] The above-mentioned complete transit itinerary routes specifically refer to a set of transit itinerary routes that can cover all known stations.
[0072] For example, in actual applications, any two of all known sites can be used as the starting point and the destination respectively, and then they are arranged and combined to exhaustively enumerate all possible transit paths, thereby generating a set of transit itinerary paths that can cover all known sites. The set of transit itinerary paths generated at this time can be called a complete set of transit itinerary paths.
[0073] Correspondingly, the above-mentioned full amount of transit trip path data specifically refers to a transit trip path data set constituted by the transit trip path data corresponding to all the transit trip paths in the above-mentioned transit trip path set.
[0074] See 3, Figure 3 This is a schematic diagram of an algorithm framework for searching transit itinerary paths based on graph data as shown in this specification.
[0075] like Figure 3 As shown, when constructing the full amount of transit trip path data into graph data, specifically, the full amount of transit trip path data can be first obtained, and then the obtained full amount of transit trip path data can be constructed into the form of graph data in an offline manner.
[0076] The nodes in the graph data constructed above can be used to represent stations, and the edges in the graph data can be used to represent the transfer relationship between stations. In practical applications, in the process of constructing graph data, all stations covered by the full transfer itinerary path data can be used as nodes in the graph data, and the edges between nodes can be constructed based on the full transfer relationship between stations covered by the full transfer itinerary path data.
[0077] The attribute information of the node in the above graph data can specifically record any form of site description information corresponding to the site represented by the node; the attribute information of the edge in the above graph database can specifically record any form of transit description information of the transit itinerary corresponding to the transit relationship represented by the edge.
[0078] In one embodiment shown, the above-mentioned graph data may specifically include multiple types of sites; for example, still taking the scenario of traveling by public transportation as an example, in this scenario, the graph data may specifically include multiple types of public transportation sites; for example, train stations, passenger stations, airports and other sites.
[0079] The edges in the graph data may specifically include first-type edges for indicating transfer relationships between stations of the same type or different types; and second-type edges for indicating travel relationships between stations of the same type. The attribute information of the first-type edges may specifically record transfer information of the transfer trip corresponding to the transfer relationship; the attribute information of the second-type edges may specifically record transfer description information of the transfer trip corresponding to the travel relationship.
[0080] The transfer description information recorded in the attribute information of the edge in the graph database may specifically include the itinerary information of the transfer itinerary corresponding to the transfer relationship represented by the edge. For example, in one example, the itinerary information may specifically include real-time travel data related to the transfer itinerary.
[0081] Among them, the above-mentioned real-time travel data may specifically include any form of real-time data related to the travel of the transfer trip, and in different travel scenarios, may specifically include different types of real-time data related to the travel.
[0082] For example, taking the scenario of traveling by public transportation as an example, in this scenario, the above-mentioned real-time travel data that needs to be updated in real time may specifically include the schedule information of the public transportation used for the transfer trip. Among them, the schedule information may specifically include the schedule identification, the fare information of the schedule corresponding to the schedule identification, and the remaining ticket information of the schedule corresponding to the schedule identification. That is, the real-time travel data that needs to be updated in real time may specifically include the price and remaining ticket inventory information of the schedule used by the public transportation used for the transfer trip. Correspondingly, the travel relationship represented by the above-mentioned second type of edge can be specifically represented by the schedule of the public transportation used for the transfer trip between the same type of stations; and the transfer description information of the transfer trip corresponding to the above-mentioned travel relationship recorded in the attribute information of the above-mentioned second type of edge may specifically include the schedule information of the public transportation used for the transfer trip between the same type of stations.
[0083] It should be noted that, in practical applications, the specific form of the graph database used to construct the above-mentioned graph data is not specifically limited in this specification.
[0084] In a real-time mode shown, in order to improve the performance of real-time retrieval of graph data, the graph data may be real-time graph data built on a real-time graph database. A real-time graph database is a database system specially designed to store and query graph-structured data, which can efficiently process nodes, edges and their attributes in graph data. This type of database is particularly suitable for application scenarios where data relationships are complex and dynamically changing and require fast response.
[0085] The specific type of the real-time graph database selected when constructing the real-time graph data is not particularly limited in this specification, and in practical applications, it can be flexibly selected based on specific needs. For example, in one example, the real-time graph database can be a GeaBase graph database.
[0086] Please continue to see Figure 3 , after the full amount of transit trip path data obtained is constructed into the form of graph data in an offline manner, in order to ensure the real-time nature of the graph data, when the real-time travel data recorded in the attribute information of the edges in the graph data changes, the real-time travel data recorded in the attribute information of the edges of the graph data can be updated in real time based on the real-time update mechanism supported by the above-mentioned real-time graph database.
[0087] For example, in one embodiment shown, the edges in the graph data may include first-type edges for indicating transfer relationships between sites of the same type or different types; and second-type edges for indicating travel relationships between sites of the same type. The attribute information of the first-type edges may specifically record transfer information of transfer trips corresponding to the transfer relationships; and the attribute information of the second-type edges may specifically record real-time travel data of transfer trips corresponding to the travel relationships. In this case, when the real-time travel data recorded in the attribute information of the edges in the graph data is updated in real time, only the real-time travel data recorded in the attribute information of the second-type edges may be updated in real time.
[0088] Among them, it should be noted that when the real-time travel data recorded in the attribute information of the edges of the graph database is updated in real time, in order not to affect the real-time graph query on the graph data, the real-time travel data recorded in the attribute information of the edges of the graph data can be updated asynchronously in the background based on the real-time update mechanism supported by the real-time graph database used to build the graph data.
[0089] In addition, the real-time update of the real-time travel data recorded in the attribute information of the edge of the graph data may be a quasi-real-time update; for example, a shorter update cycle may be set, and then quasi-real-time updates may be performed periodically.
[0090] The real-time update mechanism supported by the above-mentioned real-time graph database usually depends on the specific type of the real-time graph database. In practical applications, different types of real-time graph databases may adopt a unified real-time update mechanism or support different real-time update mechanisms.
[0091] For example, the real-time graph database is a GeaBase graph database. The GeaBase graph database can support real-time updates of the attributes of the edges of the graph data in a message-based manner. Therefore, in this case, when the real-time travel data recorded in the attribute information of the edges in the graph data changes, the attributes of the edges of the graph data can be asynchronously updated in real time based on the messages supported by the GeaBase graph database.
[0092] Step 204: In response to a query request input by the user, a real-time graph search is performed in the graph data to query at least one transit travel route that meets the travel needs of the user;
[0093] Please continue to see Figure 3 After the acquired full amount of transit itinerary path data is constructed into graph data, upon receiving a query request input by the user, the query request input by the user can be responded to by performing a real-time graph search in the graph data on the basis of the constructed graph data, so as to query and plan at least one transit itinerary path that meets the user's travel needs.
[0094] In one embodiment shown, the above-mentioned transfer itinerary is still taken as a transfer itinerary provided to the user by the travel transaction service platform. In this service scenario, the user can enter the required ODD information on the query interface provided by the travel transaction service platform to query the relevant transfer itinerary, and the query result can construct a query request based on the information entered by the user and send it to the travel service platform. Among them, the query request can specifically include query data for indicating the starting place and destination that meet the user's travel needs.
[0095] After receiving the query request from the user, the travel transaction service platform can respond to the query request and parse the query data contained in the query request to determine the starting node (i.e., the starting site) and the destination location (i.e., the destination site) corresponding to the ODD required for the user's travel in the graph data;
[0096] For example, in actual applications, the starting point and destination in the ODD information entered by the user and contained in the query data can usually be based on the city as the input dimension rather than a specific site; for example, the user searches for departure from Hangzhou, but does not specifically specify which site in Hangzhou (such as a train station, airport, etc.) to depart from; in this case, the travel transaction service platform can pre-establish a mapping relationship between cities and sites, and in the process of parsing the query data contained in the query request, the mapping relationship can usually be used to convert the starting point of the city dimension entered by the user contained in the query data into the corresponding starting node in the graph data, and the destination of the city dimension entered by the user contained in the query data into the corresponding destination site in the graph data.
[0097] After determining the starting node and destination location corresponding to the ODD required for the user's travel in the graph data, the starting node can be used as the starting point of the graph search, and real-time graph traversal can be iteratively performed on the graph data to search for all the edges from the starting node to the destination node, and at least one transit travel path from the starting node to the destination node can be generated based on all the searched edges.
[0098] The specific process of iteratively performing real-time graph traversal on graph data will not be described in detail in this specification.
[0099] For example, in practical applications, when performing real-time graph traversal iteratively on graph data, the starting node can be used as the starting point of the graph search, and the edges in the graph data with the starting site as the starting point can be traversed, and it can be determined whether the end point of the traversed edge is the destination node; if not, continue to use the end point as the starting point of the graph search, traverse the edges in the graph data with the end point as the starting point, and iterate the above process until the edge with the destination site as the end point is traversed.
[0100] Of course, in actual applications, if the starting point that meets the user's travel needs corresponds to multiple starting sites in the graph data, and the destination that meets the user's travel needs also corresponds to multiple destination sites in the graph data, a multi-path parallel approach can be used to perform real-time graph search on the graph data.
[0101] In this case, if the above-mentioned starting point corresponds to multiple starting sites on the graph data, and the above-mentioned destination also corresponds to multiple destination sites on the graph data, the multiple starting sites can be used as starting points for graph search respectively, and real-time graph traversal can be performed on the graph data in parallel to search for all edges from each starting site in the multiple starting points to each destination site in the multiple destination sites, and based on all the searched edges, multiple transit travel paths are generated from each starting site in the multiple starting points to each destination site in the multiple destination sites.
[0102] For example, see Figure 4 , Figure 4 This is a schematic diagram of a method for performing real-time graph search on graph data in a multi-path parallel manner as shown in this specification.
[0103] like Figure 4 As shown in the figure, still taking the scenario of traveling by public transportation as an example, in this scenario, the graph data may specifically include various types of public transportation stations; for example, railway stations, passenger stations, airports, etc. When the user's starting point and destination both have the three types of stations listed above, the transfer methods available to the user may specifically include the following: Figure 4 As shown, plane to train, train to plane, train to train, plane to car, car to plane, train to car, car to truck, plane to train to car, train to plane to car, and so on.
[0104] At this time, if the starting point corresponds to multiple starting sites on the graph data (for example, the starting point has a train station, an airport, and a bus station at the same time), and the destination also corresponds to multiple destination sites on the graph data, then all possible transfer methods between the multiple starting sites and the multiple destination sites can be determined first, and then a multi-path parallel method can be used to perform graph searches corresponding to all the determined possible transfer methods on the graph data in parallel to plan a transfer path for the user. Finally, the search results of the graph searches executed in parallel can be merged to obtain the final search results.
[0105] By adopting this multi-path parallel graph search method, the search efficiency of real-time graph search can be significantly improved, and a transfer path that meets user needs can be quickly planned for users.
[0106] Please continue to see Figure 3 In order to avoid the graph data being too large and affecting the efficiency of graph search, the graph data can also be pruned to filter out invalid edges contained in the graph data.
[0107] Among them, the pruning strategy adopted for pruning graph data may specifically include an asynchronous pruning strategy and a real-time pruning strategy during real-time graph search.
[0108] It should be explained that the so-called asynchronous pruning strategy refers to the pruning strategy executed in the offline graph data construction stage, and the so-called real-time pruning strategy refers to the pruning strategy executed in real time during the real-time graph search in the graph data.
[0109] The so-called pruning process can specifically include any form of processing that can exclude invalid edges from graph search;
[0110] For example, the above-mentioned pruning process may specifically include a process of deleting invalid edges from the graph data; or, it may also be a process of searching and shielding the invalid edges contained in the graph data so that the invalid edges do not participate in the graph search process.
[0111] In one embodiment shown, before performing a real-time graph search in graph data in response to a query request input by a user (for example, during the stage of building graph data offline), a preset asynchronous pruning strategy can be executed to determine invalid edges in the constructed graph data, and then prune the determined invalid edges.
[0112] In this case, when a real-time graph search is subsequently performed in the graph data in response to a query request input by a user, the real-time graph search can be performed on the graph data after the pruning process is completed.
[0113] Among them, the asynchronous pruning strategy adopted in the asynchronous pruning processing of graph data is not specifically limited in this specification. In practical applications, it can be flexibly set based on the characteristics of the travel scenario.
[0114] In one embodiment shown, the transfer information recorded in the attribute information of the above-mentioned first-type edge may specifically include the transfer time of the transfer trip corresponding to the transfer relationship represented by the first-type edge; wherein the transfer time may be the time required for the transfer between the two stations connected by the first-type edge estimated by the system; for example, the user's location may be obtained, and then the distance between the user's location and the starting station specified by the user may be calculated in real time, and then the transfer time from the user's location to the starting station by public transportation, self-driving, taxi, car rental, etc. may be estimated.
[0115] In this scenario, the asynchronous pruning strategy may specifically include pruning the first-class edges whose transfer time reaches a preset threshold. When determining the invalid edges contained in the graph data based on the preset asynchronous pruning strategy and pruning the determined invalid edges, the first-class edges in the graph data may be traversed, and it may be determined whether the transfer time contained in the transfer information recorded in the attribute information of the traversed first-class edges reaches the preset threshold; if so, the first-class edges may be pruned as invalid edges.
[0116] Among them, it should be noted that, since the first-class edge can be used to represent the transfer relationship between the same type of stations, it can also represent the transfer relationship between different types of stations; therefore, when setting the above-mentioned preset threshold for the first-class edge, different thresholds can be set for the first-class edge for these two situations. For example, for the first-class edge representing the transfer relationship between different types of stations, and the first-class edge representing the transfer relationship between the same type of stations, different thresholds can be set based on specific situations. For example, since it usually takes longer to transfer between different types of stations, a larger threshold can be set for the first-class edge representing the transfer relationship between different types of stations than for the first-class edge representing the transfer relationship between the same type of stations.
[0117] Through this pruning strategy, the first-class edges whose transit time reaches the preset threshold contained in the graph data can be excluded in advance before the real-time graph search, so that in the real-time graph search stage, a better transit path can be queried and planned for users.
[0118] In one embodiment shown, the real-time travel data recorded in the attribute information of the second-type edge may specifically include the duration of the transfer trip corresponding to the travel relationship represented by the second-type edge; for example, taking the travel relationship as an example of using the public transportation vehicle schedule used for transfer trips between stations of the same type, the duration may specifically be the total operating time of the public transportation vehicle of this schedule traveling between the two stations of the second-type connection.
[0119] In this scenario, the above-mentioned asynchronous pruning strategy may specifically include pruning the edges in the transfer path whose total time consumption reaches a preset threshold. When determining the invalid edges contained in the graph data based on the preset asynchronous pruning strategy and pruning the determined invalid edges, the transfer trip paths in the graph data can be traversed, and the total time consumption of the transfer trip path can be calculated based on the transfer time contained in the transfer information recorded in the attribute information of the first type of edges contained in the transfer trip path, and the time consumption contained in the real-time travel data recorded in the attribute information of the second type of edges contained in the transfer trip path; that is, by accumulating the transfer time recorded in the attribute information of the first type of edges contained in each transfer trip path in the graph data and the transfer time recorded in the attribute information of the second type of edges, the total time consumption of the transfer trip path is converted. Of course, for a special transit itinerary that only contains first-type edges or second-type edges in the entire path, you can just add up the transit time recorded in the attribute information of the first-type edges actually contained in the transit itinerary or the transit time recorded in the attribute information of the second-type edges.
[0120] Then, it can be determined whether the total time consumed by traversing the transit path reaches a preset threshold; if so, all the edges included in the transit path can be pruned as invalid edges.
[0121] In one example, the preset threshold may specifically be a threshold interval consisting of the optimal time duration and the longest time duration of each transit trip path in the graph data that are pre-counted; in this case, when determining whether the total time duration of the traversed transit trip path reaches the preset threshold, it may specifically be determined whether the total time duration of the traversed transit trip path is outside the threshold interval; if so, all edges contained in the transit trip path may be treated as invalid edges and pruned.
[0122] In another example, the preset threshold may also be a maximum time-consuming threshold set by the user that can be tolerated. In this case, when determining whether the total time-consuming duration of the traversed transit path reaches the preset threshold, it may be determined whether the total time-consuming duration of the traversed transit path is greater than the maximum time-consuming threshold; if so, all edges included in the transit path may be treated as invalid edges for pruning.
[0123] Through this pruning strategy, the edges contained in the transfer paths whose total time reaches the preset threshold can be excluded in advance before the real-time graph search, so that in the real-time graph search stage, a better transfer path can be queried and planned for users.
[0124] In one embodiment shown, in response to a query request input by a user, during a real-time graph search in the graph data, a preset real-time pruning strategy can be executed to determine invalid edges in the constructed graph data, and the determined invalid edges can be pruned in real time. Then, a real-time graph search can be performed in the graph data after pruning to query at least one transit itinerary path that meets the travel needs of the user.
[0125] The real-time pruning strategy used in the real-time pruning of graph data is not particularly limited in this specification, and in practical applications, it can also be flexibly set based on the characteristics of the travel scenario.
[0126] In one embodiment shown, the real-time pruning strategy may specifically include pruning the second type of edges whose corresponding transfer trips cannot be traveled normally.
[0127] In one example, when determining invalid edges in graph data based on a preset real-time pruning strategy and performing pruning on the determined invalid edges, the second-type edges in the graph data can be traversed specifically, and based on the real-time travel data recorded in the attribute information of the traversed second-type edges, it can be determined whether the transfer trip corresponding to the second-type edges can be traveled normally; if not, the second-type edges can be pruned as invalid edges.
[0128] In another example, when determining invalid edges in graph data based on a preset real-time pruning strategy and performing pruning on the determined invalid edges, the second-type edges in the graph data can also be traversed, and based on the real-time travel data recorded in the attribute information of the traversed second-type edges, it is predicted whether the transfer trip corresponding to the second-type edges can be traveled normally within a preset time period in the future; if not, the second-type edges can be pruned as invalid edges.
[0129] For example, in actual applications, a prediction model can be pre-built based on the historical travel data of each second-type edge to predict whether the transfer trip corresponding to the second-type edge can be traveled normally within a preset time in the future. In the process of traversing the second-type edges, the real-time travel data recorded in the attribute information of the traversed second-type edges can be used as prediction data and input into the prediction model to predict whether the transfer trip corresponding to the second-type edge can be traveled normally within the preset time in the future.
[0130] It should be noted that the specific method for determining whether the transfer trip corresponding to the traversed second-type edge can be traveled normally is not particularly limited in this specification. In practical applications, it can be flexibly selected in combination with the characteristics of the specific travel scenario. For example, in the scenario of traveling by public transportation, it can be determined whether the transfer trip can be traveled normally based on whether the train number of the transfer trip corresponding to the traversed second-type edge has remaining tickets.
[0131] In one embodiment shown, taking the scenario of traveling by public transportation as an example, in this scenario, the travel relationship represented by the second type of edge can be specifically represented by the schedule of public transportation used for transfer trips between stations of the same type; the real-time travel data can specifically include the schedule information of public transportation used for transfer trips corresponding to the travel relationship represented by the second type of edge; and the schedule information can specifically include a schedule identifier; and the remaining ticket information of the schedule corresponding to the schedule identifier.
[0132] In one example, when determining whether a transfer trip corresponding to the traversed second-type edge can be traveled normally based on real-time travel data recorded in the attribute information of the traversed second-type edge, it is possible to determine whether there is no ticket for the transfer trip corresponding to the traversed second-type edge based on the remaining ticket information contained in the flight information recorded in the attribute information of the traversed second-type edge; if so, it can be determined that the transfer trip corresponding to the second-type edge cannot be traveled normally.
[0133] In another example, based on the remaining ticket information contained in the flight information recorded in the attribute information of the traversed second-type edge, it is also possible to predict whether the transfer trip corresponding to the second-type edge will be out of tickets within a preset time in the future (for example, within the next 15 minutes); if so, it can be determined that the transfer trip corresponding to the traversed second-type edge cannot be traveled normally.
[0134] For example, in actual applications, through offline analysis of official ticket releases and user travel popularity, a prediction model can be pre-built to predict whether there will be tickets for the transfer trip corresponding to the second-type edge within a preset time in the future. In the process of traversing the second-type edges, it is possible to predict in real time whether there will be tickets for the transfer trip corresponding to the second-type edge within a preset time in the future based on the prediction model.
[0135] Through this pruning strategy, the second type of edges whose corresponding transfer itineraries cannot be used normally can be excluded in advance before the real-time graph search, so that in the real-time graph search stage, a better transfer route can be queried and planned for users.
[0136] In one embodiment shown, the real-time pruning strategy may further include pruning edges of the graph data at which the starting sites are located outside the administrative region corresponding to the starting point specified by the user.
[0137] In one example, when invalid edges in the graph data are determined based on a preset real-time pruning strategy and the determined invalid edges are pruned, if the starting point specified by the user corresponds to multiple starting sites in the graph data, then a target starting site among the multiple starting sites that is outside the administrative area corresponding to the starting point can be determined.
[0138] For example, suppose the user specifies that the starting point is Hangzhou, and there are three starting stations in Hangzhou, namely Hangzhou East Station, Hangzhou West Station and Qiandao Lake Station. Since Qiandao Lake Station is located outside the administrative area of Hangzhou, Qiandao Lake Station is the above-mentioned target starting station.
[0139] Then, the edge where the target starting site is located can be determined in the graph data, and then the edge package where the target starting site is located is treated as an invalid edge and pruned.
[0140] In one example, when determining invalid edges in the graph data based on a preset real-time pruning strategy and performing pruning on the determined invalid edges, if the destination specified by the user corresponds to multiple destination sites in the graph data, then a target starting site among the multiple destination sites that is outside the administrative area corresponding to the destination can be determined; then, the edge where the target destination site is located can be determined in the graph data, and the edge package where the target destination site is located can be pruned as an invalid edge.
[0141] Through this pruning strategy, before the real-time graph search, the edges of the starting station or destination station contained in the graph data that are located outside the administrative area corresponding to the starting point or destination specified by the user can be excluded in advance, so that in the real-time graph search stage, a better transit path can be queried and planned for the user.
[0142] In one embodiment shown, the real-time pruning strategy may further include pruning edges of other sites contained in the graph data other than at least one optimal transfer site from a user-specified starting point to a user-specified destination.
[0143] In this scenario, the optimal transfer node when transferring between any two sites included in the graph data can be pre-counted offline; wherein the optimal transfer node may be, for example, a transfer node with the shortest transfer time, the lowest price, and the least number of transfers, which is not specifically limited in this specification. When the invalid edges in the graph data are determined based on a preset real-time pruning strategy and the determined invalid edges are pruned, at least one optimal transfer site from the user-specified starting point to the user-specified destination that has been pre-counted can be obtained.
[0144] Then, each station in the graph data can be traversed to determine whether the traversed station is at least one of the above-mentioned optimal transit stations; if so, the edges where other stations in the graph data are located can be pruned as invalid edges; conversely, if the traversed station is not at least one of the above-mentioned optimal transit stations, the edges where the station is located in the graph data can be pruned as invalid edges.
[0145] Through this pruning strategy, before the real-time graph search, the edges of other transfer sites except the optimal transfer site counted offline contained in the graph data can be excluded in advance, so that in the real-time graph search stage, a better transfer path can be queried and planned for users.
[0146] Step 206: output and display to the user the at least one transit itinerary path found and at least part of the itinerary information recorded in the attribute information of the edge included in the at least one transit itinerary path.
[0147] After real-time graph search is performed in the graph data to query and plan at least one transit itinerary path that meets the user's travel needs, at least part of the itinerary information recorded in the attribute information of the edges included in the at least one transit itinerary path can be output and displayed to the user for user selection.
[0148] Please continue to see Figure 3 In one embodiment shown, in order to optimize the display effect, when the at least one transit trip path found is output and displayed to the user, the at least one transit trip path can be scored based on at least part of the trip information recorded in the attribute information of the edge in the at least one transit trip path found, so as to obtain a score corresponding to the at least one transit trip path; wherein the score can be specifically used to indicate the degree of compliance of the transit trip path with the travel needs of the user.
[0149] Then, the at least one transit trip path may be sorted based on the score, and the sorted at least one transit trip path and at least part of the trip information recorded in the attribute information of the edges included in the sorted at least one transit trip path may be output and displayed to the user.
[0150] For example, in actual applications, N transfer trip paths with the highest scores can be screened out from the at least one transfer trip path based on the scores, and the N transfer trip paths can be sorted based on the scores. The sorted N transfer trip paths and at least part of the trip information recorded in the attribute information of the edges included in the sorted N transfer trip paths can be output and displayed to the user.
[0151] In one embodiment shown, the at least part of the information may be at least part of the real-time travel data recorded in the attribute information of the edge included in the transit trip path. In this case, the transit trip path may be scored based on at least part of the real-time travel data recorded in the attribute information of the edge included in the transit trip path.
[0152] Then, the at least one transit trip path may be sorted based on the score, and the at least one sorted transit trip path and at least part of the real-time travel data recorded in the attribute information of the edges included in the at least one sorted transit trip path may be output and displayed to the user.
[0153] The data items used for scoring contained in the above-mentioned real-time travel data are not specifically limited in this specification and may be different in different travel scenarios. Accordingly, the specific scoring process of scoring the transfer itinerary based on at least part of the data in the above-mentioned real-time travel data is not specifically limited in this specification.
[0154] For example, in one example, taking the scenario of traveling by public transportation as an example, the at least part of the information may specifically include a combination of one or more of the following:
[0155] The total price of the connecting trip corresponding to at least one of the above connecting trip routes;
[0156] The total duration of the transfer trip corresponding to the at least one transfer trip path;
[0157] a duration of a transfer trip corresponding to the at least one transfer trip path;
[0158] The remaining ticket information of the public transportation used for the transfer trip corresponding to the at least one transfer trip path;
[0159] The time it takes for the user to travel from the location to the above starting point;
[0160] The time it takes for the user to travel from the above destination site to the destination specified by the user.
[0161] When scoring the transit itinerary path based on the above-mentioned real-time travel data, if the above-mentioned real-time travel data contains multiple data, a weight can be set for each of the multiple data, and the degree of compliance of the transit itinerary path with the user's travel needs can be evaluated based on the comprehensive data; then, the evaluation result can be mathematically quantified and converted into a scoring form, and finally, based on the weight of the multiple data, the scores corresponding to the data are weighted calculated to obtain the final score corresponding to the transit itinerary path.
[0162] The following will explain in detail through an example of a specific graph data.
[0163] It should be emphasized that in this example, the scenario of traveling by public transportation will be used as an example.
[0164] See also Figure 5 , Figure 5 This is a schematic diagram of graph data constructed based on a full amount of transit trip path data as shown in this specification.
[0165] like Figure 5 As shown, Figure 5 The graph data shown may be real-time graph data constructed based on a real-time graph database, and may include three types of nodes and two types of edges. The three types of nodes are railway station nodes ( Figure 5 The white dots in the figure), airport nodes ( Figure 5 The black dots in the figure), and the bus station nodes ( Figure 5 The two types of edges are transfer edges (i.e. the first type of edges) and train edges (i.e. the second type of edges).
[0166] The transfer edge is specifically used to represent the transfer relationship between stations of the same type or different types; the train number edge is used to represent the number of public transportation used for transfer trips between stations of the same type.
[0167] in, Figure 5 The information recorded in the attribute information of the nodes in the table can be uniformly formatted in the following table:
[0168]
[0169] It should be noted that, in actual applications, the information recorded in the attribute information of the node can be flexibly adjusted based on the above table.
[0170] Figure 5 The information recorded in the attribute information of the transfer edge in can be uniformly formatted in the following table:
[0171]
[0172] It should be noted that, in actual applications, the information recorded in the attribute information of the transfer edge can also be flexibly adjusted based on the above table.
[0173] Figure 5 The information recorded in the attribute information of the train number edge in can be uniformly formatted in the following table:
[0174]
[0175] It should be noted that, in actual applications, the information recorded in the attribute information of the train number edge can also be flexibly adjusted based on the above table.
[0176] In addition, the real-time travel data recorded in the attribute information of the train number edge can also be updated in real time based on the real-time update mechanism supported by the above-mentioned real-time graph database; wherein, the real-time travel data recorded in the attribute information of the train number edge can specifically include the information recorded in the price_info and price_info fields in the above table. In actual applications, the information recorded in the price_info and price_info fields in the above table can be updated in real time based on the real-time update mechanism supported by the above-mentioned real-time graph database, and the timestamp corresponding to the update time can be recorded in the updatetime field.
[0177] For example, taking the GeaBase graph database as the above-mentioned real-time graph database, the GeaBase graph database can support real-time updates of the attributes of the edges of the graph data in a message-based form. Therefore, in this case, when the real-time travel data recorded in the attribute information of the edges in the graph data changes, the attributes of the edges of the graph data can be asynchronously updated in real time based on the messages supported by the GeaBase graph database. Among them, the specific format of the messages supported by the GeaBase graph database can be adapted with reference to the format of the information recorded in the attribute information of the train number edges, and will not be described in detail in this specification.
[0178] Please continue to see Figure 5 , assuming the user enters the starting point as Figure 5 The departure city in , the destination entered by the user is Figure 5 The destination city in Figure 5The departure city includes three stations: Railway Station 1, Airport 1 and Railway Station 2, and the destination city includes three stations: Bus Station 1, Railway Station 5 and Airport 4.
[0179] Figure 5 The transit routes from the departure city to the destination city shown can include 12 in total:
[0180] The first line: Railway Station 2-Train No. 1-Railway Station 3-Transfer 1-Bus Station 3-Bus Station 1
[0181] The first line: Railway Station 2-Train No. 2-Railway Station 3-Transfer 1-Bus Station 3-Bus Station 1
[0182] Article 3: Railway Station 2-Train No. 3-Railway Station 3-Transfer 1-Bus Station 3-Bus Station 1
[0183] Article 4: Railway Station 2 - Train No. 1 - Railway Station 3 - Transfer 2 - Airport 3 - Flight 2 - Airport 4
[0184] Article 5: Railway Station 2 - Train No. 2 - Railway Station 3 - Transfer 2 - Airport 3 - Flight 2 - Airport 4
[0185] Article 6: Railway Station 2 - Train No. 3 - Railway Station 3 - Transfer 2 - Airport 3 - Flight 2 - Airport 4
[0186] Article 7: Railway Station 2 - Train No. 1 - Railway Station 3 - Transfer 2 - Airport 3 - Flight 3 - Airport 4
[0187] Article 8: Railway Station 2 - Train No. 2 - Railway Station 3 - Transfer 2 - Airport 3 - Flight 3 - Airport 4
[0188] Article 9: Railway Station 2 - Train No. 3 - Railway Station 3 - Transfer 2 - Airport 3 - Flight 3 - Airport 4
[0189] Article 10: Airport 1-Flight 1-Airport 2-Transfer 3-Railway Station 4-Train No. 4-Railway Station 5
[0190] Article 11: Airport 1-Flight 1-Airport 2-Transfer 3-Railway Station 4-Train No. 5-Railway Station 5
[0191] Article 12: Airport 1-Flight 1-Airport 2-Transfer 4-Bus Terminal 2-Bus No. 1-Bus Terminal 1
[0192] Before performing a real-time graph search in the above graph data and during the real-time graph search in the above graph data, the invalid edges in the above 12 transit travel paths can be pruned based on the asynchronous pruning strategy and the real-time pruning strategy shown in the above embodiments, respectively, so as to obtain the complete transit travel paths for the user from the departure city to the destination city.
[0193] Then, all the obtained transfer routes can be scored respectively, and after being sorted based on the obtained scores, they can be output and displayed to the user for the user to choose.
[0194] It should be emphasized that the above examples are only illustrative of the scenario of traveling by public transportation. In actual applications, the technical solutions disclosed in this specification can obviously also be applied to other travel scenarios besides traveling by public transportation.
[0195] For example, the technical solution disclosed in this specification can also be applied to the scenario of self-driving travel with transfers between multiple cities. In this scenario, the sites represented by the nodes in the graph data may specifically include toll stations, rest stops, gas stations, etc.; the edges in the graph data can specifically be used to represent the transfer relationship of users traveling between different sites; the above-mentioned real-time travel data may specifically include real-time traffic information related to the transfer trip, etc.
[0196] In the above embodiment, by using graph data to store the full amount of transit itinerary path data and performing real-time graph search in the graph data to query the transit itinerary path that meets the user's travel needs, on the one hand, the performance advantage of graph data in complex query scenarios can be utilized to improve the query efficiency when querying for transit itineraries that meet the user's travel needs.
[0197] For example, when performing complex queries such as transit path queries in traditional relational databases, multiple join operations are usually required, which may become extremely time-consuming on large data sets. In graph databases, since graph data itself is a data structure organized around relationships, when performing complex queries such as transit path queries, it is only necessary to traverse and search along the edges between nodes on the graph structure. Such join operations are usually unnecessary or implicitly completed, which can significantly reduce query overhead and improve query efficiency.
[0198] On the other hand, the storage characteristics of graph data can be used to avoid storage redundancy when storing the full amount of transit trip path data.
[0199] For example, since there may be some repeated stops in different transfer routes, if a traditional database is used to store the full amount of transfer route data, the data related to these repeated stops will inevitably need to be stored repeatedly in different data records, resulting in storage redundancy. If graph data is used to store the full amount of transfer route data, the data related to these repeated stops only needs to be stored once as a node in the graph data, and different transfer route data can be distinguished by constructing different edges passing through the node, thus avoiding redundant storage.
[0200] Corresponding to the embodiments of the aforementioned method, this specification also provides embodiments of an apparatus, an electronic device, and a storage medium.
[0201] Figure 6 is a schematic structural diagram of an electronic device provided by an exemplary embodiment. Figure 6 At the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 610, and may also include other required hardware. One or more embodiments of this specification may be implemented based on software, such as the processor 602 reading the corresponding computer program from the non-volatile memory 610 into the memory 608 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0202] like Figure 7 As shown, Figure 7 is a block diagram of a transfer itinerary query device according to an exemplary embodiment of the present specification, and the device can be applied to Figure 6 In the electronic device shown in the figure, the technical solution of this specification is implemented. The device 700 includes:
[0203] The acquisition module 703 acquires the full amount of transit trip path data, and constructs the transit trip path data into graph data; wherein the nodes in the graph data represent stations; the edges in the graph data represent the transit relationship between stations; and the attribute information of the edges records the itinerary information of the transit trip corresponding to the transit relationship;
[0204] A search module 704, in response to a query request input by a user, performs a real-time graph search in the graph data to search for at least one transit itinerary path that meets the travel needs of the user;
[0205] The output module 705 outputs and displays the at least one transit itinerary path found and at least part of the itinerary information recorded in the attribute information of the edge included in the at least one transit itinerary path to the user.
[0206] Accordingly, the present specification also provides an electronic device, which includes a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement the steps in all the method flows described above.
[0207] Accordingly, the present specification also provides a computer-readable storage medium on which executable computer program instructions are stored; wherein, when the instructions are executed by a processor, the steps in all the method flows described above are implemented.
[0208] Accordingly, the present specification also provides a computer program product having executable computer program instructions stored thereon; wherein, when the computer program instructions are executed by a processor, the steps in all the method flows described above are implemented.
[0209] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, it is not excluded that with the development of computer technology in the future, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0210] Although one or more embodiments of the present specification provide method operation steps as described in the embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The terms "include", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or device. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or device including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any specific order.
[0211] For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing one or more of the present specification, the functions of each module can be implemented in the same or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0212] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0213] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0214] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0215] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0216] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0217] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0218] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0219] One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0220] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples without contradiction.
[0221] The above description is only an example of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included in the scope of the claims.
Claims
1. A method for querying a transit itinerary, the method comprising: Acquire a full amount of transfer trip path data, and construct the transfer trip path data into graph data; wherein the nodes in the graph data represent stations; the edges in the graph data represent transfer relations between stations; the attribute information of the edges records the travel information of the transfer trip corresponding to the transfer relation; the travel information contains real-time travel data related to the transfer trip; the edges in the graph data include a first type of edge for representing a transfer relation between stations of the same type or different types; and a second type of edge for representing a travel relation between stations of the same type; wherein the attribute information of the first type of edge records the transfer information of the transfer trip corresponding to the transfer relation; the attribute information of the second type of edge records the real-time travel data of the transfer trip corresponding to the travel relation; In response to a query request input by a user, based on a preset real-time pruning strategy, invalid edges in the graph data are determined, and the determined invalid edges are pruned; wherein, the determination of the invalid edges in the graph data based on the preset real-time pruning strategy and the pruning of the determined invalid edges include: traversing the second-class edges in the graph data, and determining whether the transfer trip corresponding to the second-class edges can travel normally based on the real-time travel data recorded in the attribute information of the traversed second-class edges; if not, pruning the second-class edges as invalid edges; or, traversing the second-class edges in the graph data, and predicting whether the transfer trip corresponding to the second-class edges can travel normally within a preset time period in the future based on the real-time travel data recorded in the attribute information of the traversed second-class edges; if not, pruning the second-class edges as invalid edges; A real-time graph search is performed in the graph data after pruning to query at least one transit trip path that meets the travel needs of the user; the at least one transit trip path that is queried, and at least part of the trip information recorded in the attribute information of the edges included in the at least one transit trip path are output and displayed to the user.
2. The method according to claim 1, wherein the graph data is real-time graph data constructed based on a real-time graph database; and the at least part of the information is the real-time travel data contained in the trip information; The method further comprises: In response to a change in the real-time travel data recorded in the attribute information, the real-time travel data recorded in the attribute information of the edge is updated in real time based on a real-time update mechanism supported by the graph database.
3. The method according to claim 2, wherein the graph data includes multiple types of sites; The real-time travel data recorded in the attribute information of the edge is updated in real time, including: The real-time travel data recorded in the attribute information of the second-type edge is updated in real time.
4. The method as claimed in claim 3, wherein the graph data includes multiple types of public transportation stations; the real-time travel data includes the schedule information of the public transportation vehicles used for the transfer journey; the travel relationship is represented by the schedule of the public transportation vehicles used for the transfer journey between stations of the same type; and the attribute information of the second type of edge records the schedule information of the public transportation vehicles used for the transfer journey between stations of the same type.
5. The method of claim 3, wherein the query request includes query data for indicating a starting point and a destination that meet the travel needs of the user; In response to a query request input by a user, a real-time graph search is performed in the graph data to query at least one transit itinerary path that meets the travel needs of the user, including: In response to a query request input by a user, determining a starting site corresponding to the starting point on the graph data, and a destination site corresponding to the destination on the graph data; The starting site is used as the starting point of the graph search, and real-time graph traversal is iteratively performed on the graph data to search for all edges from the starting site to the destination site, and at least one transit trip path from the starting site to the destination site is generated based on all the searched edges.
6. The method of claim 5, taking the starting station as the starting point of the graph search, iteratively performing real-time graph traversal on the graph data to search for all edges from the starting station to the destination station, and generating at least one transit trip path from the starting station to the destination station based on all the searched edges, comprising: If the starting point corresponds to multiple starting stations on the graph data, and the destination also corresponds to multiple destination stations on the graph data, the multiple starting stations are respectively used as starting points of the graph search, and real-time graph traversal is performed on the graph data in parallel to search for all edges from each of the multiple starting stations to each of the multiple destination stations, and based on all the searched edges, multiple transit trip paths are generated from each of the multiple starting stations to each of the multiple destination stations.
7. The method of claim 5, in response to a query request input by a user, before performing a real-time graph search in the graph data to query at least one transit trip path that meets the travel needs of the user, further comprising: Based on a preset asynchronous pruning strategy, invalid edges in the graph data are determined, and pruning is performed on the determined invalid edges.
8. The method of claim 7, wherein the transfer information recorded in the attribute information of the first-type edge includes the transfer time of the transfer trip corresponding to the transfer relationship; the asynchronous pruning strategy includes pruning the first-type edge whose transfer time reaches a preset threshold; Based on a preset asynchronous pruning strategy, determining invalid edges contained in the graph data, and performing pruning processing on the determined invalid edges, including: Traversing the first type of edges in the graph data, and determining whether the transfer time included in the transfer information recorded in the attribute information of the traversed first type of edges reaches a preset threshold; If so, the first type of edge is treated as an invalid edge and pruned.
9. The method of claim 8, wherein the real-time travel data recorded in the attribute information of the second type of edge includes the duration of the transfer trip corresponding to the travel relationship; the asynchronous pruning strategy includes pruning the edges in the transfer path whose total duration reaches a preset threshold; Based on a preset asynchronous pruning strategy, determining invalid edges contained in the graph data, and performing pruning processing on the determined invalid edges, including: Traversing the transfer trip path in the graph data, calculating the total consuming time of the transfer trip path based on the transfer time contained in the transfer information recorded in the attribute information of the first type of edge contained in the transfer trip path and the consuming time contained in the real-time travel data recorded in the attribute information of the second type of edge contained in the transfer trip path, and determining whether the total consuming time reaches a preset threshold; If so, the edge in the transit path is treated as an invalid edge and pruned.
10. The method according to claim 1, wherein the real-time travel data includes the schedule information of the public transportation used for the transfer trip; the travel relationship is represented by the schedule information of the public transportation used for the transfer trip between the same type of stations; the attribute information of the second type of edge records the schedule information of the public transportation used for the transfer trip between the same type of stations; the schedule information includes the schedule identifier; and the remaining ticket information of the schedule corresponding to the schedule identifier; Determining whether a transfer trip corresponding to the second-type edge can be traveled normally based on the real-time travel data recorded in the attribute information of the traversed second-type edge includes: Based on the remaining ticket information contained in the flight information recorded in the attribute information of the traversed second-type edge, determine whether the transfer trip corresponding to the second-type edge has no ticket; if so, determine that the transfer trip corresponding to the second-type edge cannot travel normally; or, Based on the remaining ticket information contained in the flight information recorded in the attribute information of the traversed second-type edge, it is predicted whether there are no tickets for the transfer trip corresponding to the second-type edge within a preset time in the future; if so, it is determined that the transfer trip corresponding to the second-type edge cannot be traveled normally.
11. The method according to claim 7, determining invalid edges in the graph data based on a preset real-time pruning strategy, and pruning the determined invalid edges, comprising: If the starting place corresponds to multiple starting sites on the graph data, determine a target starting site that is outside the administrative area corresponding to the starting place among the multiple starting sites, and prune the edge where the target starting site is located in the graph data as an invalid edge; If the destination corresponds to multiple destination sites on the graph data, determine a target destination site among the multiple destination sites that is outside the administrative area corresponding to the destination, and prune the edge where the target destination site is located in the graph data as an invalid edge.
12. The method according to claim 7, determining invalid edges in the graph data based on a preset real-time pruning strategy, and pruning the determined invalid edges, comprising: Obtaining at least one optimal transfer station from the starting point to the destination that is calculated in advance; The sites in the graph data are traversed, and the edges where the traversed sites except the at least one optimal transfer site are located are treated as invalid edges for pruning.
13. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.
14. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Large traffic searching method and system
CN103412934A
Flight query method, device and system
CN105630979A
Method for providing travel route transfer scheme
CN118427402A