A graph stream time query method based on FlatMap line segment tree

By using a graph flow temporal query method based on FlatMap segment trees, the problems of low query accuracy and high latency in existing technologies are solved, and efficient storage and querying of graph flow data are achieved, making it suitable for graph flow scenarios with large data volumes.

CN120045636BActive Publication Date: 2025-11-07NORTHEASTERN UNIV CHINA
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510115057.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-11-07
Estimated Expiration
2045-01-24

AI Technical Summary

Technical Problem

Existing graph flow temporal query methods suffer from low query accuracy and large insertion and query latency, making it difficult to effectively support efficient temporal queries, especially in scenarios with large amounts of data.

Method used

A graph flow temporal query method based on FlatMap segment tree is adopted, which converts the timestamp of the flow edge into the corresponding time period and completes the insertion and storage through one-time positioning. In the query stage, the target query range is efficiently decomposed into specific queryable intervals. The FlatMap segment tree structure is used to achieve efficient integration of time logic, and a greedy query algorithm is combined to support queries on arbitrary intervals.

Benefits of technology

It improves query accuracy, reduces hash collisions and insertion latency, and provides more efficient graph flow temporal query performance, making it suitable for large data volume scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045636B_ABST
    Figure CN120045636B_ABST
Patent Text Reader

Abstract

The application provides a graph stream time query method based on a FlatMap line segment tree, and belongs to the technical field of data processing, and comprises the following steps: finding a corresponding storage location in a graph stream summary storage structure according to a target query edge; the graph stream summary storage structure comprises a hash compression matrix and a buffer area, each cell in the hash compression matrix comprises a fingerprint pair of a stream edge and a group of FlatMap line segment trees; decomposing a target query range to corresponding intervals in the pre-updated FlatMap line segment trees to obtain a queryable subinterval set; finding all nodes corresponding to the queryable subintervals in the pre-updated FlatMap line segment trees according to the corresponding storage location found in the graph stream summary storage structure and the queryable subinterval set, and taking the sum of the weights saved in the found nodes as a graph stream time query result. The method provided by the application reduces hash collision, improves query accuracy, and effectively reduces query delay.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of data processing, and particularly relates to a graph stream time state query method based on a FlatMap line segment tree. BACKGROUND

[0002] With the advent of the big data era, the data scale is expanding, and the form of data is no longer limited to traditional relational data, showing a diversified trend. As a new form of big data, graph stream has been widely used in network traffic, transaction systems, social media and other fields. Graph stream is an infinite edge stream sequence containing time information, and each item is represented as (s, d, w, t), representing a weight w edge from node s to node d arriving at t. These stream edges together form a constantly changing stream graph, which can represent the relationship or interaction between entities, and play a role in discovering malicious attacks in network traffic data, detecting financial fraud in transaction systems, analyzing user behavior in social networks, etc.

[0003] In actual graph stream analysis, time state query is a common and key problem. For example, we may encounter the following queries: "Did a certain IP access the host and download how many bytes of data between January 1, 2024 and January 31, 2024?" "What is the connectivity of a certain website between Monday and Sunday this week?" "Did a certain two suspicious bank accounts have direct or indirect transactions between 22:00 and 23:00 today?" These and other similar problems are graph data queries (such as time state edge weight queries, time state Boolean queries, etc.) within a certain time range, which have important value in practical applications and require effective methods to store the topology and time-related information in graph stream and support efficient time state queries.

[0004] Due to the very large amount of graph stream data in the real world, the cost of accurately and completely storing such a huge amount of graph stream data is unacceptable, therefore, graph stream abstraction based on approximate storage has been widely applied, which aims to achieve lower storage cost at the expense of a small amount of accuracy and support various queries related to graph topology. At present, time state queries are mainly implemented based on graph stream abstraction structure, and existing methods can be roughly divided into the following three categories:

[0005] (1) Directly use the timestamp of the edge to complete the storage. This method usually saves the timestamp of the edge directly or stores it as a calculation parameter. For example, the TCM method (DOI: 10.1145 / 2882903.2915223) uses multiple m x m compressed adjacency matrices M to represent the graph stream. For each element (s, d, w, t) in the graph stream, TCM adds the weight value w in the bucket (called "bucket") of the h(s|t) row and h(d|t) column of each matrix, where s|t and d|t represent the concatenation of the source node s and the destination node d with the arrival timestamp t of the edge. In this way, TCM retains the temporal information of the edge, and when performing temporal queries, it only needs to find the corresponding position in the same way as insertion and extract the weight value. Further, the GSS method (Patent No: CN112800288A) introduces fingerprint matching technology to alleviate the impact of hash collision, but in the implementation of temporal query, the ideas of GSS and TCM are the same, that is, the node and the timestamp are concatenated and then hashed to determine the position, and the storage and query are completed.

[0006] The ideas and implementation methods of this method are simple, but the defects are also obvious. On the one hand, a large number of hash collisions result in low query accuracy; on the other hand, when querying, it needs to traverse all timestamps within the target query range to complete the retrieval, which is a very large workload, thus causing huge query delay.

[0007] (2) Aggregate timestamps according to different granularities and store them by level. This method does not directly use the timestamp of the edge, but aggregates the timestamp according to different granularities. Each granularity corresponds to a level, and the edge will be updated in each level when inserted. For example, the PGSS method (DOI: 10.1007 / s11280-023-01165-z) stores a set of hierarchical hashmaps at each position of the matrix, where the key is the index of the interval in this level, and the value is the aggregated weight of the edge falling in the corresponding interval. When an edge arrives, it first locates the specific bucket in each compressed adjacency matrix, and then updates the hashmap at this position layer by layer. When performing temporal queries, PGSS will correspond the target query range to the intervals of different hashmap levels, and accumulate the entry values of these intervals layer by layer to complete the temporal query.

[0008] Although such methods complete the aggregation of time and can locate the target query range to the aggregated interval to reduce the workload, they still face a large number of interval traversals after aggregation for temporal queries in actual scenarios, and the query delay has not been effectively alleviated. At the same time, the aggregation timestamp also brings huge memory overhead and increases the storage burden.

[0009] (Three) First, the timestamp is converted into a corresponding time period, and then the time period is aggregated and stored according to different granularities. The main difference between this method and the second method is that when integrating time, not the timestamp but the time period is aggregated. When the user wants to complete a query with a granularity of "day", the time granularity (i.e. query granularity) is set to one day, so that the aggregation is completed in "day" units according to different granularities. Insertion and temporal query on the stream edge are also based on the time period corresponding to the stream edge timestamp. For example, the Horae method (DOI: 10.1109 / ICDE53745.2022.00254) stores the stream edge in a multi-layer summary structure, each layer corresponding to a time period aggregation granularity. When inserting, the stream edge is inserted into each layer of the summary structure at the same time, and when querying, the target query range is also mapped to different summary levels, and the storage location is found in each level to obtain the weight value.

