Fast space-time road network k-function graph generation method, system, terminal and storage medium based on range tree and prefix count array
By constructing a range tree and a prefix counting array, the spatiotemporal road network K-function is calculated, solving the problem of high time complexity in existing technologies and realizing the ability to quickly generate spatiotemporal road network K-function graphs.
Patent Information
- Application Number
- CN202511485741.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-17
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2045-10-17
AI Technical Summary
Existing technologies suffer from excessive time complexity when calculating the K-function of spatiotemporal road networks, resulting in excessive resource pressure during the computation process. This makes it impossible to support large-scale datasets and generate a large number of spatiotemporal road network K-function graphs with spatial threshold-time threshold pairs.
A method based on range tree and prefix counting array is adopted. By constructing range tree and prefix counting array, the point-edge counting function of each edge is calculated, and the K function value with low cost is selected to construct the spatiotemporal K function graph of the expressway network.
It significantly reduces time complexity while maintaining space complexity and accuracy, and is capable of handling spatiotemporal road network K-function graph generation for large-scale datasets and multiple spatial threshold-time threshold pairs.
Smart Images

Figure CN120950620B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of geographic information analysis, and particularly relates to a fast space-time road network K function graph generation method, system, terminal and computer readable storage medium based on range tree and prefix count array. BACKGROUND
[0002] The road network K function is an important tool of geographic information system, however, when this tool is used in the field of traffic science, misleading results may be generated due to the fact that the road network K function does not consider the occurrence time of each location data point.
[0003] The prior art methods can be simply extended to accelerate the calculation of the space-time road network K function and the generation of the space-time road network K function graph, but the time complexity of these methods is still very high, and cannot support large-scale data sets and generate a large number of space threshold-time threshold pairs of space-time road network K function graphs.
[0004] Therefore, the prior art still needs to be improved and developed. SUMMARY
[0005] The main purpose of the present application is to provide a fast space-time road network K function graph generation method, system, terminal and computer readable storage medium based on range tree and prefix count array, which aims to solve the problem of high time complexity in calculating the space-time road network K function in the prior art, resulting in excessive resource pressure in the calculation process.
[0006] To achieve the above purpose, the present application provides a fast space-time road network K function graph generation method based on range tree and prefix count array, which comprises the following steps:
[0007] Obtain the edge set, space threshold and time threshold in the target road network, construct a range tree according to each edge, calculate the shortest distance from each point of the current edge to the nodes of other edges, and iteratively calculate each range tree according to the space threshold and the time threshold to obtain the first point-edge count function corresponding to each edge, and calculate the first space-time road network K function according to the first point-edge count function;
[0008] Obtain the target road network, space threshold set and time threshold set, calculate the shortest distance from each point of the current edge to the nodes of other edges, construct a prefix count array according to each edge in the edge set, calculate a plurality of second point-edge count functions of the prefix count array, and calculate the corresponding second space-time road network K function according to each second point-edge count function;
[0009] The first cost model and the second cost model are used to determine the cost of the first space-time road network K function and the second space-time road network K function of each edge, and the smaller cost is selected as the K function value of the edge, and the fast space-time K function graph of the target road network is constructed according to all the K function values.
[0010] In the application, the edge set, the space threshold and the time threshold in the target road network are obtained, the range tree is constructed according to each edge, the shortest distance of each point of the current edge to the node of other edges is calculated, the first point-edge counting function corresponding to each edge is obtained by iteratively calculating each range tree according to the space threshold and the time threshold, and the first space-time road network K function is calculated according to the first point-edge counting function; the target road network, the space threshold set and the time threshold set are obtained, the shortest distance of each point of the current edge to the node of other edges is calculated, the prefix counting array is constructed according to each edge in the edge set, the second point-edge counting function of the prefix counting array is calculated, and the corresponding second space-time road network K function is calculated according to each second point-edge counting function; the first space-time road network K function and the second space-time road network K function of each edge are determined by the constructed first cost model and the second cost model, and the smaller cost is selected as the K function value of the edge, and the fast space-time K function graph of the target road network is constructed according to all the K function values. The application selects different data structures for calculation according to different calculation problems, significantly reduces the time complexity while ensuring the space complexity and accuracy. BRIEF DESCRIPTION OF DRAWINGS
[0011] Figure 1 is a flowchart of a preferred embodiment of the fast space-time road network K function graph generation method based on range trees and prefix counting arrays of the application;
[0012] Figure 2 is an example graph of a road network K function of a preferred embodiment of the fast space-time road network K function graph generation method based on range trees and prefix counting arrays of the application;
[0013] Figure 3 is a schematic diagram of a same-space distribution-different-time distribution position data set of a preferred embodiment of the fast space-time road network K function graph generation method based on range trees and prefix counting arrays of the application;
[0014] Figure 4 is a space-time road network K function graph of a preferred embodiment of the fast space-time road network K function graph generation method based on range trees and prefix counting arrays of the application;
[0015] Figure 5 is a first response time change graph of a preferred embodiment of the fast space-time road network K function graph generation method based on range trees and prefix counting arrays of the application;
[0016] Figure 6 is a second response time variation graph of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0017] Figure 7 is a third response time variation graph of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0018] Figure 8 is a projection schematic of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0019] Figure 9 is a first EAR method schematic of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0020] Figure 10 is a second EAR method schematic of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0021] Figure 11 is a third EAR method schematic of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0022] Figure 12 is a fourth EAR method schematic of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0023] Figure 13 is a fourth response time variation graph of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0024] Figure 14 is a fifth response time variation graph of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0025] Figure 15 is a sixth response time variation graph of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0026] Figure 16 is a first MTS method schematic of the preferred embodiment of the fast space-time road network K-function graph generation method based on range trees and prefix count arrays of the present invention;
[0027] Figure 17is a schematic diagram of a second MTS method of a preferred embodiment of the present application's fast space-time road network K-function graph generation method based on range trees and prefix count arrays;
[0028] Figure 18 is a schematic diagram of a third MTS method of a preferred embodiment of the present application's fast space-time road network K-function graph generation method based on range trees and prefix count arrays;
[0029] Figure 19 is a schematic diagram of a fourth MTS method of a preferred embodiment of the present application's fast space-time road network K-function graph generation method based on range trees and prefix count arrays;
[0030] Figure 20 is a first space overhead schematic diagram of a preferred embodiment of the present application's fast space-time road network K-function graph generation method based on range trees and prefix count arrays;
[0031] Figure 21 is a second space overhead schematic diagram of a preferred embodiment of the present application's fast space-time road network K-function graph generation method based on range trees and prefix count arrays;
[0032] Figure 22 is a structure diagram of a preferred embodiment of the present application's fast space-time road network K-function graph generation system based on range trees and prefix count arrays;
[0033] Figure 23 is a structure diagram of a preferred embodiment of the present application's terminal. DETAILED DESCRIPTION
[0034] In order to make the objectives, technical solutions and advantages of the present application clearer and more explicit, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0035] The fast space-time road network K-function graph generation method based on range trees and prefix count arrays described in the preferred embodiment of the present application, as shown in Figure 1 , the fast space-time road network K-function graph generation method based on range trees and prefix count arrays includes the following steps:
[0036] Before this, the road network K-function is an important tool of geographic information system, which can be applied to various fields (in the embodiments disclosed in the present application, including but not limited to traffic science, social science), and this tool is to calculate the number of data points in each data point within the road network space threshold in a preset size data set (where each data point is in the target road network, and the target road network has an edge set and a point set). As shown, Figure 2 (a) in Figure 2 shows the distance data point , data point , data point , data point is a spatial threshold , the point set of , , and empty set, so the K function value is 2+2+2+0=6. As can be seen from (b) in Figure 2 , the distance between data point , data point , data point and data point is a spatial threshold , so the point set of each is empty set, so the K function value is 0. The greater the K function value, the more the data set tends to have the property of aggregation, and vice versa.
[0037] However, the road network K function does not take into account the time of occurrence of each location data point, so using this tool can produce misleading results. As shown in Figure 3 , two examples of location data sets are shown. Due to their identical spatial distribution, the K function values of the two data sets are the same (both 6). However, as can be seen from Figure 3 , the times of the blue data points are relatively close, so to a large extent, these data points have the characteristic of aggregation (as shown in (a) in Figure 3 ). In contrast, the times of the red data points are quite different, indicating that these data points may be just coincidences (as shown in (b) in Figure 3 ).
[0038] In order to study the properties of a spatio-temporal data point set, those skilled in the art use a spatio-temporal road network K function graph (as shown in Figure 4 ), given M spatial thresholds and T temporal thresholds, and randomly generate L spatio-temporal data point sets of size n, then calculate the spatio-temporal road network K function of the spatio-temporal data point set for each spatial-temporal threshold pair, and the maximum and minimum spatio-temporal road network K functions of the L data sets; although these methods can be simply extended to be used to accelerate the calculation of the spatio-temporal road network K function and the generation of the spatio-temporal road network K function graph, the time complexity of these methods is still very high, so they cannot support large-scale data sets and generate a spatio-temporal road network K function graph of a large number of spatial threshold-temporal threshold pairs.
[0039] Based on the above problems, the present application proposes to establish a range tree data structure (EAR, method based on range tree data structure) on each edge of the road network, and based on this structure, a method for calculating the spatio-temporal road network K function is proposed to reduce the time complexity of calculating the spatio-temporal road network K function while ensuring the spatial complexity and accuracy.
[0040] Step S10, obtaining the edge set in the target road network, the space threshold and the time threshold, constructing the range tree according to each edge, calculating the shortest distance from each point of the current edge to the nodes of other edges, performing iterative calculation on each range tree according to the space threshold and the time threshold, obtaining the first point-edge counting function corresponding to each edge, and calculating the first space-time road network K function according to the first point-edge counting function.
[0041] Specifically, the edge set of the target road network, the space threshold and the time threshold are obtained, the space-time road network K function of the target road network is initialized to 0, the range tree is constructed according to the point set of each edge, and the shortest path distance between each point of each edge and two nodes on other edges is iteratively calculated for each edge.
[0042] ;
[0043] ;
[0044] wherein, the shortest path distance from to , the shortest path distance from to , the shortest path distance from to , the shortest path distance from to , denotes the target road network, denotes the first data point of the edge in the second iterative calculation, denotes the left node of the edge in the third iterative calculation, denotes the right node of the edge in the third iterative calculation, denotes the left node of the edge in the first iterative calculation, denotes the right node of the edge in the first iterative calculation, denotes the shortest path distance from to , denotes the shortest path distance from to , denotes the minimum value, denotes the shortest path distance from to , denotes the shortest path distance from to , the shortest path distance of each edge; calculating a first point-edge counting function corresponding to each edge according to the relationship between each shortest path distance on the edge and the space threshold, and calculating a first space-time road network K function according to the first point-edge counting function.
[0045] wherein, between the calculations, first, the space-time road network K function is decomposed, and the expression of decomposing the space-time road network K function under the premise of setting its space threshold and time threshold is as follows:
[0046] ;
[0047] Therefore, the process of accelerating the calculation of the space-time road network K function can be converted into the process of accelerating the calculation of the expression .
[0048] Specifically, first, the K value is initialized to 0, and a range tree is constructed for the point set on each edge in the target road network, and then an iterative calculation is performed for each edge , wherein and are the left node and the right node of the edge , respectively:
[0049] (1) Iterating each edge to calculate the distance between the nodes of the edge from the left node and the right node to other edges:
[0050] ;
[0051] wherein, denotes the distance value between the node and the node , and denotes the node in the road network, denotes the distance between the node and the node ;
[0052] (2) Iterating each data point on the edge :
[0053] First, considering each edge , the shortest path distance between the nodes (i.e. and ) of the current edge to the two nodes (i.e. and ) of the other edge is iteratively calculated, and then according to the two shortest path distances, a first point-edge counting function can be calculated, and then the first space-time road network K function is assigned to the sum of the current K value after iteration and the first point-edge counting function, and the process of the next iteration calculation (i.e. the calculation of the other edge ) is entered.
[0054] wherein, in the process of entering the next iteration calculation, the values saved in the first point-edge counting function and the second point-edge counting function need to be cleared first and to save the distance between the nodes of other edges and other nodes in the next iteration calculation process; when the iteration calculation of all edges is completed, the returned K value is the value of the space-time road network K function.
[0055] wherein, the present application discloses a plurality of embodiments, which show the response time when calculating the single space-time road network K function: as shown in Figure 5 , the response time change is shown when the fixed time threshold is 7 days and the space threshold is changed; as shown in Figure 6 , the response time change is shown when the fixed space threshold is 1000 meters and the time threshold is changed; as shown in Figure 7 , the response time change is shown when the fixed space threshold is 1000 meters, the fixed time threshold is 7 days, and the data set size is changed, wherein RQS represents range-query-based solution, and SPS represents shortest-path-sharing solution.
[0056] Further, all data points on each of the edges are mapped to a two-dimensional plane to obtain a space-time point set, wherein each space-time point pair in the space-time point set comprises the position and timestamp of the space-time point pair; if it is judged that all the shortest path distances on the mapped edge corresponding to the edge (in other embodiments of the present application, sometimes referred to as other edges, not the current edge or the mapped edge corresponding to the current edge) are greater than the space threshold, the first point-edge counting function of the current edge is 0; if it is judged that the shortest path distance corresponding to the left node of the current iteration calculation is not greater than the space threshold, and the shortest path distance corresponding to the right node is greater than the space threshold, the two-dimensional range counting query value of the first preset range is searched on the two-dimensional plane, and the first point-edge counting function of the current edge is defined as the two-dimensional range counting query value to calculate the first point-edge counting function:
[0057] ;
[0058] wherein, represents the timestamp of , represents the time threshold, represents the space threshold, represents any data point within the first preset range, wherein the shortest path distance corresponding to the left node is not greater than the space threshold, and the shortest path distance corresponding to the right node is greater than the space threshold, denotes a timestamp, denotes a timestamp, to ; if it is judged that the shortest path distance corresponding to the left node of the current iteration calculation is greater than the space threshold, and the shortest path distance corresponding to the right node is not greater than the space threshold, a two-dimensional range count query value of a second preset range is searched on the two-dimensional plane, and the first point-edge count function of the current edge is defined as the two-dimensional range count query value to calculate the first point-edge count function:
[0059] ;
[0060] wherein, denotes a timestamp, to ; if it is judged that the shortest path distance corresponding to the left node and the right node of the current iteration calculation are both not greater than the space threshold, the first point-edge count function is calculated according to the relationship between the shortest path distance corresponding to the left node and the right node and the space threshold; wherein the expression of the first point-edge count function is:
[0061] ;
[0062] wherein, denotes a first point-edge count function, and both denote an index of a position data set, denotes an indicator function, denotes a position data set, denotes a mapping edge, denotes a position data set on of the current iteration calculation, denotes a shortest path distance, to , denotes a shortest time, to ; the first space-time road network K function is calculated according to the first point-edge count function:
[0063] ;
[0064] wherein, denotes a first space-time road network K function, denotes an edge set.
[0065] wherein, as shown in Figure 8 , on All points on the line can be projected onto a two-dimensional (time-distance) plane, when the time complexity is obtained and After that, the first point-edge counting function can be calculated according to various conditions respectively, so as to realize the reduction of time complexity; wherein, The fifth data point, data point , data point , data point , data point and data point The corresponding time stamp is , , , and The shortest path distance of node to these data points is , , , and .
[0066] Among them, The first data point. When and are greater than the space threshold, the first point-edge counting function can be directly set to 0; as shown in Figure 9 (wherein, ), when is not greater than the space threshold, and is greater than the space threshold, the first point-edge counting function is equal to finding the two-dimensional range counting query of the first preset range on the two-dimensional (time, distance) plane; as shown in Figure 10 (wherein, ), when is greater than the space threshold, and is not greater than the space threshold, the first point-edge counting function is equal to finding the two-dimensional range counting query of the second preset range on the two-dimensional (time, distance) plane.
[0067] Further, when the relationship between the shortest path distance corresponding to the left node and the right node and the space threshold satisfies the first condition, the two-dimensional range counting query value of the third preset range is found on the two-dimensional plane, and the first point-edge counting function of the current edge is defined as the two-dimensional range counting query value, so as to calculate the first point-edge counting function:
[0068] ;
[0069] ;
[0070] ;
[0071] wherein, represents the first condition; when the relationship between the shortest path distances corresponding to the left node and the right node respectively and the space threshold satisfies the second condition, a two-dimensional range count query value of a fourth preset range is searched on the two-dimensional plane, and the first point-edge count function of the current edge is defined as the two-dimensional range count query value to calculate the first point-edge count function:
[0072] ;
[0073] ;
[0074] wherein, represents the second condition.
[0075] wherein, when and are both not greater than the space threshold, two cases need to be considered:
[0076] As shown in Figure 11 , when , the first point-edge count function is equal to searching a two-dimensional range count query value of a third preset range on the two-dimensional plane; as shown in Figure 12 , when , the first point-edge count function is equal to searching a two-dimensional range count query value of a fourth preset range on the two-dimensional plane.
[0077] Step S20, acquiring the target road network, a set of space thresholds and a set of time thresholds, calculating the shortest distance from each point of the current edge to the nodes of other edges, constructing a prefix count array according to each edge in the edge set, calculating a plurality of second point-edge count functions of the prefix count array, and calculating a corresponding second space-time road network K function according to each second point-edge count function.
[0078] wherein, in another embodiment of the present disclosure, when generating the space-time road network K function graph, it is necessary to calculate a space threshold-time threshold pair of space-time road network K functions for each data set, wherein represents the index of a space threshold, represents the index of a time threshold, and respectively represent the number of space threshold and time threshold. Therefore, the present application uses a method (MTS) based on a prefix count array data structure shared by multiple thresholds, and uses the prefix count array data structure to calculate the problem of generating space-time road network K function.
[0079] Specifically, the target road network given by the user, the space threshold set and the time threshold set are obtained, and the initial value of the space-time road network K function of the target road network is set, the shortest distance from each point of the current edge to the nodes of other edges is calculated for each edge in the edge set; a prefix count array is constructed according to all space thresholds in the space threshold set and all time thresholds in the time threshold set, wherein the prefix count array includes multiple time-space threshold pairs; for each edge in the target road network, the shortest path distance between each data point and all nodes on other edges is calculated, the second point-edge count function of all time-space threshold pairs is iteratively calculated according to all the shortest path distances, and the second space-time road network K function is calculated according to the second point-edge count function, until the second space-time road network K function of each edge is calculated.
[0080] Wherein, first define the data set in the target road network, the space threshold set, the time threshold set and the data point set of each edge in the road network (wherein, represents the index of the data point set), so as to set the space-time road network K function of the target road network, and initialize to 0.
[0081] Further, considering each edge , it is iteratively calculated:
[0082] (1), respectively, the distance from the node and to the node on other edges is obtained;
[0083] (2), considering each data point set, in each data point set, each data point on the edge is iteratively calculated again, while considering the nodes (i.e. and ) of each other edge , the shortest path distance from each data point to the left and right nodes is obtained, and the second point-edge count function of all space-time threshold pairs is calculated according to the two shortest path distances respectively, and the second point-edge count function is assigned to the K value of the corresponding space-time threshold pair , and then the next calculation process is entered.
[0084] Wherein, as similar to the above steps, in the process of entering the next iterative calculation, the calculated nodes need to be cleared first and The distance to other nodes is used to store the distance between other edge nodes in the next iteration calculation process; after the iteration calculation of all edges is completed, the returned K value is the K function value of the spatiotemporal road network.
[0085] This invention discloses several embodiments demonstrating the response time in calculating the K-function problem of generating spatiotemporal road networks: such as... Figure 13 The diagram illustrates how changing the size of the random dataset affects the response time when both the time and spatial thresholds are set to 4. Figure 14 The diagram illustrates how changing the number of spatial thresholds affects response time when the number of random datasets is fixed at 3 and the number of time thresholds is set to 4. Figure 15 As shown, this illustrates how changing the number of time thresholds affects the response time when the number of fixed random datasets is 3 and the number of spatial thresholds is 4.
[0086] Furthermore, if the shortest path distance between a data point and the left and right nodes of other edges is greater than the maximum spatial threshold, then the second point-edge counting function of all space-time threshold pairs of other edges is defined as 0; based on the relationship between the shortest path distance between the data point and the left node of other edges, the shortest path distance between the data point and the right node of other edges, and the maximum spatial threshold, different two-dimensional mesh structures are generated for all time-space threshold pairs, and the second point-edge counting function of each time-space threshold pair is calculated using the different two-dimensional mesh structures.
[0087] Among them, the maximum spatial threshold in the current iterative calculation process ,like and All greater than In the case of zero, the second point-edge counting function can be directly defined as 0; otherwise, it can be generated on a two-dimensional (time, distance) plane. The mesh structure, and a corresponding (size of) is created for this mesh structure. The prefix counting array structure is used to calculate the second point-edge counting function.
[0088] Specifically, such as Figure 16 As shown (where, , , ) showed when Not greater than ,and Greater than At that time, it is generated on a two-dimensional (time, distance) plane. The process of creating a grid structure; such as Figure 17 As shown (where, , , ), demonstrating when Greater than ,and Not greater than At that time, it is generated on a two-dimensional (time, distance) plane. The process of creating a grid structure.
[0089] Further, if the current time-space threshold pair meets a preset condition, a one-dimensional time grid structure and a corresponding one-dimensional prefix counting array are established; all generated spatial thresholds in the spatial threshold set are divided according to the one-dimensional prefix counting array to obtain two target spatial threshold sets; based on the two target spatial threshold sets, corresponding target prefix counting arrays are constructed on a two-dimensional plane, and a second point-edge counting function for each time-space threshold pair is calculated based on the two target prefix counting arrays; wherein, the preset condition is:
[0090] ;
[0091] in, Indicates the first A spatial threshold, Index representing the spatial threshold, express arrive The shortest path distance, express arrive The shortest path distance, express arrive The shortest path distance, Indicates the target road network. The edge number calculated in the second iteration is the first edge number. Data points, This represents the left node of the edge calculated in the third iteration. This represents the right node of the edge calculated in the third iteration.
[0092] Among them, for and All are not greater than In this case, we need to calculate two scenarios:
[0093] like Figure 18 As shown, this illustrates what happens when the preset conditions are not met (i.e., the formula above). Generate on a two-dimensional (time, distance) plane. The process of creating a grid structure;
[0094] When the preset conditions are met, such as Figure 19 As shown (where, , , , ),because and Increase sequentially (i.e., when...) Values (Maximum), there exists a minimum positive integer here. Make ,in Based on this, first establish a The mesh structure and its corresponding prefix counting array structure are then used to calculate the second vertex-edge counting function, where , , and for and In the case of failure to meet the preset conditions, the above-mentioned conditions shall apply (the following will be followed). Figure 18 In Replace with ), generating two on a two-dimensional (time, distance) plane. The network structure is determined, and corresponding prefix counting array structures are established for these two grid structures. Then, the second point-edge counting function is calculated based on these two network structures. After the iteration calculation is completed, the final second point-edge counting function is assigned to the second spatiotemporal road network K function of the current edge.
[0095] Step S30: Determine the cost of the first spatiotemporal road network K function and the second spatiotemporal road network K function of each edge through the constructed first cost model and second cost model, and select the edge with the smaller cost as the K function value of the edge, and construct the spatiotemporal K function graph of the target road network based on all the K function values.
[0096] In the embodiments disclosed in this invention, either a range tree (based on EAR) or a prefix counting array data structure (based on MTS) is selected to compute the point-edge counting function for all space-time threshold pairs. To select the best structure, for each data point set... In the middle, cost models for EAR and MTS are established for each edge respectively:
[0097] ;
[0098] ;
[0099] in, Represents the cost model of EAR. A cost model representing MTS.
[0100] For each data point set , the cost of calculating the space-time road network K function value in different ways on each edge is determined, and the value obtained by the method with smaller cost is selected as the space-time road network K function value on the edge.
[0101] Among them, for all the above cases, when using range tree to process two-dimensional range counting query, or the way of establishing prefix counting array structure, the present application proves in theory that the time complexity of processing single space-time road network K function problem and processing generated space-time road network K function graph problem is lower than that of the method in the prior art, while the space complexity is not increased; further, the present application also designs a structure selection method on each edge, and uses the selected structure to calculate the space-time road network K function of multiple thresholds (named EARTH). Compared with EAR and MTS, EARTH can achieve the lowest time complexity on the calculation problem of generating space-time road network K function graph. The theoretical results disclosed by the present application are shown in Table 1 as follows:
[0102] Table 1: Results of different accurate methods on the calculation problem of single space-time road network K function and the calculation problem of generating space-time road network K function graph
[0103]
[0104] Among them, , , , and are the number of data points of each data set, the number of edges of the road network, the number of random data sets, the time complexity of calculating the shortest path distance and the space complexity of calculating the shortest path distance.
[0105] The present application selects different data structures for calculation according to different calculation problems, significantly reduces the time complexity while ensuring that the space complexity and accuracy remain unchanged.
[0106] Among them, based on the method disclosed in the present application, the technical effect of 2.26 times-19.04 times faster than the existing method is realized on four large-scale data sets, and the space overhead is not greatly increased, as shown in Figure 20 , which shows the space overhead of calculating single space-time road network K function when the data set size is changed under the condition that the fixed space threshold is 1000 meters and the time threshold is 7 days; as shown in Figure 21 , which shows the space overhead of generating space-time road network K function graph when the number of random data sets is changed under the condition that the number of fixed space threshold and time threshold is 4.
[0107] Further, as shown inFigure 22 As shown, based on the above-mentioned fast spatiotemporal road network K-function graph generation method based on range tree and prefix counting array, the present invention also provides a fast spatiotemporal road network K-function graph generation system based on range tree and prefix counting array, wherein the fast spatiotemporal road network K-function graph generation system based on range tree and prefix counting array includes:
[0108] The single K-function calculation module 51 is used to obtain the edge set, spatial threshold and temporal threshold in the target road network, construct a range tree according to each edge, calculate the shortest distance from each point of the current edge to the nodes of other edges, perform iterative calculation on each range tree according to the spatial threshold and the temporal threshold to obtain the first point-edge counting function corresponding to each edge, and calculate the first spatiotemporal road network K-function according to the first point-edge counting function.
[0109] The K-function calculation module 52 is used to obtain the target road network, spatial threshold set and temporal threshold set, calculate the shortest distance from each point of the current edge to the nodes of other edges, construct a prefix counting array based on each edge in the edge set, calculate multiple second point-edge counting functions of the prefix counting array, and calculate the corresponding second spatiotemporal road network K-function based on each second point-edge counting function.
[0110] Cost optimization module 3 is used to determine the cost of the first spatiotemporal road network K function and the second spatiotemporal road network K function of each edge through the constructed first cost model and second cost model, and select the edge with the smaller cost as the K function value of the edge, and construct the spatiotemporal K function graph of the target road network based on all the K function values.
[0111] Furthermore, such as Figure 23 As shown, based on the above-mentioned method and system for generating fast spatiotemporal road network K-function graphs based on range trees and prefix counting arrays, the present invention also provides a terminal, which includes a processor 10, a memory 20 and a display 30. Figure 23 Only some of the terminal components are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0112] The memory 20 can be an internal storage unit of the terminal in some embodiments, such as a hard disk or a memory of the terminal. The memory 20 can also be an external storage device of the terminal in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the terminal. Further, the memory 20 can include both the internal storage unit and the external storage device of the terminal. The memory 20 is used to store application software and various data installed on the terminal, such as program codes of the terminal, etc. The memory 20 can also be used to temporarily store data that has been output or will be output. In an embodiment, the memory 20 stores a fast space-time road network K-function graph generation program based on a range tree and a prefix count array, which can be executed by the processor 10 to implement the fast space-time road network K-function graph generation method based on a range tree and a prefix count array in the present application.
[0113] The processor 10 can be a Central Processing Unit (CPU), a microprocessor or other data processing chip in some embodiments, which is used to run program codes stored in the memory 20 or process data, such as to execute the fast space-time road network K-function graph generation method based on a range tree and a prefix count array, etc.
[0114] The display 30 can be an LED display, a liquid crystal display, a touch liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, etc. in some embodiments. The display 30 is used to display information of the terminal and to display a visualized user interface. The components of the terminal communicate with each other through a system bus.
[0115] In an embodiment, the processor 10 implements the steps of the fast space-time road network K-function graph generation method based on a range tree and a prefix count array as described above when executing the fast space-time road network K-function graph generation program based on a range tree and a prefix count array in the memory 20.
[0116] The present application also provides a computer readable storage medium, wherein the computer readable storage medium stores a fast space-time road network K-function graph generation program based on a range tree and a prefix count array, which implements the steps of the fast space-time road network K-function graph generation method based on a range tree and a prefix count array as described above when executed by a processor.
[0117] In summary, the present application provides a fast space-time road network K function graph generation method based on range tree and prefix count array and related equipment, the method comprises: obtaining the edge set, the space threshold and the time threshold in the target road network, constructing a range tree according to each edge, calculating the shortest distance from each point of the current edge to the nodes of other edges, and iteratively calculating each range tree according to the space threshold and the time threshold, obtaining the first point-edge count function corresponding to each edge, and calculating the first space-time road network K function according to the first point-edge count function; obtaining the target road network, the space threshold set and the time threshold set, calculating the shortest distance from each point of the current edge to the nodes of other edges, constructing a prefix count array according to each edge in the edge set, calculating a plurality of second point-edge count functions of the prefix count array, and calculating the corresponding second space-time road network K function according to each second point-edge count function; judging the cost of the first space-time road network K function and the second space-time road network K function of each edge through the first cost model and the second cost model that have been constructed, and selecting the smaller one as the K function value of the edge, and constructing the fast road network space-time K function graph of the target road network according to all the K function values. The present application selects different data structures for calculation according to different calculation problems, significantly reduces the time complexity while ensuring the space complexity and accuracy.
[0118] It should be noted that in this paper, the term "include", "contain" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or terminal including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, method, article or terminal. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or terminal including the element.
[0119] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing relevant hardware (such as processor, controller, etc.) through a computer program, and the program can be stored in a computer readable computer readable storage medium, and the program can include the processes of the above-mentioned method embodiments when executed. The computer readable storage medium can be a memory, a disk, an optical disk, etc.
[0120] It should be understood that the application of the present application is not limited to the above examples, and those skilled in the art can improve or change according to the above description, and all these improvements and changes shall belong to the protection scope of the claims of the present application.
Claims
1. A method for generating a fast spatiotemporal road network K-function graph based on a range tree and a prefix counting array, characterized in that, The fast spatiotemporal road network K-function graph generation method based on range tree and prefix counting array includes: Obtain the edge set, spatial threshold, and temporal threshold in the target road network. Construct a range tree based on each edge. Calculate the shortest distance from each point on the current edge to nodes on other edges. Iterate through each range tree based on the spatial threshold and the temporal threshold to obtain the first point-edge counting function corresponding to each edge. Calculate the first spatiotemporal road network K function based on the first point-edge counting function. Obtain the target road network, spatial threshold set, and temporal threshold set; calculate the shortest distance from each point on the current edge to nodes on other edges; construct a prefix counting array based on each edge in the edge set; calculate multiple second point-edge counting functions for the prefix counting array; and calculate the corresponding second spatiotemporal road network K function based on each second point-edge counting function. The costs of the first and second spatiotemporal road network K functions for each edge are determined by the first and second cost models that have been constructed. The edge with the smaller cost is selected as the K function value. The spatiotemporal K function graph of the target road network is constructed based on all the K function values.
2. The method for generating a fast spatiotemporal road network K-function graph based on a range tree and a prefix counting array according to claim 1, characterized in that, The process of obtaining the edge set, spatial threshold, and temporal threshold in the target road network, constructing a range tree for each edge, calculating the shortest distance from each point on the current edge to nodes on other edges, iteratively calculating each range tree based on the spatial threshold and the temporal threshold to obtain the first point-edge counting function corresponding to each edge, and calculating the first spatiotemporal road network K function based on the first point-edge counting function, specifically includes: Obtain the edge set, spatial threshold, and temporal threshold of the target road network, and initialize the spatiotemporal road network K function of the target road network to 0; Construct a range tree based on the set of points for each edge, and for each edge, iteratively calculate the shortest path distance from each point on each edge to two nodes on other edges: ; ; in, express arrive The shortest path distance, express arrive The shortest path distance, express arrive The shortest path distance, express arrive The shortest path distance, Indicates the target road network. The edge number calculated in the second iteration is the first edge number. Data points, This represents the left node of the edge calculated in the third iteration. This represents the right node of the edge calculated in the third iteration. This represents the left node of the edge calculated in the first iteration. This represents the right node of the edge calculated in the first iteration. express arrive The shortest path distance, express arrive The shortest path distance, This indicates taking the minimum value. express arrive The shortest path distance, express arrive The shortest path distance; Based on the relationship between the shortest path distance on each edge and the spatial threshold, calculate the first point-edge counting function corresponding to each edge, and calculate the first spatiotemporal road network K function based on the first point-edge counting function.
3. The method for generating a fast spatiotemporal road network K-function graph based on a range tree and a prefix counting array according to claim 2, characterized in that, The step of calculating the first point-edge counting function corresponding to each edge based on the relationship between the shortest path distance on each edge and the spatial threshold, and calculating the first spatiotemporal network K function based on the first point-edge counting function, specifically includes: Map all data points on each edge onto a two-dimensional plane to obtain a spatiotemporal point set, wherein each spatiotemporal point pair in the spatiotemporal point set includes the position and timestamp of the spatiotemporal point pair; If it is determined that the distance of all the shortest paths on the mapped edge corresponding to the edge is greater than the spatial threshold, then the first point-edge counting function of the current edge is set to 0; If it is determined that the shortest path distance corresponding to the left node in the current iteration is not greater than the spatial threshold, and the shortest path distance corresponding to the right node is greater than the spatial threshold, then a two-dimensional range count query value within a first preset range is searched on the two-dimensional plane, and the first point-edge counting function of the current edge is defined as the two-dimensional range count query value, so as to calculate the first point-edge counting function: ; in, express timestamp, Indicates the time threshold. Indicates spatial threshold, This refers to any data point whose shortest path distance to the left node is not greater than the spatial threshold, and whose shortest path distance to the right node is greater than the spatial threshold and falls within a first preset range. express timestamp, express arrive The shortest path distance; If it is determined that the shortest path distance corresponding to the left node in the current iteration is greater than the spatial threshold, and the shortest path distance corresponding to the right node is not greater than the spatial threshold, then a two-dimensional range count query value within a second preset range is searched on the two-dimensional plane, and the first point-edge counting function of the current edge is defined as the two-dimensional range count query value to calculate the first point-edge counting function: ; in, express arrive The shortest path distance; If it is determined that the shortest path distances corresponding to the left and right nodes calculated in the current iteration are not greater than the spatial threshold, then the first point-edge counting function is calculated based on the relationship between the shortest path distances corresponding to the left and right nodes and the spatial threshold. The expression for the first point-edge counting function is: ; in, This represents the first vertex-edge counting function. and Both represent indices of the location dataset. Indicates an indicator function, Represents a location dataset. Represents a mapped edge. Indicates the computation of the current iteration. Location dataset on the above, express arrive The shortest path distance between them express arrive The shortest time between; Calculate the first spatiotemporal network K function based on the first point-edge counting function: ; in, Describes the K-function of the first spatiotemporal road network. Represents the set of edges.
4. The method for generating a fast spatiotemporal road network K-function graph based on a range tree and a prefix counting array according to claim 3, characterized in that, The step of calculating the first point-edge counting function based on the relationship between the shortest path distances corresponding to the left and right nodes and the spatial threshold specifically includes: When the relationship between the shortest path distances corresponding to the left node and the right node and the spatial threshold satisfies the first condition, a two-dimensional range count query value within a third preset range is searched on the two-dimensional plane, and the first point-edge counting function of the current edge is defined as the two-dimensional range count query value to calculate the first point-edge counting function: ; ; ; in, Indicates the first condition; When the relationship between the shortest path distances corresponding to the left node and the right node and the spatial threshold satisfies the second condition, a two-dimensional range count query value within a fourth preset range is searched on the two-dimensional plane, and the first point-edge counting function of the current edge is defined as the two-dimensional range count query value to calculate the first point-edge counting function: ; ; in, This indicates the second condition.
5. The method for generating a fast spatiotemporal road network K-function graph based on a range tree and a prefix counting array according to claim 1, characterized in that, The process of obtaining the target road network, spatial threshold set, and temporal threshold set, calculating the shortest distance from each point on the current edge to nodes on other edges, constructing a prefix counting array based on each edge in the edge set, calculating multiple second point-edge counting functions for the prefix counting array, and calculating the corresponding second spatiotemporal road network K function based on each second point-edge counting function, specifically includes: Obtain the target road network, spatial threshold set, and temporal threshold set given by the user, and set the initial value of the spatiotemporal road network K function of the target road network. For each edge in the edge set, calculate the shortest distance from each point of the current edge to the nodes of other edges. A prefix count array is constructed based on all spatial thresholds in the spatial threshold set and all time thresholds in the temporal threshold set, wherein the prefix count array includes multiple time-space threshold pairs; For each edge in the target road network, calculate the shortest path distance from each data point to all nodes on other edges. Iteratively calculate the second point-edge counting function for all time-space threshold pairs based on all the shortest path distances, and calculate the second spatiotemporal road network K function based on the second point-edge counting function, until the second spatiotemporal road network K function for each edge has been calculated.
6. The method for generating a fast spatiotemporal road network K-function graph based on a range tree and a prefix counting array according to claim 5, characterized in that, The step of iteratively calculating the second point-edge counting function for all time-space threshold pairs based on all shortest path distances, and calculating the second spatiotemporal road network K function based on the second point-edge counting function, specifically includes: If there exists a data point whose shortest path distance to the left and right nodes of other edges is greater than the maximum spatial threshold, then the second point-edge counting function for all spatial-temporal threshold pairs of other edges is defined as 0. Based on the relationship between the shortest path distance between the data point and the left node of other edges, the shortest path distance between the data point and the right node of other edges, and the maximum spatial threshold, different two-dimensional mesh structures are generated for all the time-space threshold pairs, and the second point-edge counting function of each time-space threshold pair is calculated using the different two-dimensional mesh structures.
7. The method for generating a fast spatiotemporal road network K-function graph based on a range tree and a prefix counting array according to claim 6, characterized in that, The process includes obtaining the target road network, spatial threshold set, and temporal threshold set; calculating the shortest distance from each point on the current edge to nodes on other edges; constructing a prefix counting array based on each edge in the edge set; calculating multiple second point-edge counting functions for the prefix counting array; and calculating the corresponding second spatiotemporal road network K function based on each second point-edge counting function. The process further includes: If the current time-space threshold pair meets the preset conditions, then a one-dimensional time grid structure and a one-dimensional prefix count array corresponding to the one-dimensional time grid structure are established. Based on the one-dimensional prefix counting array, all generated spatial thresholds in the spatial threshold set are divided to obtain two target spatial threshold sets; Based on the two target spatial threshold sets, corresponding target prefix count arrays are constructed on a two-dimensional plane, and a second point-edge counting function is calculated for each time-space threshold pair based on the two target prefix count arrays. The preset conditions are as follows: ; in, Indicates the first A spatial threshold, Index representing the spatial threshold, express arrive The shortest path distance, express arrive The shortest path distance, express arrive The shortest path distance, Indicates the target road network. The edge number calculated in the second iteration is the first edge number. Data points, This represents the left node of the edge calculated in the second iteration. This represents the right node of the edge calculated in the second iteration.
8. A fast spatiotemporal road network K-function graph generation system based on range tree and prefix counting array, characterized in that, The fast spatiotemporal road network K-function graph generation system based on range tree and prefix counting array includes: A single K-function calculation module is used to obtain the edge set, spatial threshold and temporal threshold in the target road network, construct a range tree based on each edge, calculate the shortest distance from each point of the current edge to the nodes of other edges, iteratively calculate each range tree based on the spatial threshold and the temporal threshold to obtain the first point-edge counting function corresponding to each edge, and calculate the first spatiotemporal road network K-function based on the first point-edge counting function. A K-function calculation module is generated to obtain the target road network, spatial threshold set, and temporal threshold set, calculate the shortest distance from each point of the current edge to the nodes of other edges, construct a prefix counting array based on each edge in the edge set, calculate multiple second point-edge counting functions of the prefix counting array, and calculate the corresponding second spatiotemporal road network K-function based on each second point-edge counting function. The cost optimization module is used to determine the cost of the first spatiotemporal road network K-function and the second spatiotemporal road network K-function of each edge through the constructed first cost model and second cost model, and select the edge with the smaller cost as the K-function value of the edge, and construct the spatiotemporal K-function graph of the target road network based on all the K-function values.
9. A terminal, characterized in that, The terminal includes: a memory, a processor, and a fast spatiotemporal road network K-function graph generation program based on a range tree and a prefix counting array, stored in the memory and executable on the processor. When the fast spatiotemporal road network K-function graph generation program based on a range tree and a prefix counting array is executed by the processor, it implements the steps of the fast spatiotemporal road network K-function graph generation method based on a range tree and a prefix counting array as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a fast spatiotemporal road network K-function graph generation program based on a range tree and a prefix counting array. When the fast spatiotemporal road network K-function graph generation program based on a range tree and a prefix counting array is executed by a processor, it implements the steps of the fast spatiotemporal road network K-function graph generation method based on a range tree and a prefix counting array as described in any one of claims 1-7.
Citation Information
Patent Citations
Road network map spatio-temporal data visualization system and method based on kernel density estimation
CN119597990A
Estimating motion trials in video image sequences
US20050207491A1