People flow analysis method based on B+ tree, and construction method and device of double B+ tree
By recording user identity and location data in the left and right B+ trees, the data storage and processing latency issues of existing crowd flow analysis methods are resolved, achieving more efficient crowd flow analysis.
Patent Information
- Application Number
- CN202210142244.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-16
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2042-02-16
AI Technical Summary
Existing methods for analyzing pedestrian flow require inputting user location data into a database, resulting in significant data entry and processing delays, which negatively impacts analysis efficiency.
A B+ tree-based people flow analysis method is adopted, which records user identification information and location data through left and right B+ trees respectively, reducing the number of data entry operations, and shortening the query time by utilizing the pointer connection feature of leaf nodes in B+ trees.
This avoids data entry delays, reduces the scope of data queries, lowers processing latency, and improves the efficiency of people flow analysis.
Smart Images

Figure CN116644062B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a B+ tree-based method for analyzing pedestrian flow, a method for constructing a double B+ tree, and an apparatus. Background Technology
[0002] By conducting pedestrian flow analysis (such as dwell location analysis and dwell time analysis) on the location trajectory of users within a designated area, we can accurately grasp the market development dynamics of that area, promptly identify problems in user management within that area, and provide important reference for macro-level decision-making in that area.
[0003] Traditional pedestrian flow analysis methods typically involve first inputting user location data into a database, then utilizing the database's computational capabilities to calculate user location changes and dwell time at different times. However, in practical applications, user location data is often constantly changing, resulting in a large volume of data to be analyzed. If a database-based pedestrian flow analysis method is still used, it can lead to several problems: firstly, it may require significant data entry time, resulting in latency; secondly, since the database performs calculations only after all user location data has been entered, performing pedestrian flow analysis on a specific user requires querying all location data, leading to a large query volume and potentially significant processing latency. Summary of the Invention
[0004] This application provides a B+ tree-based people flow analysis method to solve the problems of large data entry and processing delays that may occur with existing people flow analysis methods based on query databases.
[0005] This application also provides a method for constructing a double B+ tree, a B+ tree-based crowd flow analysis device, a double B+ tree construction device, an electronic device, and a computer-readable storage medium.
[0006] The embodiments of this application adopt the following technical solutions:
[0007] A B+ tree-based method for analyzing pedestrian flow includes:
[0008] Acquire deep packet inspection data and identity information of the user to be analyzed. The deep packet inspection data includes the user's location data and the first change time to the user's location data.
[0009] Based on the identity information, user location data, and the first change time, the search results are obtained by searching in the pre-constructed left B+ tree and right B+ tree respectively. The left B+ tree is used to record the user's identity information, the latest user location data, and the second change time to the latest user location data. The right B+ tree is used to record the user's identity information, each user's location data, and the third change time to each user's location data.
[0010] Based on the search results, determine the user trajectory information of the user to be analyzed and the dwell time of each user location in the user trajectory information.
[0011] Optionally, based on the identity information, user location data, and the first change time, searches are performed in the pre-constructed left B+ tree and right B+ tree respectively to obtain search results, including:
[0012] Based on the identity information, search the left B+ tree to find whether there is user location data for a user whose identity information matches the user's identity information;
[0013] If not, insert the first leaf node in the left B+ tree, and store the latest user location data and the latest location change time to the latest user location data in the first leaf node using the identity information as the key.
[0014] Insert the second leaf node into the right B+ tree, and store the latest user location data and the latest location change time into the second leaf node according to the identity information;
[0015] Based on the information stored in the first leaf node and the information stored in the second leaf node, obtain the search results.
[0016] Optionally, the method further includes: if user location data matching the identity information exists in the left B+ tree, then determining the activation identifier and leaf identifier of the left B+ tree; updating the left B+ tree and right B+ tree according to preset rules based on the activation identifier, leaf identifier, latest user location data, and latest location change time; and obtaining the search result based on the information stored in the updated left B+ tree and right B+ tree.
[0017] A method for constructing a double B+ tree, comprising:
[0018] Obtain the user's identity information, user location data, and the time of location change to the user's location data;
[0019] Using the user's identity information as the key, and the latest user location data and the latest location change time to the latest user location data as the key values of the leaf nodes, a left B+ tree is constructed;
[0020] Based on the region identifier of the area to which the user location data belongs, construct a right B+ tree with identity information as the key and the location change time of each user location data as the key value of the leaf node.
[0021] Optionally, the method further includes: if the key value of the leaf node of the right B+ tree includes the activation identifier of the right B+ tree, then determine the number of leaf nodes in the right B+ tree whose activation identifier is inactive; when the number of leaf nodes is greater than a preset threshold, then reconstruct the right B+ tree; wherein the preset threshold is determined based on the user traffic in a preset time period of the area to which the user location data belongs.
[0022] Optionally, the method further includes: when the number of leaf nodes is greater than a preset threshold, obtaining the region identifier, key, and key value of the leaf node of the right B+ tree; storing the region identifier, key, and key value of the leaf node of the right B+ tree into a preset storage space, wherein the preset storage space is associated with the right B+ tree.
[0023] Optionally, the method further includes: initializing the leaf identifier bits of the leaf nodes of the left B+ tree; determining the abnormal disconnection time of the user when the activation identifier of the left B+ tree is in an active state; changing the activation identifier in the leaf node storing the user in the left B+ tree to an inactive state when the abnormal disconnection time is greater than or equal to a preset abnormal time threshold, and recording the region identifier of the area to which the user's location data belongs; searching for the leaf node storing the user's location data in the right B+ tree according to the region identifier; and changing the user traffic information within a preset time period stored in the leaf node.
[0024] A B+ tree-based crowd flow analysis device includes an acquisition module, a construction module, and a determination module, wherein:
[0025] The acquisition module is used to acquire the deep packet inspection data and identity information of the user to be analyzed. The deep packet inspection data includes the user's location data and the first change time to the user's location data.
[0026] The search module is used to search in the pre-built left B+ tree and right B+ tree respectively based on the user's identity information, user location data and the first change time to obtain the search results; wherein, the left B+ tree is used to record the user's identity information, the latest user location data and the second change time to the latest user location data; the right B+ tree is used to record the user's identity information, each user's location data and the third change time to each user's location data.
[0027] The determination module is used to determine the user trajectory information of the user to be analyzed and the dwell time of each user location in the user trajectory information based on the search results.
[0028] A device for constructing a double B+ tree includes an information acquisition module, a left tree construction module, and a right tree construction module, wherein:
[0029] The information acquisition module is used to acquire the user's identity information, user location data, and the location change time of the user's location data.
[0030] The left tree construction module is used to construct a left B+ tree using the user's identity information as the key and the latest user location data and the latest location change time to the latest user location data as the key values of the leaf nodes;
[0031] The right tree construction module is used to construct a right B+ tree based on the region identifier of the area to which the user location data belongs, with identity information as the key and the location change time of each user location data as the key value of the leaf node.
[0032] An electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the B+ tree-based crowd flow analysis method or the double B+ tree construction method as described above.
[0033] A computer-readable storage medium is characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the steps of the B+ tree-based crowd flow analysis method or the double B+ tree construction method as described above.
[0034] The above-described technical solutions adopted in the embodiments of this application can achieve the following beneficial effects:
[0035] Using the method provided in this application, when it is necessary to analyze a user's behavioral trajectory information, the latest user location data and latest location change time of the user can be found from the left B+ tree based on the user's identity information. Additionally, each user location data and the location change time to each user location can be found from the B+ tree based on the user's identity information. Then, based on the found information, the user trajectory information of the user to be analyzed and the dwell time of each user location in the user trajectory information can be determined. Compared with related technologies, on the one hand, since this method does not require pre-entering user location data into the database, it can avoid database entry delays. On the other hand, due to the characteristics of the B+ tree itself (the leaf nodes of the B+ tree are connected sequentially using pointers, and the entire tree can be traversed by traversing the leaf nodes), when searching for user location information in the left and right B+ trees, the data query range can be reduced, the query time shortened, and thus the processing latency reduced. Attached Figure Description
[0036] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0037] Figure 1a A schematic diagram illustrating the implementation process of a B+ tree-based crowd flow analysis method provided in this application embodiment;
[0038] Figure 1b This is a schematic diagram illustrating the implementation process of searching in a pre-constructed left B+ tree and right B+ tree based on identity information, user location data, and a first change time, as provided in this application embodiment, to obtain search results.
[0039] Figure 1c This is a schematic diagram illustrating the implementation process of searching in a pre-constructed left B+ tree and right B+ tree based on identity information, user location data, and a first change time, as provided in this application embodiment, to obtain search results.
[0040] Figure 2a A schematic diagram illustrating the implementation process of a method for constructing a double B+ tree provided in an embodiment of this application;
[0041] Figure 2b A schematic diagram illustrating the implementation process of a method for reconstructing a right B+ tree, provided in an embodiment of this application;
[0042] Figure 2c A schematic diagram illustrating the implementation process of a method for initializing and managing a double B+ tree in an embodiment of this application;
[0043] Figure 3 This application provides a schematic diagram of the specific structure of a B+ tree-based crowd flow analysis device.
[0044] Figure 4 This is a schematic diagram of the specific structure of a device for constructing a dual B+ tree, provided in an embodiment of this application.
[0045] Figure 5 This is a schematic diagram of the structure of a mobile terminal provided in an embodiment of this application. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0047] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0048] Example 1
[0049] To address the issues of significant data entry and processing delays that may result from existing database-based crowd flow analysis methods, this application provides a B+ tree-based crowd flow analysis method.
[0050] The execution subject of this method can be various types of computing devices, or it can be an application or app installed on the computing device. The computing device can be a user terminal such as a mobile phone, tablet computer, or smart wearable device, or it can be a server.
[0051] For ease of description, this application uses a server as the execution subject of the method in its embodiments to illustrate the method. Those skilled in the art will understand that this embodiment uses a server as an example to describe the method, which is merely an illustrative example and does not limit the scope of protection of the corresponding claims.
[0052] Specifically, the implementation flow of the method provided in this application embodiment is as follows: Figure 1a As shown, it includes the following steps:
[0053] Step 11: Obtain the deep packet inspection data and identity information of the user to be analyzed. The deep packet inspection data includes the user's location data and the first change time to the user's location data.
[0054] Deep Packet Inspection (DPI) data can be used to characterize changes in the user's location data or the user's on-network / off-network status, enabling the analysis of the user's usage. In this embodiment, the DPI data may be, for example, the DPI data corresponding to messages such as Attach, Service Request, TAU, UE context release, X2 handover, S1 handover in, and S1 handover out.
[0055] In this embodiment, when obtaining the deep packet inspection data of the user to be analyzed, it can be obtained according to the process document of the S1-MME interface. Specifically, following the previous example, assuming that the DPI data is the DPI data corresponding to messages such as Attach, Service Request, TAU, UE context release, X2 handover, S1 handover in, and S1 handover out, it can be obtained by using optical splitting technology to collect S1-MME (LTE eNodeB and MME signaling plane) data in DPILTE collection, and then filtering out the DPI data corresponding to messages such as Attach, Service Request, TAU, UE context release, X2 handover, S1 handover in, and S1 handover out from the collected signaling data.
[0056] Identity identification information is used to uniquely identify a user. In this embodiment of the application, identity identification information may be, for example, the International Mobile Subscriber Identification Number (IMSI), ID card number, etc.
[0057] Step 12: Based on the identity information, user location data, and the first change time, search in the pre-constructed left B+ tree and right B+ tree respectively to obtain the search results; wherein, the left B+ tree is used to record the user's identity information, the latest user location data, and the second change time to the latest user location data; the right B+ tree is used to record the user's identity information, each user's location data, and the third change time to each user's location data.
[0058] Left and right B+ trees refer to tree data structures, which can also be understood as n-ary trees. Each node typically includes a root node, intermediate nodes, and leaf nodes. Leaf nodes in a B+ tree can store keys and the addresses of corresponding records, while the levels above the leaf nodes are used as indexes. Using left and right B+ trees ensures the stability and order of user location data and the first change time to user location data, and guarantees a relatively stable logarithmic time complexity during insertion and modification processes.
[0059] In this embodiment of the application, a left B+ tree and a right B+ tree can be pre-constructed before performing step 12. The construction of the left and right B+ trees can be based on the user's identification information, the user's location data, and the time of change to that location data. The user's identification information can be, for example, an IMSI code; the user's location data can refer to the location data of the user's cell.
[0060] The following will describe in detail the methods for constructing the left B+ tree and the right B+ tree in the embodiments of this application. For ease of description, the location data of the user's cell will be abbreviated as Eci, and the change time of the user's location data will be abbreviated as STime.
[0061] Using the previous example, for a left B+ tree, the left B+ tree can be constructed using the IMSI code as the key, and the key value of the leaves of the left B+ tree is {Eci, STimeA}.
[0062] It should be noted that if the key value of a leaf in the left B+ tree contains only one value, it can be understood that the leaf node only records the user's latest location data Eci and the change time STime to the latest user location data.
[0063] Optionally, to facilitate determining whether the data stored in the leaf nodes of the left B+ tree is valid, in this embodiment, an activation flag `flag_active_left` can be added to the leaf nodes of the left B+ tree, denoted as `{Eci, STimeA, flag_active_left}`. If the value of `flag_active_left` is 1, it indicates that the data stored in the leaf nodes of the left B+ tree is in an active state; if the value of `flag_active_left` is 0, it indicates that the data stored in the leaf nodes of the left B+ tree is in an inactive state.
[0064] Alternatively, in an alternative implementation, to achieve real-time minute-level data cleaning and merging, a leaf identifier bit, denoted as flag_left_file, can be added to the leaf nodes of the left B+ tree.
[0065] In summary, in one optional implementation, a left B+ tree can be constructed with the IMSI code as the key, and the key value of the leaves of this tree is {Eci,STime,flag_left_file,flag_active_left}.
[0066] It should be noted that if flag_left_file = 0 and the IMSI code is the same within the preset time, no insertion operation will be performed on the left B+ tree.
[0067] For the right B+ tree, a right B+ tree can be constructed using the IMSI code as the key, with each Eci as the classification identifier (i.e., a hash value). The leaves of this right B+ tree store the value of the start time STime B for each user's location data change to that user, and the right B+ tree's activation flag flag_active_right, denoted as {STime B, flag_active_right}. Here, flag_active_right describes the activation state of the data stored in the right B+ tree leaf nodes. Specifically, a value of 1 for flag_active_right indicates an active state; a value of 0 indicates a deactive state.
[0068] Optionally, to facilitate the determination of information such as the number of users per minute (UnumPerMin) in a user's cell and the dwell time (long int Eci) at the location, the structure of the right B+ tree can also contain a variable of UnumPerMin. For example, the structure of the right B+ tree can be {long int Eci, long int UnumPerMin, BPlusTree*T}, where BPlusTree*T represents that the value stored in the leaves of the right B+ tree is the initial start time and state.
[0069] The above content describes the construction of the left B+ tree and the right B+ tree in this application. The specific implementation method of step 12 in this application will be described in detail below in conjunction with the construction of the left B+ tree and the right B+ tree.
[0070] like Figure 1b As shown, in this embodiment of the application, the search results can be obtained through the methods provided in steps 121 to 124.
[0071] Step 121: Based on the identity information, search the left B+ tree to find whether there is user location data for a user whose identity information matches the identity information.
[0072] In an optional implementation, considering that during the people flow analysis process, when searching the left B+ tree based on identity information, in addition to the possibility that user location data matching the identity information might not be found in the left B+ tree due to the inactivity of leaf node data, if a user abnormally leaves the network, it may also result in the user location data not being found in the left B+ tree. Therefore, to avoid invalid insertion operations on the left and right B+ trees in the event of a user abnormally leaving the network, in this embodiment of the application, before executing step 121, it can be pre-determined whether the user to be analyzed is currently online.
[0073] In this embodiment of the application, when determining whether the user to be analyzed is online, the information of the process type (PType) field in the DPI data can be used for judgment. If the information of the PType field is 'Ue_release_context', it is considered that the user to be analyzed is offline; otherwise, if the information of the PType field is not equal to 'Ue_release_context', it is considered that the user to be analyzed is online.
[0074] The first scenario: When the user to be analyzed is offline, if no user location data matching the identity information is found in the left B+ tree, the operation ends. If user location data matching the identity information is found in the left B+ tree, the value of the activation flag flag_active_left of the left B+ tree is further determined. If flag_active_left = 0, the operation ends; if flag_active_left = 1, the activation flag of the leaf node storing the user's location data in the left B+ tree is set to 0, and the user location data stored in that leaf node is returned.
[0075] The second scenario: When the user to be analyzed is online, which is the scenario that this application will focus on describing, please refer to steps 122 to 124 below for details.
[0076] Step 122: If, based on the identity information, no user location data matching the identity information is found in the left B+ tree, a first leaf node can be inserted into the left B+ tree, and the latest user location data and the latest location change time to the latest user location data can be stored in the first leaf node using the identity information as the key.
[0077] Optionally, the value in the first leaf node may also include flag_left_file and flag_active_left, where flag_left_file can be assigned a value of 0 and flag_active_left can be assigned a value of 1.
[0078] Step 123: Insert the second leaf node into the right B+ tree, and store the latest user location data and the latest location change time into the second leaf node according to the identity information.
[0079] Optionally, if the right B+ tree also includes the number of users per minute in the user's cell (UnumPerMin), after storing the latest user location data and the latest location change time to the second leaf node, an increment operation can be performed on UnumPerMin under the category of Eci in the user's cell, indicating that the value of the number of users per minute in the user's cell (UnumPerMin) increases by 1.
[0080] Step 124: Obtain the search result based on the information stored in the first leaf node and the information stored in the second leaf node.
[0081] Alternatively, in an optional implementation, when the user to be analyzed is online, if, after executing step 121, user location data matching the identity information is found, then in this embodiment of the application, if... Figure 1c As shown, it also includes the following steps:
[0082] Step 1202: Determine the activation flag and leaf flag of the left B+ tree.
[0083] Step 1204: Update the left B+ tree and right B+ tree according to preset rules based on the activation identifier, leaf identifier, latest user location data, and latest location change time.
[0084] First scenario:
[0085] If flag_active_left = 0, then:
[0086] Update the left B+ tree: Update the leaf node {Eci, STime, flag_left_file, flag_active_left} that matches the identity information (assuming it is Imsi1). Assign Eci the latest user location data Eci1, assign STime the latest location change time STime2, flag_left_file = 0, flag_active_left = 1.
[0087] Update the right B+ tree: Find the category with Eci1 as the class identifier, Imsi1 as the key, and assign its value to {STime2, flag_active_right=1}. Under the category of Eci1, UnumPerMin=UnumPerMin+1.
[0088] The second scenario:
[0089] If flag_active_left = 1 and flag_left_file = 0, then the operation ends.
[0090] The third scenario:
[0091] If flag_active_left = 1 and flag_left_file = 1, then further compare Eci:
[0092] (1) If Eci1 = Eci, then no operation is performed on the right B+ tree; for the left B+ tree, STime is directly assigned to STime2, and flag_left_file = 0;
[0093] (2) If Eci1 is not equal to Eci, then,
[0094] For right B+ trees:
[0095] i. Find the corresponding cell classification identifier using Eci, then find the user node based on Imsi1, and perform the operation of flag_active_right=0 and UnumPerMin=UnumPerMin-1.
[0096] ii. Using Eci1 as the cell classification identifier, check if a node with key Imsi1 exists:
[0097] (A) If it exists, its value is {STime2, flag_active_right = 1}, UnumPerMin = UnumPerMin + 1;
[0098] (B) If it does not exist, insert a new node Imsi1 with the value STime = STime2, flag_active_right = 1, and UnumPerMin = UnumPerMin + 1;
[0099] For left B+ trees: STime can be directly assigned the value STime2, Eci updated to Eci1, and flag_left_file = 0.
[0100] Step 1206: Obtain the search results based on the updated information stored in the left B+ tree and the right B+ tree.
[0101] Optionally, in this embodiment, the search result can be a minute-level file directly output based on preset capture time SnapTime, Eci, and UnumPerMin. SnapTime can also be understood as the preset time for outputting file information from the leaf node.
[0102] Optionally, if the number of minutes of the photo capture time (SnapTime) is a multiple of 10 (SnapTime%SnapInterval = 0 (divisible)), a detailed list including Eci, identity information, and duration of stay can be output.
[0103] Step 13: Based on the search results, determine the user trajectory information of the user to be analyzed and the dwell time of each user location in the user trajectory information.
[0104] Using the method provided in this application, when it is necessary to analyze user behavior trajectory information, the latest user location data and latest location change time of the user can be found from the left B+ tree based on the user's identity information. Additionally, the location data of each user and the location change time to each location can be found from the B+ tree based on the user's identity information. Then, the user trajectory information of the user and the dwell time of each user location in the trajectory information are determined based on the found information. Compared with related technologies, on the one hand, since this method does not require pre-entering user location data into the database, it can avoid database entry delays. On the other hand, due to the characteristics of the B+ tree itself (the leaf nodes of the B+ tree are connected sequentially using pointers, and the entire tree can be traversed by traversing the leaf nodes), when searching for user location information in the left and right B+ trees, the data query range can be reduced, the query time shortened, and processing latency reduced.
[0105] Example 2
[0106] Please see Figure 2a This is a schematic diagram illustrating the implementation flow of a method for constructing the left B+ tree and right B+ tree involved in Embodiment 1 above, provided by an embodiment of this application. The flow specifically includes the following steps:
[0107] Step 21: Obtain the user's identity information, user location data, and the location change time to the user's location data.
[0108] Identity identification information is used to uniquely identify a user. In this embodiment of the application, identity identification information may be, for example, the International Mobile Subscriber Identification Number (IMSI), ID card number, etc.
[0109] In this embodiment of the application, the user location data and the location change time to the user location data can be determined based on deep packet inspection (DPI) data. The DPI data can be used to characterize the changes in the user location data of the user to be analyzed or the on-network / off-network status of the user to be analyzed, and can realize the analysis of the user's stay status.
[0110] Optional, DPI data may be, for example, DPI data corresponding to messages such as Attach, Service Request, TAU, UE context release, X2 handover, S1 handover in, and S1 handover out.
[0111] Optionally, before determining the user location data and the location change time to the user location data based on the DPI data, the signaling data of the S1-MME (LTE eNodeB and MME signaling plane) can be collected using optical splitting technology. Then, the DPI data corresponding to messages such as Attach, Service Request, TAU, UE context release, X2 handover, S1 handover, and S1 handover can be filtered out from the collected signaling data to obtain the DPI data.
[0112] Among them, the DPI data corresponding to messages such as Attach, Service Request, TAU, UE context release, X2 handover, S1 handover in, and S1 handover out can all be used to characterize the user's location changes.
[0113] Step 22: Using the user's identity information as the key, and the latest user location data and the latest location change time to the latest user location data in the user location data as the key values of the leaf nodes, construct a left B+ tree.
[0114] Step 23: Based on the region identifier of the area to which the user location data belongs, construct a right B+ tree with identity information as the key and the location change time of each user location data as the key value of the leaf node.
[0115] For specific implementation methods of steps 22 and 23, please refer to the relevant content in Example 1. To avoid redundancy, they will not be described in detail here.
[0116] In one optional implementation, considering that the right B+ tree is used to store all user location data and change times of each user location data, the amount of data to be stored is relatively large. In order to avoid the storage amount exceeding the storage capacity of the right B+ tree and causing data loss, in this embodiment of the application, when it is determined that the amount of data stored in the right B+ tree is greater than a preset threshold, a new right B+ tree can be reconstructed.
[0117] like Figure 2b As shown, the steps for reconstructing the right B+ tree include the following:
[0118] Step 240: Determine the number of leaf nodes in the right B+ tree whose activation flag is inactive.
[0119] Step 242: When the number of leaf nodes is greater than the preset threshold, the right B+ tree is reconstructed; wherein, the preset threshold is determined based on the user traffic within a preset time period in the region to which the user location data belongs.
[0120] Optionally, when the number of leaf nodes exceeds a preset threshold, the region identifier, key, and key value of the leaf node of the right B+ tree can be obtained; the region identifier, key, and key value of the leaf node of the right B+ tree can be stored in a preset storage space, and the preset storage space is associated with the right B+ tree.
[0121] In one optional implementation, considering that some users may have been offline for a long time in practical applications, but their location data and other information are still stored in the left and right B+ trees, this can easily lead to a waste of storage resources in the left and right B+ trees. This application embodiment also provides an initialization and aging cycle management method for the left and right B+ trees, that is, periodically clearing the location data and other information of users who have been offline for a long time from the left and right B+ trees. Figure 2c As shown, this initialization and aging cycle management method includes the following steps:
[0122] Step 260: Initialize the leaf identifier bits of the leaf nodes of the left B+ tree.
[0123] In this embodiment of the application, the leaf identifier flag_left_file of the leaf node of the left B+ tree can be initialized to 1.
[0124] Step 262: When the activation flag of the left B+ tree is active, determine the user's abnormal disconnection time.
[0125] In this embodiment, the user's abnormal disconnection time can be determined based on the photo capture time and the change time to the user's location data. For example, AgingTime = SnapTime - STime, where AgingTime represents the user's abnormal disconnection time, SnapTime represents the photo capture time, and STime represents the change time to the user's location data.
[0126] Step 264: When the abnormal offline time is greater than or equal to the preset abnormal time threshold, the activation flag in the leaf node storing the user in the left B+ tree is changed to the inactive state, and the area flag of the region to which the user's location data belongs is recorded.
[0127] The preset abnormal time threshold can be determined based on practical experience. In this embodiment, the preset abnormal time threshold can be, for example, 54 minutes. It should be noted that the above 54 minutes is merely an exemplary illustration of this embodiment and does not impose any limitation on this embodiment.
[0128] Step 266: Based on the region identifier, find the leaf node in the right B+ tree that stores the user's location data.
[0129] Using the previous example, if AgingTime>=54 minutes, then find the node in the right B+ tree that matches the category identifier and the region identifier based on the region identifier, and the key is the node that matches the user identity identifier.
[0130] Step 268: Change the user traffic information within the preset time period stored in the leaf node.
[0131] In this embodiment of the application, the user traffic information within a preset time period can be decremented by 1, that is, the value of user traffic within the preset time period is decremented by 1.
[0132] Using the method provided in this application embodiment, a left B+ tree is constructed with the user's identity information as the key and the latest user location data and the latest location change time to the latest user location data as the key values of the leaf nodes. Based on the region identifier of the area to which the user location data belongs, a right B+ tree is constructed with the identity information as the key and the location change time to each user location data as the key value of the leaf nodes. This enables the storage of user location data and other data. Compared with the database storage used in related technologies, this method can achieve rapid updating and recording of real-time user location data and achieve rapid real-time minute-level updates.
[0133] Example 3
[0134] To address the issues of significant data entry and processing delays that may arise from existing database-based crowd flow analysis methods, this application provides a B+ tree-based crowd flow analysis device. A schematic diagram of the device's structure is shown below. Figure 3 As shown, it includes an acquisition module 31, a construction module 32, and a determination module 33. The functions of each module are as follows:
[0135] The acquisition module 31 is used to acquire the deep packet inspection data and identity information of the user to be analyzed. The deep packet inspection data includes the user's location data and the first change time to the user's location data.
[0136] The search module 32 is used to search in the pre-constructed left B+ tree and right B+ tree respectively based on the identity information, user location data and the first change time to obtain the search results; wherein, the left B+ tree is used to record the user's identity information, the latest user location data and the second change time to the latest user location data; the right B+ tree is used to record the user's identity information, each user's location data and the third change time to each user location data.
[0137] The determination module 33 is used to determine the user trajectory information of the user to be analyzed and the dwell time of each user location in the user trajectory information based on the search results.
[0138] Optionally, the search module 32 is used to: search the left B+ tree for user location data that matches the identity information; if not, insert a first leaf node in the left B+ tree and store the latest user location data and the latest location change time in the user location data, using the identity information as the key, in the first leaf node; insert a second leaf node in the right B+ tree and store the latest user location data and the latest location change time in the second leaf node, based on the identity information; and obtain the search result based on the information stored in the first leaf node and the information stored in the second leaf node.
[0139] Optionally, if user location data matching the identity information exists in the left B+ tree, the B+ tree-based people flow analysis device is further used to: determine the activation identifier and leaf identifier of the left B+ tree; update the left B+ tree and right B+ tree according to preset rules based on the activation identifier, leaf identifier, latest user location data, and latest location change time; and obtain the search results based on the information stored in the updated left B+ tree and right B+ tree.
[0140] Using the apparatus provided in this application embodiment, when it is necessary to analyze user behavior trajectory information, the latest user location data and latest location change time of the user can be found from the left B+ tree based on the user's identity information. Additionally, the location data of each user and the location change time to each user location can be found from the B+ tree based on the user's identity information. Then, the user trajectory information of the user to be analyzed and the dwell time of each user location in the user trajectory information are determined based on the found information. Compared with related technologies, on the one hand, since this method does not require pre-entering user location data into the database, it can avoid database entry delays. On the other hand, due to the characteristics of the B+ tree itself (the leaf nodes of the B+ tree are connected sequentially using pointers, and the entire tree can be traversed by traversing the leaf nodes), when searching for user location information in the left and right B+ trees, the data query range can be reduced, the query time shortened, and thus the processing latency reduced.
[0141] Example 4
[0142] This application provides a device for constructing a dual B+ tree, the specific structure of which is shown in the schematic diagram below. Figure 4 As shown, it includes an information acquisition module 41, a left tree construction module 42, and a right tree construction module 43. The functions of each module are as follows:
[0143] Information acquisition module 41 is used to acquire user identification information, user location data, and location change time to the user location data;
[0144] The left tree construction module 42 is used to construct a left B+ tree using the user's identity information as the key, the latest user location data in the user location data and the latest location change time to the latest user location data as the key values of the leaf nodes;
[0145] The right tree construction module 43 is used to construct a right B+ tree based on the region identifier of the region to which the user location data belongs, with the identity information as the key and the location change time of each user location data as the key value of the leaf node.
[0146] Optionally, the double B+ tree construction device can also be used to: determine the number of leaf nodes in the right B+ tree whose activation flag is inactive; and reconstruct the right B+ tree when the number of leaf nodes is greater than a preset threshold; wherein the preset threshold is determined based on the user traffic within a preset time period in the area to which the user location data belongs.
[0147] Optionally, the double B+ tree construction device can also be used to: when the number of leaf nodes is greater than a preset threshold, obtain the region identifier, key, and key value of the leaf node of the right B+ tree; store the region identifier, key, and key value of the leaf node of the right B+ tree into a preset storage space, wherein the preset storage space is associated with the right B+ tree.
[0148] Optionally, the dual B+ tree construction device can also be used to: initialize the leaf identifier bits of the leaf nodes of the left B+ tree; determine the abnormal disconnection time of the user when the activation identifier of the left B+ tree is in an active state; when the abnormal disconnection time is greater than or equal to a preset abnormal time threshold, change the activation identifier in the leaf node storing the user in the left B+ tree to an inactive state, and record the region identifier of the area to which the user's location data belongs; search for the leaf node storing the user's location data in the right B+ tree according to the region identifier; and change the user traffic information within a preset time period stored in the leaf node.
[0149] Using the device provided in this application embodiment, a left B+ tree is constructed with the user's identity information as the key and the latest user location data and the latest location change time to the latest user location data as the key values of the leaf nodes. Based on the region identifier of the area to which the user location data belongs, a right B+ tree is constructed with the identity information as the key and the location change time to each user location data as the key value of the leaf nodes. This enables the storage of user location data and other data. Compared with the database storage used in related technologies, this device can achieve rapid real-time updates and recording of user location data, and can achieve rapid real-time minute-level updates.
[0150] Example 5
[0151] This application relates to an electronic device, such as... Figure 5 As shown. At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, network interface, and memory. The memory may include main memory, such as high-speed random-access memory (RAM), or it may include non-volatile memory, such as at least one disk drive. Of course, the electronic device may also include other hardware required for other business operations.
[0152] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 It is indicated by a single double-headed arrow, but does not mean that there is only one bus or one type of bus.
[0153] Memory is used to store programs. Specifically, programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.
[0154] The processor reads the corresponding computer program from non-volatile memory into main memory and then executes it, forming a B+ tree-based crowd flow analysis method device at the logical level. The processor executes the program stored in memory and specifically performs the following operations:
[0155] Acquire deep packet inspection data and identity information of the user to be analyzed. The deep packet inspection data includes the user's location data and the first change time to the user's location data.
[0156] Based on the identity information, user location data, and the first change time, the search results are obtained by searching in the pre-constructed left B+ tree and right B+ tree respectively. The left B+ tree is used to record the user's identity information, the latest user location data, and the second change time to the latest user location data. The right B+ tree is used to record the user's identity information, each user's location data, and the third change time to each user's location data.
[0157] Based on the search results, determine the user trajectory information of the user to be analyzed and the dwell time of each user location in the user trajectory information.
[0158] Alternatively, the processor reads the corresponding computer program from non-volatile memory into memory and runs it, forming a double B+ tree construction method at the logical level. The processor executes the program stored in memory and specifically performs the following operations:
[0159] Obtain the user's identity information, user location data, and the time of location change to the user's location data;
[0160] Using the user's identity information as the key, and the latest user location data and the latest location change time to the latest user location data as the key values of the leaf nodes, a left B+ tree is constructed;
[0161] Based on the region identifier of the area to which the user location data belongs, construct a right B+ tree with identity information as the key and the location change time of each user location data as the key value of the leaf node.
[0162] The B+ tree-based crowd flow analysis method or double B+ tree construction method provided in this specification can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed through integrated logic circuits in the processor's hardware or through software instructions. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this specification. The general-purpose processor can be a microprocessor or any conventional processor.
[0163] The steps of the method disclosed in the embodiments of this specification can be directly manifested as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0164] This specification also provides a computer-readable storage medium storing one or more programs, the programs including instructions that, when executed by an electronic device including multiple applications, enable the electronic device to perform a B+ tree-based people flow analysis method, specifically for performing:
[0165] Acquire deep packet inspection data and identity information of the user to be analyzed. The deep packet inspection data includes the user's location data and the first change time to the user's location data.
[0166] Based on the identity information, user location data, and the first change time, the search results are obtained by searching in the pre-constructed left B+ tree and right B+ tree respectively. The left B+ tree is used to record the user's identity information, the latest user location data, and the second change time to the latest user location data. The right B+ tree is used to record the user's identity information, each user's location data, and the third change time to each user's location data.
[0167] Based on the search results, determine the user trajectory information of the user to be analyzed and the dwell time of each user location in the user trajectory information.
[0168] Alternatively, the computer-readable storage medium stores one or more programs, which include instructions that, when executed by an electronic device including multiple applications, enable the electronic device to perform a method for constructing a double B+ tree, and specifically for performing:
[0169] Obtain the user's identity information, user location data, and the time of location change to the user's location data;
[0170] Using the user's identity information as the key, and the latest user location data and the latest location change time to the latest user location data as the key values of the leaf nodes, a left B+ tree is constructed;
[0171] Based on the region identifier of the area to which the user location data belongs, construct a right B+ tree with identity information as the key and the location change time of each user location data as the key value of the leaf node.
[0172] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions. A typical implementation device is a computer.
[0173] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.
[0174] Those skilled in the art will understand that embodiments of this specification can be provided as methods, apparatus, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0175] This specification is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.
[0176] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0177] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0178] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0179] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0180] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data.
[0181] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0182] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
Claims
1. A method for constructing a double B+ tree, characterized in that, include: Obtain the user's identity information, user location data, and the time of location change to the user's location data; Using the user's identity information as the key, and the latest user location data and the latest location change time to the latest user location data in the user location data as the key values of the leaf nodes, a left B+ tree is constructed; Based on the region identifier of the area to which the user location data belongs, construct a right B+ tree with the identity information as the key and the location change time of each user location data as the key value of the leaf node; The key value of the leaf node of the right B+ tree includes the activation identifier of the right B+ tree, then, Determine the number of leaf nodes in the right B+ tree whose activation flag is inactive; When the number of leaf nodes exceeds a preset threshold, the right B+ tree is reconstructed; wherein the preset threshold is determined based on user traffic within a preset time period in the region to which the user location data belongs. Initialize the leaf identifier bits of the leaf nodes of the left B+ tree; When the activation flag of the left B+ tree is active, the abnormal disconnection time of the user is determined. When the abnormal offline time is greater than or equal to the preset abnormal time threshold, the activation flag in the leaf node storing the user in the left B+ tree is changed to an inactive state, and the region flag of the area to which the user's location data belongs is recorded. Based on the region identifier, locate the leaf node storing the user's location data from the right B+ tree; Change the user traffic information within the preset time period stored in the leaf node.
2. The method as described in claim 1, characterized in that, The method further includes: When the number of leaf nodes exceeds a preset threshold, the region identifier, the keyword, and the key value of the leaf node of the right B+ tree are obtained. The region identifier, the keyword, and the key value of the leaf node of the right B+ tree are stored in a preset storage space, and the preset storage space is associated with the right B+ tree.
3. A pedestrian flow analysis method based on B+ trees, characterized in that, The B+ tree is constructed using the double B+ tree construction method as described in claim 1, including: Acquire deep packet inspection data and identity information of the user to be analyzed. The deep packet inspection data includes the user's location data and the first change time to the user's location data. Based on the identity information, the user location data and the first change time are searched in the pre-constructed left B+ tree and right B+ tree respectively to obtain the search results; wherein, the left B+ tree is used to record the user's identity information, the latest user location data, and the second change time to the latest user location data; the right B+ tree is used to record the user's identity information, each user location data, and the third change time to each user location data. Based on the search results, determine the user trajectory information of the user to be analyzed and the dwell time of each user location in the user trajectory information.
4. The method as described in claim 3, characterized in that, Based on the identity information, the user location data and the first change time are searched in the pre-constructed left B+ tree and right B+ tree respectively to obtain search results, including: Based on the identity information, search the left B+ tree to find whether there is user location data of a user that matches the identity information; If not, insert a first leaf node into the left B+ tree, and store the latest user location data and the latest location change time to the latest user location data in the user location data into the first leaf node, using the identity information as the key. Insert a second leaf node into the right B+ tree, and store the latest user location data and the latest location change time into the second leaf node according to the identity information; The search result is obtained based on the information stored in the first leaf node and the information stored in the second leaf node.
5. The method as described in claim 4, characterized in that, The method further includes: If the user location data of a user that matches the identity information exists in the left B+ tree, then the activation identifier and leaf identifier of the left B+ tree are determined. Based on the activation identifier, leaf identifier, latest user location data, and latest location change time, update the left B+ tree and right B+ tree according to preset rules; The search result is obtained based on the updated information stored in the left B+ tree and the information stored in the right B+ tree.
6. A device for constructing a double B+ tree, characterized in that, include: The information acquisition module is used to acquire the user's identity information, user location data, and the location change time to the user's location data; The left tree construction module is used to construct a left B+ tree using the user's identity information as the key, and the latest user location data and the latest location change time to the latest user location data in the user location data as the key values of the leaf nodes; The right tree construction module is used to construct a right B+ tree based on the region identifier of the region to which the user location data belongs, with the identity information as the key and the location change time of each user location data as the key value of the leaf node; Determine the number of leaf nodes in the right B+ tree whose activation flag is inactive; When the number of leaf nodes exceeds a preset threshold, the right B+ tree is reconstructed; the preset threshold is determined based on the user traffic within a preset time period in the region to which the user location data belongs. Initialize the leaf identifier bits of the leaf nodes of the left B+ tree; When the activation flag of the left B+ tree is active, the abnormal disconnection time of the user is determined. When the abnormal offline time is greater than or equal to the preset abnormal time threshold, the activation flag in the leaf node storing the user in the left B+ tree is changed to an inactive state, and the region flag of the area to which the user's location data belongs is recorded. Based on the region identifier, locate the leaf node storing the user's location data from the right B+ tree; Change the user traffic information within the preset time period stored in the leaf node.
7. A pedestrian flow analysis device based on a B+ tree, characterized in that, The B+ tree-based crowd flow analysis device uses the double B+ tree construction device as described in claim 6 to construct the B+ tree; The B+ tree-based crowd flow analysis device includes an acquisition module, a search module, and a determination module, wherein: The acquisition module is used to acquire the deep packet inspection data and identity information of the user to be analyzed. The deep packet inspection data includes the user location data of the user to be analyzed and the first change time of the change to the user location data. The search module is used to search in a pre-constructed left B+ tree and a right B+ tree respectively based on the identity information, the user location data, and the first change time to obtain search results; wherein, the left B+ tree is used to record the user's identity information, the latest user location data, and the second change time to the latest user location data; the right B+ tree is used to record the user's identity information, each user location data, and the third change time to each user location data; The determination module is used to determine the user trajectory information of the user to be analyzed and the dwell time of each user location in the user trajectory information based on the search results.
8. An electronic device, characterized in that, include: The memory, the processor, and the computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method for constructing a double B+ tree as described in any one of claims 1 to 2 or the steps of the method for analyzing pedestrian flow based on a B+ tree as described in any one of claims 3 to 5.
Citation Information
Patent Citations
Method for indexing uncertain moving objects on basis of group division
CN105512317A
User behavior data processing method and device, equipment and storage medium
CN111679963A