[0010] Such methods, since the time period is aggregated instead of a single timestamp, are more in line with the temporal query requirements in actual applications, and alleviate the large traversal problem faced by the previous two methods. However, the current Horae method still has some defects: on the one hand, the multi-layer summary structure can increase the query error, because the number of hash collisions increases with the number of layers; on the other hand, both insertion and query need to calculate the location of the same edge multiple times, thereby increasing the insertion and query delay. SUMMARY

[0011] In view of the deficiencies of the prior art, the present application proposes a graph stream temporal query method based on FlatMap line segment tree. In the storage stage, the present application converts the timestamp of the stream edge into a corresponding time period, and completes the insertion storage by locating once. In the query stage, the present application efficiently decomposes the target query range to the specific interval that can be queried, and realizes the query of any interval. Through the above-mentioned manner, the present application overcomes the problems of low query precision, large insertion and query delay in the prior art, is more suitable for large data graph stream scenarios, and provides actual and efficient temporal graph stream query services.

[0012] The present application proposes a graph stream temporal query method based on FlatMap line segment tree, comprising:

[0013] obtain a temporal query task, the temporal query task comprising a source node, a destination node, and a target query range at a specified time granularity, and take the source node to the destination node as a target query edge;

[0014] find a corresponding storage location in a graph stream summary storage structure according to the target query edge; the graph stream summary storage structure comprising a hash compression matrix and a buffer, each cell in the hash compression matrix comprising a fingerprint pair of a stream edge and a set of FlatMap segment trees; the FlatMap segment trees being τ-layer tree structures, the number of nodes on the gth layer being 2 g-1 , and the time interval length corresponding to the nodes being 2 τ-g ; the nodes being used to save the weights of the stream edges arriving in the corresponding time interval; and the buffer being used to save the graph stream data that cannot be saved in the hash compression matrix;

[0015] decompose the target query range into corresponding intervals in the pre-updated FlatMap segment trees to obtain a set of queryable sub-intervals, the set of queryable sub-intervals containing at least one queryable sub-interval;

[0016] find the nodes corresponding to all the queryable sub-intervals in the pre-updated FlatMap segment trees according to the corresponding storage location found in the graph stream summary storage structure and the set of queryable sub-intervals, and take the sum of the weights saved in the found nodes as the graph stream temporal query result.

[0017] the updated FlatMap segment trees, the updating process comprising:

[0018] step S100: obtain a data set, the data set comprising a plurality of stream edges, read the start time of the data set, and specify the time granularity of the data set;

[0019] step S101: traverse each stream edge in the data set, and calculate the time period to which the stream edge belongs;

[0020] step S102: determine the storage location in the graph stream summary storage structure according to the source node and the destination node of each stream edge, and insert each stream edge into the FlatMap segment tree according to the storage location in the graph stream summary storage structure;

[0021] step S103: update the nodes in the corresponding FlatMap segment tree using the weight of each stream edge and the time period to which the stream edge belongs;

[0022] step S104: repeat steps S101-S103 until all stream edges complete the updating of the nodes in the FlatMap segment tree, and obtain the pre-updated FlatMap segment tree.

[0023] The finding of the corresponding storage location in the graph stream summary storage structure according to the target query edge comprises:

[0024] The source node and the destination node in the temporal query task are mapped by a hash function, and the hash address of the source node in the temporal query task, the hash address of the destination node in the temporal query task, the fingerprint of the source node in the temporal query task, and the fingerprint of the destination node in the temporal query task are calculated.

[0025] According to the random sequence, the hash address of the source node in the temporal query task, and the hash address of the destination node in the temporal query task, the hash address sequence of the source node and the hash address sequence of the destination node are calculated.

[0026] According to the hash address sequence of the source node and the hash address sequence of the destination node, the storage location in r 2 hash compression matrices is obtained, wherein r is the length of the random sequence.

[0027] In the storage location in r 2 hash compression matrices, the same fingerprint pair as the fingerprint of the source node in the temporal query task and the fingerprint of the destination node in the temporal query task is found, and a group of FlatMap segment trees corresponding to the same fingerprint pair is the corresponding storage location found in the graph stream summary storage structure.

[0028] The inserting of each stream edge into the FlatMap segment tree according to the storage location in the graph stream summary storage structure comprises:

[0029] If an empty location is found in the r 2 storage locations or the fingerprint of the source node of the stream edge and the fingerprint of the destination node of the stream edge are the same as the fingerprint pair stored in any location of the r 2 storage locations, the fingerprint of the source node of the stream edge and the fingerprint of the destination node of the stream edge are saved in the empty location or the any location.

[0030] If an empty location is not found in the r 2 storage locations and the fingerprint of the source node of the stream edge and the fingerprint of the destination node of the stream edge are not the same as the fingerprint pair stored in all locations of the r 2 storage locations, the fingerprint of the source node of the stream edge and the fingerprint of the destination node of the stream edge are saved in a buffer.

[0031] The FlatMap segment tree index number k to be updated and the element subscript i in the FlatMap segment tree of the current stream edge in the storage location are calculated.

[0032] The FlatMap segment tree index number k to be updated is calculated as follows:

[0033]

[0034] wherein k is the FlatMap segment tree index number, t i is the time period to which the flow edge belongs, τ is the total number of layers of the FlatMap segment tree;

[0035] the element subscript i in the FlatMap segment tree, the calculation formula is as follows:

[0036] i = t i + (1-k)2 τ-1 -2

[0037] wherein i is the element subscript in the FlatMap segment tree;

[0038] If the FlatMap segment tree index number k to be updated is less than or equal to the current maximum index of the FlatMap segment tree, the element whose index number is k and whose element subscript is i in the FlatMap segment tree is updated with the weight of the current flow edge;

[0039] If the FlatMap segment tree index number k to be updated is greater than the current maximum index of the FlatMap segment tree, a new FlatMap segment tree is created with the current FlatMap segment tree index number k, and the weight of the current flow edge is inserted into the new FlatMap segment tree.

[0040] The target query range is decomposed into the corresponding interval in the pre-updated FlatMap segment tree to obtain a queryable sub-interval set, comprising:

[0041] If the target query range is on a single FlatMap segment tree, the target query range is added to the intermediate set S';

[0042] If the target query range crosses different FlatMap segment trees, the target query range is decomposed into a single FlatMap segment tree, and the sub-range obtained after the decomposition is added to the intermediate set S', and the sub-range in S' falls on a single FlatMap segment tree;

[0043] According to the greedy query algorithm, the sub-range in the intermediate set S' is decomposed to obtain a queryable sub-interval, which is added to the result set S.

[0044] According to the greedy query algorithm, the sub-range in the intermediate set S' is decomposed to obtain a queryable sub-interval, which is added to the result set S, comprising:

[0045] Step a: If t b <t e in the sub-range [t b , t e, directly end the decomposition; if the sub-range [t b , t e , where t b ≤t e , then the length l of the current sub-range is l = t e - t b + 1. If l is 1, add the sub-range [t b , t e to the result set S and end the decomposition;

[0046] Step b: When the length l of the current sub-range is not 1, determine whether t b % 2 is 0. If t b % 2 = 0, then add the sub-range [t b , t b to the result set S, set t b = t b + 1, l = t e - t b + 1, and go to step a;

[0047] Step c: If t b % 2 ≠ 0, then determine whether the current sub-range length l is a power of 2 and satisfies t b % l = 1. If the current sub-range length l is a power of 2 and satisfies t b % l = 1, then no decomposition is required. Add the sub-range [t b , t e to the result set S and end the decomposition;

[0048] Step d: If the current sub-range length l is not a power of 2 or does not satisfy t b % l = 1, then decompose the sub-range [t b , t e into [t b , t b + maxLength - 1] and [t b + maxLength, t e , where maxLength takes the value of the largest power of 2. Add the decomposition result [t b , t b + maxLength - 1] to the result set S. The remaining [t b + maxLength, t e is used as the target query range for the next iteration. Go to step a to continue the iterative decomposition until the decomposition ends;

[0049] According to the corresponding storage location found in the graph stream summary storage structure and the queryable subinterval set, all corresponding nodes in the FlatMap line segment tree in the pre-updated FlatMap line segment tree are found, and the sum of the weights saved in the found nodes is taken as the graph stream temporal query result, including:

[0050] Determine the FlatMap line segment tree index number k corresponding to any queryable subinterval in the queryable subinterval set;

[0051] Determine the element subscript i in the FlatMap line segment tree corresponding to any queryable subinterval in the queryable subinterval set:

[0052] According to the corresponding storage location found in the graph stream summary storage structure, the FlatMap line segment tree index number k and the element subscript i in the FlatMap line segment tree, the weight corresponding to each queryable subinterval is obtained, and the sum of all weights is taken as the graph stream temporal query result.

[0053] The FlatMap line segment tree index number k corresponding to any queryable subinterval is calculated as follows:

[0054]

[0055] Wherein, k is the FlatMap line segment tree index number, t b is the starting position of the queryable subinterval, and τ is the total number of layers of the FlatMap line segment tree.

[0056] The element subscript i in the FlatMap line segment tree corresponding to any queryable subinterval is calculated as follows:

[0057]

[0058] Wherein, k is the FlatMap line segment tree index number, i is the element subscript in the FlatMap line segment tree, t b is the starting position of the queryable subinterval, and l is the length of the queryable subinterval.

[0059] Beneficial effects:

[0060] The application provides a graph stream temporal query method based on a FlatMap line segment tree, wherein the FlatMap line segment tree structure realizes efficient integration of time logic, supports one-time calculation insertion of a stream edge, reduces hash collision, improves query accuracy, and effectively reduces insertion delay; in addition, the greedy query algorithm can support efficient decomposition of any target range, and exhibits optimal query performance. BRIEF DESCRIPTION OF DRAWINGS

[0061] Figure 1A flow time query method based on a FlatMap line segment tree according to an embodiment of the present application;

[0062] Figure 2 A graph flow summary structure supporting time query according to an embodiment of the present application;

[0063] Figure 3 A flow edge insertion flowchart according to an embodiment of the present application;

[0064] Figure 4 A decomposition flowchart for a target query range [T b ,T e ] according to an embodiment of the present application;

[0065] Figure 5 A decomposition flowchart for a sub-range [t b ,t e ] according to an embodiment of the present application;

[0066] Figure 6 A variation trend diagram of average relative error (ARE) of each method according to an embodiment of the present application;

[0067] Figure 7 A variation trend diagram of average query delay of each method according to an embodiment of the present application. DETAILED DESCRIPTION

[0068] The specific embodiments of the present application will be further described in detail below with reference to the accompanying drawings and embodiments.

[0069] Embodiment

[0070] The embodiment provides a graph flow time query method based on a FlatMap line segment tree, as shown in the following figure, which comprises the following steps. Figure 1

[0071] Step S1: Obtain a time query task, wherein the time query task comprises a source node, a destination node, and a target query range under a specified time granularity, and take the source node to the destination node as a target query edge;

[0072] ​The embodiment uses the lkml-reply dataset, which is derived from the real Linux kernel mailing list network and is a collection of communication records, containing 63399 email addresses (nodes) and 1096440 communication records (edges). The query set is 1000 temporal queries for edge aggregate weights, and the edges in each query and the query range are randomly generated. In the storage stage of the embodiment, a stream edge (11, 91, 1, 1139121093) is specifically processed as an example. The stream edge indicates that the user with the email address ID 11 sent a communication to the user with the email address ID 91 at the timestamp 1139121093. In the embodiment, the time granularity is set to one day, granularityLength = 86400, m = 1430, the fingerprint length is 6 bits, the number of row addresses and column addresses is 4 respectively, and the single FlatMap coverage range length is 2 τ-1 = 4096, where τ = 13. In the query stage of the embodiment, a query (11, 91, 8, 15) is specifically processed as an example. The query indicates “what is the aggregate weight of edge (11, 91) in the time range [T8, T 15 ]?” Since the time granularity of the embodiment is “day”, the query actually reflects “how many times did the user with the email address ID 11 communicate with the user with the email address ID 91 in the 8th day to the 15th day?”

[0073] Step S2: finding the corresponding storage location in the graph stream summary storage structure according to the target query edge; the graph stream summary storage structure includes a hash compression matrix and a buffer, each cell in the hash compression matrix includes a fingerprint pair of a stream edge and a set of FlatMap line segment trees; the FlatMap line segment tree is a τ-layer tree structure, the number of nodes on the gth layer is 2 g-1 , the time interval length corresponding to the node is 2 τ-g , and the node is used to save the weight of the stream edge arriving in the corresponding time interval; the buffer is used to save the graph stream data that cannot be saved in the hash compression matrix;

[0074] In the embodiment, the complete graph stream summary storage structure, as shown in Figure 2 , includes the following two parts: a hash-based compression matrix (referred to as sketch) and a buffer. Each bucket (i.e. each cell) in the compression matrix stores:

[0075] (1) the fingerprint pair <f s ,f d > of the edge, as the identity id of the edge.

[0076] (2) a set of FlatMap segment trees, which are used to save the weights of edges, and in the nodes, the weights of edges reached in the corresponding time range can be read. Each FlatMap segment tree corresponds to save the weights of edges in a time period, and the FlatMap segment tree is the key to solve the problem of temporal query.

[0077] Firstly, each node in the segment tree corresponds to an interval (i.e. a time range), and the interval contains several time granularities. In this way, each node of the segment tree stores the weights of edges reached in this time range, and the interval length of the leaf node is 1, which only contains one time granularity. The number of nodes on the gth layer of the segment tree is 2 g-1 , and the interval length of each node on each layer is 2 τ-g , where τ is the total number of layers of the segment tree. Such a design structure can ensure that any target query range can be found on the segment tree several nodes that just cover it, so as to complete the temporal query. The FlatMap segment tree is an array in form, which is proposed to adapt to the characteristics of graph stream data and reduce the insertion delay, and is equivalent to the breadth-first traversal obtained after the number of layers of the segment tree reaches a certain threshold. The time organization logic in the FlatMap segment tree is still retained, and each element in the array corresponds to a node in the segment tree, i.e. an interval. Assuming that the FlatMap segment tree corresponds to a segment tree with τ layers, the FlatMap segment tree is an array with a length of 2 0 +2 1 +…+2 τ-2 +2 τ-1 =2 τ-1 , and the length of the time range covered is 2 τ-1 . The first element (i.e. the root node) in the array corresponds to an interval with a length of 2 τ-1 , the next 2 1 elements correspond to an interval with a length of 2 τ-2 , the next 2 2 elements correspond to an interval with a length of 2 τ-3 , …, the next 2 τ-2 elements correspond to an interval with a length of 2 1 , and the last 2 τ-1 elements (i.e. leaf nodes) correspond to an interval with a length of 2 0 . When the time exceeds the range covered by the current FlatMap segment tree, a new FlatMap segment tree will be dynamically started for storage. Each FlatMap segment tree is represented by a FlatMap segment tree index number k, and the nodes in the FlatMap segment tree are represented by the element subscript i in the FlatMap segment tree.

[0078] Step S3: Decompose the target query range into the corresponding intervals in the pre-updated FlatMap segment tree to obtain a set of queryable sub-intervals, wherein the set of queryable sub-intervals contains at least one queryable sub-interval.

[0079] Step S4: Based on the corresponding storage location and queryable sub-interval set found in the graph flow summary storage structure, find the corresponding nodes in all queryable sub-interval sets in the pre-updated FlatMap segment tree, and use the sum of the weights stored in the found nodes as the graph flow temporal query result.

[0080] In this embodiment, the FlatMap segment tree needs to be updated before the query process. Therefore, the update process of the FlatMap segment tree is described as follows:

[0081] The updated FlatMap segment tree, as follows: Figure 3 As shown, the update process includes:

[0082] Step S100: Obtain the dataset, which includes multiple flow edges, read the start time of the dataset and specify the time granularity of the dataset;

[0083] In this embodiment, the first flow edge of the lkml-reply dataset is read and its arrival timestamp is used as the start time, startTime = 1136080607; the time granularity is specified as one day (the time granularity is the finest granularity in the query process), and the granularity length is 86400.

[0084] Step S101: Traverse each flow edge in the dataset and calculate the time period to which the flow edge belongs;

[0085] The time period t of the flow edge i The calculation method is as follows:

[0086]

[0087] For the flow edge (11,91,1,1139121093), its arrival timestamp t = 1139121093, therefore its time period is...

[0088] Step S102: Determine the storage location in the graph flow summary storage structure based on the source node and destination node of each flow edge, and insert each flow edge into the FlatMap segment tree according to the storage location in the graph flow summary storage structure;

[0089] For the flow edge (11, 91, 1, 1139121093), firstly, the position of the compressible matrix that can store the flow edge is determined, i.e. the corresponding coordinate in the compressible matrix sketch; if the insertion cannot be completed in the sketch, the flow edge is stored in the buffer. The specific steps are as follows:

[0090] Step S102.1: mapping the source node and the destination node of the flow edge by the hash function, and calculating the hash address of the source node of the flow edge, the hash address of the destination node of the flow edge, the fingerprint of the source node of the flow edge, and the fingerprint of the destination node of the flow edge;

[0091] In this embodiment, the hash address and the fingerprint are calculated, and the calculation method of the hash address and the fingerprint of the node is as follows:

[0092] f(v) = H(v) % F

[0093] Wherein F is the maximum size of the fingerprint. The node id is mapped by the hash function H(·) to obtain the node hash value H(s) = H(11) = 173226315 and H(d) = H(91) = 708853215; then the hash address of the source node is calculated and the fingerprint f(s) = 173226315 % 63 = 3, and the hash address of the destination node is calculated and the fingerprint f(d) = 708853215 % 63 = 21.

[0094] Step S102.2: calculating the hash address sequence of the source node and the hash address sequence of the destination node according to the random sequence, the hash address of the source node of the flow edge, and the hash address of the destination node of the flow edge;

[0095] Further, the hash address sequence is calculated, first, the random sequence {q i (v)|1≤i≤r} is calculated, and then the hash address sequence {h i (v)|1≤i≤r} is calculated according to the random sequence and the fingerprint and the hash address obtained in step 3-1, and the calculation method is as follows:

[0096]

[0097] h i (v) = (h(v) + q i (v)) % m, 1≤i≤r

[0098] Wherein a, b, p are parameters for generating the random sequence, m is the matrix width, and r is the number of random sequences. Each node will generate r random address sequences, so each edge will have r 2buckets. In this embodiment, a=5, b=739, p=1048576, and the calculation results are: q1(s)=754, q2(s)=4509, q3(s)=23284, and q4(s)=117159. h1(s)=488, h2(s)=1383, h3(s)=138, and h4(s)=1063. Therefore, the hash address sequence corresponding to the source node is {h i (s)}={488, 1383, 138, 1063}, and the hash address corresponding to the destination node is {h i (d)}={1242, 1017, 1372, 287} by analogy.

[0099] Step S102.3: According to the hash address sequence of the source node and the hash address sequence of the destination node, r 2 storage positions in the r 2 storage positions are taken as the storage positions in the graph flow digest storage structure.

[0100] Step S102.4: If an empty position is found in the r 2 storage positions or the fingerprint of the source node of the flow edge and the fingerprint of the destination node of the flow edge are identical to the fingerprint pair stored in any position of the r 2 storage positions, the fingerprint of the source node of the flow edge and the fingerprint of the destination node of the flow edge are saved in the empty position or the any position.

[0101] Step S102.5: If no empty position is found in the r 2 storage positions and the fingerprint of the source node of the flow edge and the fingerprint of the destination node of the flow edge are not identical to the fingerprint pairs stored in all positions of the r 2 storage positions, the fingerprint of the source node of the flow edge and the fingerprint of the destination node of the flow edge are saved in the buffer.

[0102] In this embodiment, the address is further traversed, and the fingerprint comparison is performed to determine the final storage position. According to the obtained hash address sequence, the r 2Given a set of storable bucket addresses (where each element in the compressed matrix is ​​an address in a specific row and column), traverse these addresses in row-major order. If the first bucket is empty, directly store the fingerprint pair...<f(s),f(d)> Store the fingerprint in the bucket and proceed to step S102.6. If the first bucket is not empty, compare the fingerprint pairs already stored in this bucket with the fingerprint pairs of the current flow edge. If the fingerprint pairs are the same, consider the edge stored in this bucket to be the same edge as the current flow edge, and proceed to step S102.6. If the fingerprint pairs are different, continue traversing the next bucket, and so on, until an empty bucket or a bucket storing the same fingerprint pair is found. If r 2 If none of the buckets can insert this edge, then insert the edge into the buffer and proceed to step S102.6.

[0103] Specifically: Given that the fingerprint of the source node is f(s) = 3, and the hash address sequence is {h i (s)}={488,1383,138,1063}, the fingerprint of the destination node is f(d)=21, and the hash address sequence is {h i If (d)} = {1242, 1017, 1372, 287}, then the 16 bucket addresses that can be stored in the flow edge are: <488, 1242>, <488, 1017>, <488, 1372>, <488, 287>.

[0104] <1383,1242>,<1383,1017>,<1383,1372>,<1383,287>

[0105] <138,1242>,<138,1017>,<138,1372>,<138,287>

[0106] <1063,1242>, <1063,1017>, <1063,1372>, <1063,287>. Next, we traverse these 16 buckets sequentially. First, we check <488,1242>. If this location already stores a fingerprint pair and the fingerprint pair is <11,31>, it means this location has been occupied by another edge. We continue traversing to the next address <488,1017>. If this location stores a fingerprint pair <3,21>, it means this location has been reached by the same flow edge. We can determine that the flow edge insertion address is <488,1017>, and end the traversal.

[0107] Step S102.6: Calculate the FlatMap segment tree index k to be updated for the current flow edge in the storage location and the element index i in the FlatMap segment tree;

[0108] Step S102.7: If the FlatMap line segment tree index number k to be updated is less than or equal to the index maximum value of the current FlatMap line segment tree, the element with the index k of the FlatMap line segment tree and the index i of the element in the FlatMap line segment tree is updated with the weight of the current stream edge;

[0109] Step S102.8: If the FlatMap line segment tree index number k to be updated is greater than the index maximum value of the current FlatMap line segment tree, a new FlatMap line segment tree is created with the current FlatMap line segment tree index number k, and the weight of the current stream edge is inserted into the new FlatMap line segment tree.

[0110] In the embodiment, according to the time period t i to which the stream edge belongs, the coverage range 2 τ-1 of the FlatMap line segment tree, and the FlatMap line segment tree index number k (k starts from 0) corresponding to the stream edge can be determined, and the calculation method is as follows:

[0111]

[0112] If k is greater than the current FlatMap line segment tree index number, the next FlatMap line segment tree is started.

[0113] The coverage time period length of the single FlatMap line segment tree in the embodiment is 2 τ-1 = 4096. The time period to which the current stream edge (11, 91, 1, 1139121093) belongs is 36, so the weight value of the stream edge should be stored in the FlatMap line segment tree with k = 0.

[0114] In order to reduce the processing delay of the stream edge, the lazy update is adopted in the embodiment, that is, only the weight of the corresponding position in the last 2 τ-1 elements of the FlatMap line segment tree is updated. According to the time period t i to which the stream edge belongs, the coverage range 2 τ-1 of the FlatMap line segment tree, and the confirmed index number k, the array index i (i starts from 0) to be updated can be determined, and the calculation method is as follows:

[0115] i = t i + (1-k) 2 τ-1 - 2

[0116] When the array index i is confirmed, only the element fm k [i] at the position needs to be updated fm i= 36, k = 0, the covering time period length of the single FlatMap segment tree is 4096, then the array index i to be updated = 36 + 4096 - 2 = 4130, the weight value in fm0

[4130] is added by 1.

[0117] So far, the insertion process of the flow edge (11, 91, 1, 1139121093) is completed.

[0118] Step S103: using the weight of each flow edge and the time period to which the flow edge belongs, updating the node in the corresponding FlatMap segment tree;

[0119] Step S104: repeating step S101 to step S103 until all the flow edges complete the updating of the nodes in the FlatMap segment tree, obtaining the pre-updated FlatMap segment tree.

[0120] In this embodiment, the Flash updating of the FlatMap segment tree is continued, and this step can be performed when the flow edge no longer arrives, when the query task arrives, or when the FlatMap expansion is performed in step S102.6. In this example, when the query task arrives, the FlatMap segment tree is updated once. The updating process is updated from the back to the front level by level, until all the updating is completed (updated to i = 0). First, the (τ-1)-th layer is updated: starting from the element with index i = 2 τ-2 -1, a total of 2 τ-2 elements are updated, and the updating method is fm k [2 τ-2 -1] = fm k [2 τ-1 -1] + fm k [2 τ-1 ], and so on, and the updating of each element is the sum of the corresponding two elements of the next layer; then the (τ-2)-th layer is updated: starting from the element with index i = 2 τ-3 -1, a total of 2 τ-3 elements are updated; ……; the first layer is updated: starting from the element with index i = 0, a total of 2 0 elements are updated, and so far the Flash updating operation of the FlatMap segment tree is completed.

[0121] In this embodiment, τ = 13, the covering time period length of the single FlatMap segment tree is 2 τ-1 = 4096, then when Flash updating, first, the elements with i = 2047, 2048, …, 4094 are updated, and the updating method is

[0122] fm k

[2047] = fm k

[4095] + fm k

[4096] , fm k

[2048] = fm k

[4097] + fm k

[4098] ,...

[0123] fm k

[4094] = fm k

[8189] + fm k

[8190] , and the Flash update of the (r - 1)th layer is completed; then the elements of i = 1023, 1024,..., 2046 are updated, and the updating manner is fm k

[1023] = fm k

[2047] + fm k

[2048] , fm k

[1024] = fm k

[2049] + fm k

[2050] ,..., fm k

[2046] = fm k

[4093] + fm k

[4094] , and the Flash update of the (r - 2)th layer is completed;..., until the element of i = 0 is updated, and the updating manner is

[0124] fm k [0] = fm k [1] + fm k [2], and the update of the 1th layer is completed, and the Flash ends.

[0125] After updating the FlatMap line segment tree, the steps of a temporal query task (11, 91, 8, 15) are described below in combination with the query range decomposition flowchart shown in Figure 4 and Figure 5 .

[0126] In step S2, the corresponding storage location in the graph flow summary storage structure is found according to the target query edge, including:

[0127] Step S2.1: mapping the source node and the destination node in the temporal query task by a hash function, calculating the hash address of the source node in the temporal query task, the hash address of the destination node in the temporal query task, the fingerprint of the source node in the temporal query task, and the fingerprint of the destination node in the temporal query task;

[0128] Step S2.2: According to the random sequence, the hash address of the source node in the temporal query task, the hash address of the destination node in the temporal query task, the hash address sequence of the source node and the hash address sequence of the destination node are calculated;

[0129] Step S2.3: According to the hash address sequence of the source node and the hash address sequence of the destination node, the storage position in the r 2 hash compression matrix is obtained, where r is the length of the random sequence;

[0130] Step S2.4: In the storage position in the r 2 hash compression matrix, the same fingerprint pair as the fingerprint of the source node in the temporal query task and the fingerprint of the destination node in the temporal query task is found, and a set of FlatMap segment trees corresponding to the same fingerprint pair is the corresponding storage position found in the graph stream summary storage structure.

[0131] In this embodiment, the corresponding position of the target query edge is found, and the step of determining the storage position of each stream edge in the graph stream summary storage structure in step S102 is similar. When performing a temporal query, the corresponding position of the target query edge needs to be found. First, the hash address sequence of the source node and the destination node of the target query edge is found, which is equivalent to finding r 2 storable bucket addresses of the target query edge. Next, the r 2 addresses are traversed in order until the fingerprint pair stored in the bucket is the same as the fingerprint pair of the destination query edge. If no result is found in the r 2 bucket, the target query edge is searched in the buffer. If it is still not found, it means that the edge has not arrived, and 0 is directly returned to end the query. This step is similar to step S102, and the specific process will not be described again. Finally, the corresponding address of the target query edge (11, 91) is determined as <488, 1017>.

[0132] In step S3, the target query range is decomposed into the corresponding interval in the pre-updated FlatMap segment tree to obtain a set of queryable sub-intervals, including:

[0133] Step S3.1: If the target query range is on a single FlatMap segment tree, the target query range is added to the intermediate set S';

[0134] Step S3.2: If the target query range crosses different FlatMap segment trees, the target query range is decomposed into a single FlatMap segment tree, and the sub-ranges obtained after splitting are added to the intermediate set S', and the sub-ranges in S' all fall on a single FlatMap segment tree;

[0135] Step S3.3: Using a greedy query algorithm, decompose the sub-ranges in the intermediate set S' to obtain the queryable sub-intervals, and add them to the result set S.

[0136] In this embodiment, when performing a temporal query, it is necessary to define the target query range [T]. b ,T e The query range is decomposed into corresponding intervals in the FlatMap segment tree, resulting in a set of queryable sub-intervals S. This process mainly consists of two parts: the first part is to split the target query range that spans different FlatMap structures, and add the resulting sub-ranges to an intermediate set S', where all sub-ranges in S' fall on a single FlatMap structure; the second part is to decompose the sub-ranges in S', and add the resulting sub-intervals to the result set S, where all sub-intervals are queryable sub-intervals on a single FlatMap structure.

[0137] If the length L of the current range is greater than 2 τ-1 Or L≤2 τ-1 And T e >dp, where dp=2 τ-1+n For greater than or equal to currentT b The first FlatMap boundary point (currentT) b The current time is the starting time of the current range, initially currentT b =T b If the current range involves multiple FlatMaps, then the interval will be split into [currentT] b [dp] and [dp+1,T] e The split [currentT] b Add [dp] to S', [dp+1,T] e Continue decomposing the current scope, repeating the above steps, until the current scope no longer involves multiple FlatMap structures. Then, directly add it to S' and end.

[0138] In this implementation, the target query range is [T8, T]. 15 The length is L = 8 = 2. 3 And T e =15>8, therefore the current query range involves multiple FlatMap structures. The current range is split into [t8,t8] and [t9,t8]. 15 ], where [t8,t8] is added to S', [t9,t 15 The current range is further decomposed; the length of the current query range is L = 7 < 2. 3 And T e =15<16, therefore no further decomposition is needed, and [t9,t] can be directly decomposed. 15Add S’, end. At this time, the sub - ranges in S’ are: [t8, t8], [t9, t 15 .

[0139] The sub - ranges in S’ are already ranges that fall on a single FlatMap structure. Next, decompose each sub - range [t b , t e in S’, obtain the queryable sub - intervals corresponding to the segment tree intervals and add them to the result set S. The decomposition steps for each sub - range [t b , t e are as follows:

[0140] Decompose the sub - ranges in the intermediate set S’ according to the greedy query algorithm, obtain the queryable sub - intervals, and add them to the result set S, including:

[0141] Step a: If in the sub - range [t b , t e , t b >t e , directly end the decomposition; if in the sub - range [t b , t e , t b ≦t e , then the length l of the current sub - range is l = t e - t b +1. If the length l of the current sub - range is 1, add the sub - range [t b , t e to the result set S and end the decomposition;

[0142] Step b: When the length l of the current sub - range is not 1, judge whether t b %2 is 0. If t b %2 = 0, add the sub - range [t b , t b to the result set S, let t b = t b +1, l = t e - t b +1, and go to step a;

[0143] Step c: If t b %2≠0, then judge whether the length l of the current sub - range is a power of 2 and satisfies t b %l = 1. If the length l of the current sub - range is a power of 2 and satisfies t b %l = 1, no decomposition is required, add the sub - range [t b , t e to the result set S and end the decomposition;

[0144] Step d: if the current subrange length / is not a power of 2 or does not satisfy t b %l = 1, then split the subrange [t b , t e ] into [t b , t b +maxLength-1] and [t b +maxLength, t e ], where maxLength is the largest power of 2, add the result [t b , t b +maxLength-1] to the result set S, and the rest [t b +maxLength, t e ] is the target query range for the next iteration, go to step a to continue the iteration, until the decomposition ends.

[0145] In this embodiment, the target query range is [T8, T 15 ], and the subranges in S' obtained above are [t8, t8] and [t9, t 15 ].

[0146] Perform the decomposition for [t8, t8]: first perform step a, since / = 8-8+1 = 1, directly add [t8, t8] to the result set S, and end.

[0147] Perform the decomposition for [t9, t 15 ]: first perform step a, since / = 7, perform step b, since 9%2 = 1, perform step c, since / = 7, perform step d, the current subrange is split into [t9, t 12 ] and [t 13 , t 15 ], where maxLength = 4, add [t9, t 12 ] to the result set S, and [t 13 , t 15 ] continues to be decomposed. First perform step a, since / = 3, perform step b, since 13%2 = 1, perform step c, since / = 3, perform step d, the current subrange is split into [t 13 , t 14 ] and [t 15 , t 15 ], where maxLength = 2, add [t 13 , t 14 ] to the result set S, and [t 15 , t 15 ] continues to be decomposed. First perform step a, since / = 1, directly add [t 15 , t 15Add the result set S, end.

[0148] So far, the sub-ranges in S' are all traversed, and S is obtained, and the sub-intervals in S are: [t8, t8], [t9, t 12 ] and [t 13 ,t 14 ] and [t 15 ,t 15 ].

[0149] In this embodiment, each interval in S is traversed to perform a query operation. After obtaining the storage location of the target query edge, find the corresponding elements of all queryable sub-intervals [t b ,t e ] in S on the FlatMap corresponding to the target query edge, and then add the weight values obtained by traversing to obtain the result of the temporal query.

[0150] In step S4, according to the corresponding storage location found in the graph flow summary storage structure and the queryable sub-interval set, find all nodes corresponding to the queryable sub-interval set in the pre-updated FlatMap segment tree, and take the sum of the weights saved in the found nodes as the graph flow temporal query result, including:

[0151] Step S4.1: Determine the FlatMap segment tree index number k corresponding to any queryable sub-interval in the queryable sub-interval set, and calculate as follows:

[0152]

[0153] Where k is the FlatMap segment tree index number, t b is the start position of the queryable sub-interval, and τ is the total number of layers of the FlatMap segment tree.

[0154] Step S4.2: Determine the element subscript i in the FlatMap segment tree corresponding to any queryable sub-interval in the queryable sub-interval set, and calculate as follows:

[0155]

[0156] Where i is the element subscript in the FlatMap segment tree, and l is the length of the queryable sub-interval.

[0157] Step S4.3: According to the corresponding storage location found in the graph flow summary storage structure, the FlatMap segment tree index number k and the element subscript i in the FlatMap segment tree, the weight corresponding to each queryable sub-interval is obtained, and the sum of all weights is taken as the graph flow temporal query result.

[0158] In this embodiment, for the queryable sub-interval [t8, t8] in S, the corresponding FlatMap index number is The corresponding element subscript in the 0th FlatMap line segment tree is The weight value corresponding to the interval is fm0

[5102] ;

[0159] For the queryable sub-interval [t9, t 12 ] in S, the corresponding FlatMap index number is The corresponding element subscript in the 0th FlatMap line segment tree is The weight value corresponding to the interval is fm0

[1025] ;

[0160] For the queryable sub-interval [t 13 , t 14 ] in S, the corresponding FlatMap index number is The corresponding element subscript in the 0th FlatMap line segment tree is The weight value corresponding to the interval is fm0

[2053] ;

[0161] For the queryable sub-interval [t 15 , t 15 ] in S, the corresponding FlatMap index number is The corresponding element subscript in the 0th FlatMap line segment tree is The weight value corresponding to the interval is fm0

[4109] .

[0162] The fm0

[4102] +fm0

[1025] +fm0

[2053] +fm0

[4109] in the bucket with the address <488, 1017> are returned as the result.

[0163] At this point, the temporal query task of a (11, 91, 8, 15) is completed.

[0164] The graph stream temporal query method based on the FlatMap line segment tree proposed in this embodiment proposes a FlatMap line segment tree structure to retain the time information of edges and support temporal query in terms of storage. The FlatMap line segment tree is formally a length of 2 0 +2 1 +…+2 τ-2 +2 τ-1 =2 τ-1 array, which is equivalent to the number of layers of the segment tree reaches a certain threshold after being obtained by breadth-first traversal. The FlatMap segment tree contains time organization logic, and each element in the array corresponds to a node in the segment tree, that is, an interval, each interval contains several time periods, and stores the edge weight information arriving at these time periods. The first element in the array (i.e., the root node) corresponds to an interval with a length of 2 τ-1 , the last 2 1 elements correspond to an interval with a length of 2 τ-2 , the last 2 2 elements correspond to an interval with a length of 2 τ-3 , …, the last 2 τ-2 elements correspond to an interval with a length of 2 1 , and the last 2 τ-1 elements (i.e., leaf nodes) correspond to an interval with a length of 2 0 , containing only one time period (i.e., one time granularity). When the stream edge is inserted, only the leaf nodes of the FlatMap segment tree are updated (lazy update). When the time exceeds the range covered by the current FlatMap segment tree, the next FlatMap segment tree is dynamically started for storage.

[0165] In terms of query, the embodiment proposes a greedy-based query algorithm, which decomposes the time range given by the user into the node interval of the corresponding segment tree to complete the temporal query. Specifically, for any target query range, a set of sub-intervals is needed to cover the target query range without overlap, and the sub-intervals are required to match the node intervals in the FlatMap segment tree structure to support queries of any time range.

[0166] By applying the method of the embodiment, edge weight query experiments are performed on different lengths of query ranges (L=8, 16, 32, 64, 128, 256, 512, 1024, 2048, 1536, 2560) for real lkml-reply data sets. The experimental results show that the DSTGS method proposed in the embodiment exhibits better performance in terms of query accuracy compared to other methods. Figure 6 It is shown that DSTGS maintains lower average relative error (ARE) on all query ranges, and in some cases, the ARE is less than 10 -2 even 10 -3 , which is two orders of magnitude higher than the existing optimal method. In addition, DSTGS ensures better query accuracy while achieving lower query delay. Figure 7 It is shown that DSTGS maintains lower average query delay (unit: ms) on all query ranges, which is one order of magnitude higher than the existing optimal method.

[0167] From the experimental results, the method of the embodiment can provide more accurate and efficient time query service in real-world graph stream application, and fully meet the actual application requirements.

[0168] Each of the embodiments in the present application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment mainly explains the difference from other embodiments.

[0169] The scope of protection of the present application is not limited to the above-mentioned embodiments. Obviously, those skilled in the art can make various modifications and changes to the present disclosure without departing from the scope and spirit of the present disclosure. If these modifications and changes belong to the scope of the claims of the present disclosure and its equivalent technologies, the present disclosure also includes these modifications and changes.

Claims

1. A method for graph stream temporal query based on FlatMap line segment tree, characterized in that, The method comprises the following steps: obtaining a time query task, the time query task comprising a source node, a destination node and a target query range at a specified time granularity, and taking the source node to the destination node as a target query edge; According to the target query edge, a corresponding storage location is found in a graph stream summary storage structure; the graph stream summary storage structure comprises a hash compression matrix and a buffer, each cell of the hash compression matrix comprises a fingerprint pair of a stream edge and a set of FlatMap segment trees; the FlatMap segment trees are τ-layer tree structures, the number of nodes on a gth layer is 2 g-1 , the length of a time interval corresponding to the nodes is 2 τ-g , and the nodes are used to save weights of stream edges arriving in the corresponding time interval; and the buffer is used to save graph stream data that cannot be saved in the hash compression matrix. decomposing the target query range to a corresponding interval in a pre-updated FlatMap line segment tree to obtain a queryable sub-interval set, the queryable sub-interval set containing at least one queryable sub-interval; finding all nodes corresponding to the queryable sub-intervals in the pre-updated FlatMap line segment tree according to the corresponding storage location in the graph stream summary storage structure and the queryable sub-interval set, and taking the sum of the weights saved in the found nodes as a graph stream time query result. 2.The graph temporal query method based on FlatMap line segment tree according to claim 1, wherein, The updating process of the pre-updated FlatMap line segment tree comprises the following steps: step S100: obtaining a data set, the data set comprising a plurality of stream edges, reading a start time of the data set and specifying a time granularity of the data set; step S101: traversing each stream edge in the data set and calculating a time period to which the stream edge belongs; step S102: determining a storage location in a graph stream summary storage structure according to the source node and the destination node of each stream edge, and inserting each stream edge into a FlatMap line segment tree according to the storage location in the graph stream summary storage structure; step S103: updating a node in the corresponding FlatMap line segment tree by using the weight of each stream edge and the time period to which the stream edge belongs; step S104: repeating steps S101 to S103 until all stream edges complete the updating of the nodes in the FlatMap line segment tree, thereby obtaining a pre-updated FlatMap line segment tree. 3.The graph temporal query method based on FlatMap line segment tree according to claim 1, wherein, The method of finding the corresponding storage location in the graph stream summary storage structure according to the target query edge comprises the following steps: mapping the source node and the destination node in the time query task by using a hash function to calculate a hash address of the source node in the time query task, a hash address of the destination node in the time query task, a fingerprint of the source node in the time query task and a fingerprint of the destination node in the time query task; calculating a hash address sequence of the source node and a hash address sequence of the destination node according to a random sequence, the hash address of the source node in the time query task and the hash address of the destination node in the time query task; According to the hash address sequence of the source node and the hash address sequence of the destination node, a storage position in r 2 hash compression matrices is obtained, wherein r is the length of the random sequence. In the storage location in the r 2 hash compression matrix, find the same fingerprint pair as the fingerprint of the source node in the temporal query task and the fingerprint of the destination node in the temporal query task, and a set of FlatMap segment trees corresponding to the same fingerprint pair is the corresponding storage location found in the graph stream summary storage structure. 4.The graph temporal query method based on FlatMap line segment tree according to claim 2, wherein, The method of inserting each stream edge into the FlatMap line segment tree according to the storage location in the graph stream summary storage structure comprises the following steps: If an empty location is found in the r 2 storage locations or the fingerprint of the source node of the flow edge and the fingerprint of the destination node of the flow edge are identical to any of the r 2 storage locations, then the fingerprint of the source node of the flow edge and the fingerprint of the destination node of the flow edge are saved in the empty location or the any of the r If no empty location is found in the r 2 storage locations and the fingerprint of the source node of the flow edge and the fingerprint of the destination node of the flow edge are not identical to all locations in the r 2 storage locations, the fingerprint of the source node of the flow edge and the fingerprint of the destination node of the flow edge are saved in the buffer. calculating a FlatMap line segment tree index number k to be updated by the current stream edge and an element subscript i in the FlatMap line segment tree in the storage location; The calculation formula of the FlatMap line segment tree index number k to be updated is as follows: Wherein, k is the FlatMap line segment tree index number, t i is the time period to which the flow edge belongs, τ is the total number of layers of the FlatMap line segment tree; The calculation formula of the element subscript i in the FlatMap line segment tree is as follows: i = t i + (1 - k)2 τ-1 - 2 wherein i is the element subscript in the FlatMap line segment tree; if the FlatMap line segment tree index number k to be updated is less than or equal to the maximum index of the previous FlatMap line segment tree, the element whose index is k and whose element subscript is i in the FlatMap line segment tree is updated by the weight of the current stream edge. If the FlatMap segment tree index number k to be updated is greater than the index maximum value of the previous FlatMap segment tree, a new FlatMap segment tree is created with the current FlatMap segment tree index number k, and the weight of the current stream edge is inserted into the new FlatMap segment tree.

5. The graph flow temporal query method based on FlatMap line segment tree according to claim 1, characterized in that, The target query range is decomposed into corresponding intervals in the pre-updated FlatMap segment tree to obtain a queryable sub-interval set. If the target query range is on a single FlatMap segment tree, the target query range is added to the intermediate set S'; If the target query range spans different FlatMap segment trees, the target query range is decomposed into a single FlatMap segment tree, and the sub-ranges obtained after the decomposition are added to the intermediate set S', and the sub-ranges in S' all fall within a single FlatMap segment tree. The sub-ranges in the intermediate set S' are decomposed according to the greedy query algorithm to obtain queryable sub-intervals, which are added to the result set S.

6. The graph flow temporal query method based on FlatMap line segment tree according to claim 5, characterized in that, The sub-ranges in the intermediate set S' are decomposed according to the greedy query algorithm to obtain queryable sub-intervals, which are added to the result set S. Step a: If t b in the sub-range [t e , t b ] is t e , the decomposition ends directly; if t b in the sub-range [t e , t b ] is t e , the length l of the current sub-range is t e -t b +1, if l is 1, the sub-range [t b , t e ] is added to the result set S, and the decomposition ends; Step b: if the length of the current subrange, l, is not 1, then determine if t b %2 is 0, and if t b %2 = 0, then add the subrange [t b , t b ] to the result set S, set t b = t b + 1, l = t e - t b + 1, and go to step a. Step c: if t b % 2≠0, judge whether the current subrange length l is 2n power and satisfies t b % l=1, if the current subrange length l is 2n power and satisfies t b % l=1, no need to decompose, add the subrange [t b , t e ] to the result set S, end the decomposition; Step d: If the current sub-range length l is not a power of 2 or does not satisfy t b % l = 1, then split the sub-range [t b ,t e ] into [t b ,t b + maxLength - 1] and [t b + maxLength, t e ], where the value of maxLength is the largest power of 2, add the split result [t b ,t b + maxLength - 1] to the result set S, and the remaining [t b + maxLength, t e ] is the target query range for the next iteration, go to step a to continue the iteration of split until the split ends.

7. The graph flow temporal query method based on FlatMap line segment tree according to claim 1, characterized in that, The corresponding nodes in the pre-updated FlatMap segment tree for the queryable sub-interval set are found according to the corresponding storage location and the queryable sub-interval set in the graph stream summary storage structure, and the sum of the weights saved in the found nodes is taken as the graph stream temporal query result. Determine the FlatMap segment tree index number k corresponding to any queryable sub-interval in the queryable sub-interval set. Determine the element subscript i in the FlatMap segment tree corresponding to any queryable sub-interval in the queryable sub-interval set. According to the corresponding storage location, the FlatMap segment tree index number k, and the element subscript i in the FlatMap segment tree in the graph stream summary storage structure, the weight corresponding to each queryable sub-interval is obtained, and the sum of all weights is taken as the graph stream temporal query result. 8.The graph temporal query method based on FlatMap line segment tree according to claim 7, wherein, The FlatMap segment tree index number k corresponding to any queryable sub-interval is calculated as follows: where k is the FlatMap segment tree index number, t ′ b is the start position of the queryable sub-interval, and τ is the total number of layers of the FlatMap segment tree. 9.The graph temporal query method based on FlatMap line segment tree according to claim 7, wherein, The element subscript i in the FlatMap segment tree is calculated as follows: wherein k is the FlatMap line segment tree index number, i is the element subscript in the FlatMap line segment tree, t ′ b is the start position of the queryable sub-interval, and l is the length of the queryable sub-interval.

Citation Information

Patent Citations

  • Graph stream data processing method

    CN112800288A

  • Double-hash table association method for inquiring interval durability top-k

    CN102663030A

  • Safety nearest neighbor query method and system based on maximum division and random data block

    CN102999594A