Stream graph-based top-k frequent pattern mining method, device and equipment
By optimizing the mining of frequent patterns in flow graphs using the auxiliary data structure FPC and the enhanced data structure FPCS, the problem of threshold setting is solved, the consumption of computing resources is reduced, and the mining efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202310301121.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-24
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-03-24
AI Technical Summary
When mining frequent patterns in flow graphs, it is difficult to determine the threshold setting, which leads to the problem of discovering too few patterns or exhausting computing resources. This is especially true in large-scale and highly dynamic social networks, where existing algorithms consume too much memory and time.
We employ the auxiliary data structure FPC and the enhanced data structure FPCS. We map subgraphs using hash functions and store pattern IDs, frequencies, and identifiers using counters and subgraph sets. By combining vertical hashing and linear congruence methods, we optimize the frequent pattern mining process and reduce computational load and memory consumption.
It effectively reduces computational load and memory consumption, improves the accuracy and speed of frequent pattern mining, reduces resource consumption, and improves mining efficiency.
Smart Images

Figure CN116450897B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data mining, in particular to a Top-K frequent pattern mining method, device and equipment based on a stream graph. BACKGROUND
[0002] The development and universal application of social networks have led a large number of researchers to turn to the research on network association, such as the association between the users of a social network, the forwarding, the comments, the mentions and the like, which hide a lot of valuable knowledge. To establish different types of complex relationships in a social network by taking a stream graph as a data structure to mine the knowledge hidden in the data has become a research hotspot in recent years. It has application prospects in the analysis of user influence in a social network, enterprise advertising marketing, community discovery and the like.
[0003] Frequent pattern mining on a stream graph has important practical uses. For example, in the graph data of a music streaming service and its users, when a user (node) listens to the same song within a certain time interval, the edges are temporarily connected. With the passage of time, analyzing frequent patterns enables us to study the user's taste for music and use this information for song recommendations.
[0004] An important difficulty in finding all frequent subgraphs in a stream graph is that it is difficult to set a user-defined threshold. If the threshold is set too low, few patterns are found, and the user may miss valuable information. Conversely, if the threshold is set too high, millions of subgraphs may be found, and the algorithm may have a long execution time, even running out of memory or storage space. For this reason, we focus on the top-k subgraph pattern mining problem, that is, finding the k most frequent interesting subgraphs on a stream graph.
[0005] The large scale and high dynamics make it both memory and time consuming to track the exact changes in the frequency of all subgraph patterns at all times. Approximate value calculation is a natural choice. Many recent studies have developed frequent pattern mining in evolving graphs, and these methods can be modified to provide the top-k frequent subgraph patterns when new data arrives. By using the reservoir sampling method to maintain uniform sample subgraphs, the uniformity of the samples is ensured after the edges are inserted. Based on the sample subgraphs, we can estimate the frequency of different patterns, and then rank all subgraph patterns to obtain the top-k results.
[0006] Since the estimation accuracy depends on the sample size, the algorithm needs to sample a large number of subgraphs from the stream graph to accurately mine the top-k frequent patterns, which is very memory-consuming. In addition, the algorithm needs to perform expensive subgraph matching calculations on these sampled subgraphs to estimate the frequency of each pattern after all updates have occurred, which is very time-consuming. Therefore, advanced techniques are needed to effectively mine the top-k frequent patterns. SUMMARY
[0007] Therefore, it is necessary to provide a Top-K frequent pattern mining method, device and equipment based on a stream graph in view of the above technical problems.
[0008] A Top-K frequent pattern mining method based on a stream graph, the method comprising:
[0009] initializing an initial auxiliary data structure FPC comprising l blocks, the initial value of each block being empty, the blocks comprising: a counter and a subgraph set, wherein the subgraph set comprises d cells, and the cells are used to store a subgraph pattern ID, a frequency and an identifier; l and d are both integers greater than 0.
[0010] obtaining a stream graph of a social network at time t, and adding an inserted edge received at time t+1 to the stream graph at time t to obtain a stream graph at time t+1; the stream graph is a graph of the social network observed up to a specific time, and comprises a plurality of data items, and each data item is an edge between two vertices arriving at the specific time.
[0011] mining all m-edge subgraphs containing the inserted edge in the stream graph at time t+1 to obtain an m-edge subgraph set; wherein m is an integer greater than 0.
[0012] mapping each m-edge subgraph in the m-edge subgraph set to an m-edge subgraph sequence.
[0013] mapping each subgraph in the m-edge subgraph sequence to a block of the auxiliary data structure FPC by using a hash function to obtain a final auxiliary data structure FPC.
[0014] estimating the frequency of each pattern according to the final auxiliary data structure FPC, and calculating a top-k interesting m-edge pattern set according to the estimation result of the frequency of each pattern; wherein k is an integer greater than 0.
[0015] A Top-K frequent pattern mining device based on a stream graph, the device comprising:
[0016] An auxiliary data structure FPC initialization module configured to initialize an initial auxiliary data structure FPC comprising l blocks, the initial value of each block being empty, the blocks comprising: a counter and a subgraph set, wherein the subgraph set comprises d cells, and the cells are used to store a subgraph pattern ID, a frequency and an identifier; l and d are both integers greater than 0.
[0017] A stream graph at time t+1 obtaining module configured to obtain a stream graph of a social network at time t, and add an inserted edge received at time t+1 to the stream graph at time t to obtain a stream graph at time t+1; the stream graph is a graph of the social network observed up to a specific time, and comprises a plurality of data items, and each data item is an edge between two vertices arriving at the specific time.
[0018] An m-edge subgraph sequence determination module is configured to mine all m-edge subgraphs containing the inserted edge in the stream graph at time t+1 to obtain an m-edge subgraph set; wherein m is an integer greater than 0; and each m-edge subgraph in the m-edge subgraph set is mapped to an m-edge subgraph sequence.
[0019] An auxiliary data structure FPC updating module is configured to map each subgraph in the m-edge subgraph sequence to a block in the auxiliary data structure FPC by using a hash function to obtain a final auxiliary data structure FPC.
[0020] A Top-K frequent pattern mining module is configured to estimate the frequency of each pattern according to the final auxiliary data structure FPC, and calculate a Top-K interesting m-edge pattern set according to the estimation result of the frequency of each pattern; wherein k is an integer greater than 0.
[0021] A Top-K frequent pattern mining method based on a stream graph, the method comprising:
[0022] An initial enhanced auxiliary data structure FPCS including l blocks is initialized, and the initial value of each block is empty; the blocks include a counter and a subgraph set, wherein the subgraph set includes d cells, and the cells are used to store the pattern ID, frequency, fingerprint f(s i ) and identification of a subgraph; wherein l and d are integers greater than 0, f(s i )=h(s i )%F, F is the upper bound of the fingerprint, and h(s i ) is a subgraph s i The hash value after the first hash function processing.
[0023] A stream graph of a social network at time t is obtained, and an inserted edge received at time t+1 is added to the stream graph at time t to obtain a stream graph at time t+1; the stream graph is a graph of the social network observed up to a specific time, and includes a plurality of data items, wherein the data items are edges between two vertices arriving at the specific time.
[0024] All m-edge subgraphs containing the inserted edge in the stream graph at time t+1 are mined to obtain an m-edge subgraph set; wherein m is an integer greater than 0.
[0025] Each m-edge subgraph in the m-edge subgraph set is mapped to an m-edge subgraph sequence.
[0026] An optimization strategy of vertical hashing is used to calculate the storage block address sequence of each subgraph in the m-edge subgraph sequence.
[0027] According to the storage block address sequence, w storage blocks are selected by using a linear congruence method to obtain candidate storage blocks, and each subgraph in the m-edge subgraph sequence is mapped into a corresponding candidate storage block to obtain a final enhanced auxiliary data structure FPCS.
[0028] According to the final enhanced auxiliary data structure FPCS, the frequency of each pattern is estimated, and the top-k interesting m-edge pattern set is calculated according to the estimation result of the frequency of each pattern; wherein k is an integer greater than 0.
[0029] A Top-K frequent pattern mining device based on a stream graph, the device comprising:
[0030] An enhanced auxiliary data structure FPCS initialization module is configured to initialize an initial enhanced auxiliary data structure FPCS comprising l blocks, and the initial value of each block is empty, and the blocks comprise: a counter and a subgraph set, wherein the subgraph set comprises d cells, and the cells are used to store the pattern ID, frequency, fingerprint f(s i ) and identification of the subgraph; wherein l and d are both integers greater than 0, f(s i )=h(s i )%F, F is the upper bound of the fingerprint, and h(s i ) is the subgraph s i The hash value processed by the first hash function.
[0031] A stream graph acquisition module is configured to acquire a stream graph of a social network at time t, and add an inserted edge received at time t+1 to the stream graph at time t to obtain a stream graph at time t+1; the stream graph is a graph of the social network observed up to a specific time, comprising a plurality of data items, and the data items are edges between two vertices arriving at the specific time.
[0032] An m-edge subgraph sequence determination module is configured to mine all m-edge subgraphs containing the inserted edge from the stream graph at time t+1 to obtain an m-edge subgraph set; wherein m is an integer greater than 0; and each m-edge subgraph in the m-edge subgraph set is mapped into an m-edge subgraph sequence.
[0033] An enhanced auxiliary data structure FPCS updating module is configured to calculate the storage block address sequence of each subgraph in the m-edge subgraph sequence by using an optimization strategy of vertical hashing; and according to the storage block address sequence, w storage blocks are selected by using a linear congruence method to obtain candidate storage blocks, and each subgraph in the m-edge subgraph sequence is mapped into a corresponding candidate storage block to obtain a final enhanced auxiliary data structure FPCS.
[0034] The enhanced Top-K frequent pattern mining module is used for estimating the frequency of each pattern according to the final enhanced auxiliary data structure FPCS, and calculating the top-k interesting m-edge pattern set according to the estimation result of the frequency of each pattern.
[0035] A computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of any of the above methods when executing the computer program.
[0036] The above-mentioned flow graph-based Top-K frequent pattern mining method, device and equipment. The method comprises: initializing an initial auxiliary data structure FPC including l blocks, the initial value of each block is empty, and the block includes a counter and a subgraph set; obtaining a social network flow graph; mining all m-edge subgraphs from the flow graph; mapping each m-edge subgraph to a fixed block in the FPC using a hash function; estimating the frequency of each pattern according to the auxiliary data structure FPC; and calculating the top-k interesting m-edge pattern set according to the estimation result of the frequency. Using this method reduces the calculation amount and reduces the memory loss, while improving the mining accuracy and speed of the frequent pattern. BRIEF DESCRIPTION OF DRAWINGS
[0037] Figure 1 A flowchart of the flow graph-based Top-K frequent pattern mining method in one embodiment;
[0038] Figure 2 A data structure diagram of the auxiliary data structure FPC in another embodiment;
[0039] Figure 3 A flowchart of the flow graph-based Top-K frequent pattern mining method in one embodiment;
[0040] Figure 4 An example of mapping subgraphs in the m-edge subgraph sequence to blocks in another embodiment;
[0041] Figure 5 A flowchart of the flow graph-based Top-K frequent pattern mining method in one embodiment;
[0042] Figure 6 An example of vertical hashing in another embodiment;
[0043] Figure 7 A comparison chart of the influence of the average relative error (ARE) of the memory on three models (TopKFs, TopKF and FPM) on three real data sets in another embodiment, wherein (a) is the Twitter data set, (b) is the Facebook data set, and (c) is the Enron data set;
[0044] Figure 8Figures for another embodiment showing the impact of different memory on the recall rate (RR) of three models (TopKFs, TopKF and FPM) on three real datasets, where (a) is the Twitter dataset, (b) is the Facebook dataset, and (c) is the Enron dataset;
[0045] Figure 9 Figures for another embodiment showing the impact of different memory on the precision (PR) of three models (TopKFs, TopKF and FPM) on three real datasets, where (a) is the Twitter dataset, (b) is the Facebook dataset, and (c) is the Enron dataset;
[0046] Figure 10 Figures for another embodiment showing the impact of different memory on the throughput of three models (TopKFs, TopKF and FPM) on three real datasets, where (a) is the Twitter dataset, (b) is the Facebook dataset, and (c) is the Enron dataset;
[0047] Figure 11 Figures for another embodiment showing the performance comparison of different parameter d on the Twitter dataset, where (a) is the average relative error (ARE), (b) is the recall rate (RR), (c) is the precision (PR), and (d) is the throughput;
[0048] Figure 12 Figures for another embodiment showing the performance comparison of different parameter k on the Twitter and Facebook datasets, where (a) is the impact of parameter k on the F1 score on the Twitter dataset, (b) is the impact of parameter k on the throughput on the Twitter dataset, (c) is the impact of parameter k on the F1 score on the Facebook dataset, and (d) is the impact of parameter k on the throughput on the Facebook dataset;
[0049] Figure 13 Figure for one embodiment showing the internal structure of a computer device. DETAILED DESCRIPTION
[0050] In order to make the purposes, technical solutions and advantages of the present application clearer, further detailed description will be made to the present application in combination with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
[0051] In one embodiment, as shown in Figure 1 Fig. 1, a flowchart of a Top-K frequent pattern mining method based on a flow graph (TopKF method) is provided, which comprises the following steps:
[0052] Step 100: initialize an initial auxiliary data structure FPC including l blocks, each block has an initial value of null, the block includes: a counter and a subgraph set, wherein the subgraph set includes d cells, and the cells are used to store a subgraph pattern ID, a frequency and an identifier; l and d are integers greater than 0.
[0053] Specifically, due to the following two limitations, the scalability of the baseline solution FPM is insufficient to handle large stream graphs: 1) large memory consumption: in order to ensure the accuracy of the sampling result, it is necessary to ensure that the sampling subgraph set has a certain size M, that is, M = log(1 / δ)·(4+∈) / ∈ 2 . Therefore, a large amount of m-edge subgraphs need to be stored for each timestamp, which consumes a large amount of memory. 2) large computation cost: in the frequency estimation process, whether it is to classify the sample set or to update the frequency of the pattern each time, subgraph matching is required. Since this is an NP-complete problem, a large number of subgraph matching calculations will cause high latency when processing stream graphs. Therefore, the auxiliary data structure FPC is proposed in the method to effectively estimate the frequency of each m-edge pattern. In particular, for each newly generated m-edge subgraph, we use a hash function to map it to a fixed position in the auxiliary data structure FPC. In this way, the frequency of the pattern can be directly calculated without storing any subgraph, thereby avoiding repeated subgraph isomorphism calculations.
[0054] The auxiliary data structure FPC stores the potential Top-K results with accuracy and efficiency guarantees under limited memory.
[0055] The data structure of the auxiliary data structure FPC is as shown in Figure 2 The auxiliary data structure FPC is composed of l blocks. Let B[i] be the i-th block in FPC. m Each m-edge subgraph s i is mapped to a block B[h(s i )] by a hash function h(·). Each block is composed of two parts: a counter B[i].count and a subgraph set B[i].sub. The counter can provide an unbiased estimate of the frequency of the newly generated m-edge pattern. The subgraph set is composed of d cells. Each cell is used to store a key-value pair and a flag, <ID, fre, flag>. The key is the subgraph pattern ID, which uniquely identifies a group of isomorphic subgraphs, and the value is its estimated frequency fre. The key is used to check whether the frequency is accurate or contains errors. Specifically, the application uses another hash function s(·) to map s i to {+1, -1} to update the value of the counter B[i].count in real time.
[0056] In this method, the memory size primarily depends on parameters l and d. Users can adjust these parameters according to application requirements to strike a balance between accuracy and speed. Accuracy increases with increasing d as throughput decreases. This is because more cells within a storage block reduce replacement operations when the block is full, and can increase inspection costs when two subgraphs map to the same storage block.
[0057] Step 102: Obtain the flow graph of the social network at time t, and add the inserted edge received at time t+1 to the flow graph of time t to obtain the flow graph of time t+1; the flow graph is the graph of the social network observed up to a specific time, including several data items, and the data items are the edges between two vertices reached at a specific time.
[0058] Specifically, a flow graph is a data item {e1, e2, ..., e...} n A no-boundary time evolution sequence, where each data item e i =(v1,v2,t(e i )) represents the arrival time t(e) from vertex v1 to v2. i The flow graph consists of directed edges. The sequence arrives continuously at high speed from data sources such as routers or monitors. The throughput of the flow graph varies constantly, and at each time point, there may be multiple (or no) edges arriving.
[0059] Figure 3 This shows the sequence of data items evolving over time and the flow graph G formed by the data items. Using G... t+1 This represents the graph observed up to time t.
[0060] Step 104: In the flow graph at time t+1, mine all m-edge subgraphs containing the inserted edge to obtain the set of m-edge subgraphs; where m is an integer greater than 0.
[0061] Specifically, if subgraph S m =(V S E S ) is from G t A graph consisting of m edges is called an m-edge subgraph. For any t ≥ 0, at time t+1, an insertion edge e is received and added to G. t To obtain G t+1 For G t+1 For each newly inserted edge e, use S m (e) indicates G t+1 The set of m-edge subgraphs containing e.
[0062] Step 106: Map each m-edge subgraph in the set of m-edge subgraphs to a sequence of m-edge subgraphs.
[0063] Specifically, define a function g:s i→ Seq i s i is mapped to its sequence space representation Seq i . The goal of this conversion process is to map subgraphs as string representations, so that each subgraph has a unique encoding, which is a well-known technique called graph invariant. If m-edge subgraph s i is isomorphic to subgraph s j , then m(s i ) = m(s j ). Most of the existing several graph invariants impose a lexicographic order between subgraphs, which is obviously as complex as graph isomorphism.
[0064] The present application generates a sequence of subgraphs by the degree and label of vertices in a flow graph as a graph invariant, which aims to map subgraphs as string series, and can achieve higher efficiency.
[0065] Step 108: map each subgraph in the sequence of m-edge subgraphs to a block in the auxiliary data structure FPC using a hash function, to obtain the final auxiliary data structure FPC.
[0066] Specifically, map each subgraph s i in the sequence of m-edge subgraphs to a block B[h(s i )] using a hash function h(·) with a value range of [0, l), where l is the number of blocks in the auxiliary data structure FPC.
[0067] If there exists a bijective function f: V1→ V2, such that 1) L(v) = L(f(v)), and 2) (f(v i ), f(v j )) ∈ E S , then two subgraphs and are isomorphic.
[0068] Let C be a set of m-edge subgraphs with isomorphic relations. P = (V P , E P , L) is called the m-edge pattern of C, which is isomorphic to all members in C, where V P is a set of vertices in P, E P is a set of directed edges with size m, and L is a function of assigning labels to each vertex in V P . Note that P can be obtained by deleting the ID (corresponding to the timestamp) of the vertex (corresponding to the edge) of any k-edge subgraph in C. The frequency of any m-edge pattern is defined as the number of subgraphs in C.
[0069] Figure 4The process of mapping a subgraph in the sequence of m-edge subgraphs into a block is shown as an example of block B[h(s1)]. When subgraph s2 arrives, it is mapped into block B[h(s1)], and s(s2) = 1. Since pattern p1 is isomorphic to s2, the frequency of pattern p1 is increased to 28. Since the flag of pattern p1 is false, UpdateFPC also needs to map subgraph s2 into B[h(s1)].count and set it to -25 + s(s2) = -24. When s9 is mapped into block B[h(s1)], and s(s9) = 1. There is no pattern in B[h(s1)].sub that is isomorphic to subgraph s9, and B[h(s1)].sub is full, so there is Since is less than the minimum frequency 14 in B[h(s1)].count, only subgraph s9 needs to be added to B[h(s1)].count and set to -24 + s(s9) = -23. When subgraph s 11 is mapped into block B[h(s1)], and s(s 11 ) = -1, pattern p 11 is inserted into B[h(s1)].count, and the ID field of this cell is replaced by p 11 , the frequency field is set to and the flag field is further set to false.
[0070] Step 110: estimating the frequency of each pattern according to the final auxiliary data structure FPC, and calculating the top-k interesting m-edge pattern set according to the estimation result of the frequency of each pattern; wherein k is an integer greater than 0.
[0071] Specifically, over time, frequent interactions between people in a social network can be found. The closeness or similarity of the relationship can be further explained.
[0072] In the above-mentioned flow graph-based Top-K frequent pattern mining method, the method comprises: initializing an initial auxiliary data structure FPC comprising l blocks, the initial value of each block is empty, and the block comprises: a counter and a subgraph set, obtaining a social network flow graph, mining all m-edge subgraphs from the flow graph, mapping each m-edge subgraph into a fixed block in the FPC using a hash function, estimating the frequency of each pattern according to the auxiliary data structure FPC, and calculating the top-k interesting m-edge pattern set according to the estimation result of the frequency. Using this method reduces the amount of calculation and reduces memory loss, while improving the mining accuracy and speed of frequent patterns
[0073] In one embodiment, step 108 comprises: mapping the subgraph s iAfter the first hash function processing, the corresponding block B[h(s i )] is found in the auxiliary data structure FPC according to the obtained hash value; if the subgraph s i in the m-edge subgraph sequence is isomorphic to the pattern p i in the block B[h(s j )].sub, then when the identifier of the pattern p j is true, the frequency of the pattern p j is increased by 1; when the identifier of the pattern p j is false, the frequency of the pattern p j is increased by 1, and the value of B[h(s i )].count is updated according to the subgraph s i and the second hash function; the second hash function is used to map the subgraph s i to {+1, -1}; if the subgraph s i in the m-edge subgraph sequence is not isomorphic to all patterns stored in the block B[h(s i )].sub, and the cell of the block B[h(s i )].sub is not full, then the vertex ID of the subgraph s i is deleted, the pattern p i of the subgraph s i is determined, and <p i ,1,true> is inserted into the empty cell of the block B[h(s i )].sub; if the subgraph s i in the m-edge subgraph sequence is not isomorphic to all patterns stored in the block B[h(s i )].sub, and the cell of the block B[h(s i )].sub is full, then a replacement strategy is adopted to realize that the block B[h(s i )].sub stores a pattern with a higher frequency.
[0074] In one embodiment, if the subgraph s i in the m-edge subgraph sequence is not isomorphic to all patterns stored in the block B[h(s i )].sub, and the cell of the block B[h(s i )].sub is full, then a replacement strategy is adopted to realize that the block B[h(s i )].sub stores a pattern with a higher frequency, including: multiplying the value of the counter of the block B[h(s i )] by the value obtained after the subgraph s i in the m-edge subgraph sequence is mapped by the second hash function, to obtain an estimated frequency value of the pattern of the subgraph s i ; if the estimated frequency value of the pattern is less than the value of the counter of the block B[h(s iIf the minimum frequency is found in subgraph s, then subgraph s will be... i mode p i Insert into B[h(s) i In the count; if the frequency estimate of the pattern is greater than or equal to block B[h(s)]. i If the minimum frequency is found in subgraph s, then subgraph s will be... i mode p i Insert into B[h(s) i In the `count` function, the cell containing the pattern with the lowest frequency is updated, resulting in: in This is the frequency estimate of the pattern; if the flag of the replaced pattern is true, then the replaced pattern is inserted into B[h(s)]. i ).count.
[0075] Specifically, three cases demonstrate how to extract subgraphs s from a sequence of m-edge subgraphs. i Mapped to block B[h(s) in the auxiliary data structure FPC i )]middle:
[0076] Case 1: If subgraph s i Isomorphic to B[h(s) i Pattern p in ).sub j According to pattern p j There are two cases for the flag: 1) mode p j When the flag is true, UpdateFPC increases its frequency to fre. j +1; 2) Mode p j When the flag is false, UpdateFPC not only increases its frequency, but also through s(s i Increase B[i].count(s(s) i )∈{-1,+1}).
[0077] Case 2: If subgraph s i With B[h(s) i Any schema stored in ).sub is not isomorphic, and B[h(s i If the subgraph is not full, UpdateFPC first calculates the subgraph s by deleting its vertex IDs and edge timestamps. i mode p i Then <p i ,1,true>Insert B[h(s i )].sub.
[0078] Case 3: If B[h(s)] iThe subgraph is full and has no subgraph s. i In the isomorphic pattern, UpdateFPC uses a replacement strategy to ensure B[h(s) i The ).sub stores patterns with higher frequency numbers. It uses a counter B[h(s)].sub i The frequency of each pattern is estimated unbiasedly using ).count, denoted as if Less than B[h(s)] i If the minimum frequency (fre) in the count is found, then UpdateFPC will move the subgraph s... i mode p i Insert into B[h(s)] i In ).count, s(s i Add B[h(s)] i )].count; otherwise, when p i Insert B[h(s)] i After `).count`, UpdateFPC will have the pattern p with the minimum `fre`. n Replace with mode p i Specifically, UpdateFPC sets the ID field to the pattern p. i Set the frequency digital segment to Set the flag field to false to modify the pattern p n The key-value pairs <ID, fre, flag>. If the pattern being replaced is p n If the flag is true, then the mode p n Insert B[h(s)] i )].count, which is B[h(s i ).count plus p n .fre*s(p n ).
[0079] In one embodiment, step 106 includes: obtaining a new label l(v) for each vertex based on its degree and label, and assigning e = (v) to each edge. i ,v j The new label for t(e) is denoted as l(e) = (l(v)). i ),l(v j Based on the weight of each edge and the new label of the vertex, determine the edge mapping order of the subgraph; each edge is assigned in the flow graph, and the weight of each edge is equal to the order in which the subgraph patterns appear; based on the mapping order of each edge of each m-edge subgraph in the m-edge subgraph set, obtain the subgraph sequence of each m-edge subgraph.
[0080] Specifically, first, the degree and label of vertex v are compressed together as its new label l(v). Then, for each edge e = (v... i ,v j ,t(e)), labeled l(e)=(l(v i ),l(v j Then, the weight of each edge is used to determine the edge mapping order O(·) of the subgraph. A weight w(·) is assigned to each one-sided pattern in the flow graph, equal to the order in which the patterns appear. If w(e i ) <w(e j ), then O(e i ) <O(e j Otherwise, if w(e) i )=w(e j If l(e) is the vertex degree, then the order of the encoded sequence is determined. i ) <l(e j ), then O(e i ) <O(e j Finally, for subgraph s j The mapping sequence m(s) was obtained. j )={l(e1),…,l(e n )}, where O(e i ) <O(e i+1 ).
[0081] A degree sequence is generated by using degree and label as a graph invariant. This invariant maps each subgraph to a sequence space representation in the auxiliary data structure FPC to achieve efficient pattern mining.
[0082] In one embodiment, such as Figure 5 As shown, a Top-K frequent pattern mining method (TopKFs method) based on flow graphs is provided. This method includes the following steps:
[0083] Step 500: Initialize the initial augmented auxiliary data structure FPCS, which consists of l blocks. Each block is initially empty. A block includes a counter and a sub-map set. The sub-map set contains d cells, which store the sub-map's pattern ID, frequency, and fingerprint f(s). i ) and identifier; where l and d are both integers greater than 0, f(s) i )=h(s i )%F, where F is the upper bound of the fingerprint, h(s) i ) is a subgraph s i The hash value after processing by the first hash function.
[0084] Specifically, fingerprint f(s) i )(0≤f(s i) occupies less than 8 bits.
[0085] Step 502: Obtain a flow graph of the social network at time t, and add an inserted edge received at time t+1 to the flow graph at time t to obtain a flow graph at time t+1; the flow graph is a graph of the social network observed up to a certain time, including a plurality of data items, and the data item is an edge between two vertices reached at a certain time.
[0086] Step 504: Mine all m-edge subgraphs containing the inserted edge in the flow graph at time t+1 to obtain a set of m-edge subgraphs; wherein m is an integer greater than 0.
[0087] Step 506: Map each m-edge subgraph in the set of m-edge subgraphs to an m-edge subgraph sequence.
[0088] Step 508: Calculate the storage block address sequence of each subgraph in the m-edge subgraph sequence using the optimization strategy of vertical hashing.
[0089] Specifically, the optimization strategy of vertical hashing maps the subgraph to a plurality of blocks in the FPC, and replaces the least frequently occurring pattern with a newly generated subgraph pattern. In this way, higher space utilization and higher accuracy can be achieved.
[0090] Step 510: According to the storage block address sequence, select w storage blocks using the linear congruential method to obtain candidate storage blocks, and map each subgraph in the m-edge subgraph sequence to the corresponding candidate storage block to obtain the final enhanced auxiliary data structure FPCS.
[0091] Step 512: Estimate the frequency of each pattern according to the final enhanced auxiliary data structure FPCS, and calculate the top-k interesting m-edge pattern set according to the estimation result of the frequency of each pattern; wherein k is an integer greater than 0.
[0092] In one embodiment, step 508 includes: according to the subgraph s i Using the linear congruential method, r random value sequences are obtained, and the expression of the r random value sequences is:
[0093]
[0094] wherein q1(s i ) is the first random value sequence of the subgraph s i , q x (s i ) is the xth random value sequence of the subgraph s i , r is the number of random values, and a, b and p are three constants.
[0095] According to the subgraph s iThe hash value corresponding block and random value sequence are obtained by mapping through the first hash function, and a storage block address sequence is obtained.
[0096] Specifically, in the auxiliary data structure FPC, if frequent replacement operations occur in a block, the expected high frequency pattern can also be replaced, resulting in lower accuracy. To this end, to enhance each subgraph s i in the auxiliary data structure FPCS, a fingerprint f(s i ) (0≤f(s i )≤F) (occupying less than 8 bits) is allocated, where f( s i)=h(s i )%F, and the address sequence of the storage block corresponding to the subgraph s i {B_x[h(s_i)]|1≤x≤r} (0≤h(s i )<l) is calculated. The pattern p i of the subgraph s i is stored in the first storage block with empty cells, and the key value <ID,fre,f(s i ),flag> is added to the corresponding position. In this way, the enhanced auxiliary data structure FPCS can provide more candidate blocks for newly generated subgraphs, reducing errors caused by constant replacement.
[0097] In order to calculate the storage block address sequence, first, a linear congruence method is used to generate r random value sequences {q_x(·)|1≤x≤r}, where f(·) is used as a seed. The linear congruence method is as follows: carefully select a, b and p to obtain the expression of the random value sequence shown in equation 1. Using the linear congruence method can ensure that enough sequences are generated, and there will be no repeated numbers in the r random value sequences. Then the storage block address sequence can be generated as follows:
[0098] {B x [h(s i )]|B x [h(s i )]=(B[h(s i )]+q x (s i ))%m,1≤x≤r} (2)
[0099] Figure 6An example of vertical hashing is shown. After choosing the values of a, b and p, the hash address sequence of each inserted subgraph can be obtained. In this example, the inserted subgraph s1 is mapped into 3 blocks with hash address sequence B1[h(s1)], B2[h(s1)] and B3[h(s1)]. Then, all the cells in the candidate mapping blocks are searched for a pattern isomorphic to s1. If s1 has not been stored before, it is stored in the first empty cell with storing the key-value pair <p1,1,f(s1),T>.
[0100] In one embodiment, step 510 comprises: calculating w candidate storage blocks according to the candidate storage block calculation formula based on the storage block address sequence; the candidate storage block calculation formula is:
[0101]
[0102] wherein q x (s i ) is the xth random value sequence of subgraph s i , and r is the number of random values.
[0103] The pattern p i of each subgraph s i in the sequence of m-edge subgraphs is stored in the first candidate storage block with an empty cell, and the key value <ID,fre,f(s i ),flag> is added to the corresponding cell of the candidate storage block, to obtain the final enhanced auxiliary data structure FPCS.
[0104] Specifically, using the vertical hashing technique, whenever a subgraph is inserted, rxd candidate mapping cells need to be checked, which will be very time-consuming. In order to improve the update speed while ensuring a reasonable collision rate, the present application proposes a candidate fast sampling technique. Instead of considering all rxd candidate cells, only w candidate blocks are selected from the storage block address sequence {B x [h(·)]} as samples. Only w candidate mapping blocks are checked in the update and query. The method of selecting w candidate blocks for subgraphs is also a linear congruence method. First, a w-length sequence is calculated according to equation (3), and then w blocks with addresses are selected.
[0105] Note that using the hash address sequence, FPCS can store subgraph patterns with different hash values in the same storage block. In the update and query, subgraph matching does not need to be performed on each pattern stored in the candidate block. Therefore, using fingerprints can effectively filter more unwanted patterns. Given two subgraphs s1 and s2, they can be isomorphic subgraphs if and only if the fingerprints f(s1) = f(s2).
[0106] It should be understood that, althoughFigure 1 and Figure 5 The steps in the flowcharts of Figure 1 and Figure 5 At least some of the steps can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the order of execution of the sub-steps or stages is not necessarily sequential, but can be alternately or alternately executed with other steps or sub-steps or stages of other steps.
[0107] In a verification embodiment, the sub-algorithms in this embodiment are implemented in C++, and run on a PC with an Intel i7 3.50 GHz CPU and 32 GB of memory. In this embodiment, three algorithms are implemented and compared: FPM: a baseline method using reservoir sampling; TopKF: an advanced algorithm with auxiliary data structure FPC; TopKFs: an enhanced algorithm using auxiliary data structure FPCS and some optimizations. In all experiments, the hash function is implemented using BOB Hash with different initial seeds. Each quantitative test is repeated 5 times, and the average value is reported.
[0108] (1) Data set. The data set of this embodiment uses three real data sets, specifically:
[0109] Twitter is a social network containing 4.9M entities (e.g., users) and 32M edges (e.g., "mentions"), which is the largest of the three data sets.
[0110] Facebook contains 415K entities (e.g., users) and 2.1M edges (e.g., messages).
[0111] Enron is an email communication network consisting of 86K entities (e.g., employee ranks), 297K edges (e.g., emails), with timestamps of communication data.
[0112] (2) Metrics
[0113] Average Relative Error (ARE): where fre i is the actual frequency of subgraph s i , fre is the estimated frequency, and Ψ is the query set.
[0114] Recall Rate (RR): The ratio of the number of correct outputs to the number of correct patterns.
[0115] Precision (PR): The ratio of the number of correctly output patterns to the number of output patterns.
[0116] F1 score: The harmonic mean of precision and recall, which is also a measure of model accuracy.
[0117] Throughput: Thousands of edge insertions per second (Kips).
[0118] (3) Parameter settings
[0119] To evaluate the performance of TopKFs and their competitors, we first set d = 24, k = 400, and change the value of memory size from 100 MB to 300 MB with an increment of 50 MB. Then, to evaluate the impact of some key parameters, we determine the memory usage of FPCs and FPCs, and vary d from 12 to 48 with an increment of 12, and vary k from 200 to 800 with an increment of 200, to observe how the parameters affect the performance of the auxiliary data structures.
[0120] For other parameters, we fix the subgraph size m = 3, fix the vertical hash range r = 6, and fix the address sample probability w = 3. If not specified otherwise, when changing a certain parameter, the values of other parameters will be set to their default values.
[0121] (4) Experiments on different indicators
[0122] This embodiment evaluates the performance of TopKFs, TopKF, and FPM on three real datasets with different memory sizes. The main results show the ARE, RR, PR, and throughput of the three algorithms with default parameters. Similar results can also be observed under other parameter settings.
[0123] The impact of memory on the average relative error (ARE) of the three models (TopKFs, TopKF, and FPM) on three real datasets is shown in Figure 7 , where (a) is the Twitter dataset, (b) is the Facebook dataset, and (c) is the Enron dataset. It can be seen from Figure 7 that the ARE of TopKFs is much lower than all other competitors. Specifically, TopKFs outperforms TopKF by 3.29 times on Twitter and outperforms FPM by 492.24 times. On the other two datasets, the ARE of TopKFs is about 5.51 times and 442.18 times lower than TopKF and FPM, respectively. In addition, the increase of memory can reduce the ARE of the three algorithms. In the Enron dataset, with 300 MB of memory, the ARE of TopKFs can reach about 3.7 x 10 -5 .
[0124] The impact of memory usage on the recall (RR) of three models (TopKFs, TopKF, and FPM) on three real-world datasets is as follows: Figure 8 As shown, (a) is the Twitter dataset, (b) is the Facebook dataset, and (c) is the Enron dataset. Figure 8 As can be seen, on the Twitter dataset, the RR of TopKFs is 1.10 times that of TopKF and 1.46 times that of FPM. Similar results can be found on the other two datasets. Specifically, the CR of TopKFs is approximately 1.19 times that of FPC and 1.60 times that of FPM.
[0125] The impact of memory usage on the accuracy (PR) of three models (TopKFs, TopKF, and FPM) on three real-world datasets is as follows: Figure 9 As shown, (a) is the Twitter dataset, (b) is the Facebook dataset, and (c) is the Enron dataset. Figure 9 As can be seen, TopKFs achieves a PageRank (PR) that is 1.27 times that of TopKF and 3.04 times that of FPM. TopKFs can achieve an accuracy of approximately 1 on the 150MB Enron dataset, the 250MB Facebook dataset, and the 300MB Twitter dataset, which requires significantly less memory than TopKF and FPM.
[0126] Validity Analysis. All experimental results show that TopKF and TopKFs achieve higher accuracy than the baseline solution on each dataset. This is because FPM requires sampling a large number of subgraphs to ensure accuracy and storing all sampled subgraphs to accurately estimate the frequency of each pattern. Therefore, FPM achieves low accuracy when memory is limited. TopKFs and TopKFs, on the other hand, use an auxiliary data structure and do not store any sampled m-edge subgraphs. It only stores the m-edge patterns and their frequencies, which can be directly stored in memory. Furthermore, TopKFs can further improve accuracy because FPCs can provide more candidate mapping blocks with vertical hashing techniques to reduce errors caused by substitution.
[0127] The graph shows a comparison of the impact of different memory levels on the throughput of the three models on three real-world datasets. Figure 10 As shown, (a) is the Twitter dataset, (b) is the Facebook dataset, and (c) is the Enron dataset. Figure 10 It can be seen that the insertion throughput of TopKF is 1.13 times that of TopKFs and 3.57 times that of FPM. Furthermore, the insertion throughput of TopKFs and TopKF increases with increasing memory, while that of FPM increases in the opposite direction.
[0128] The experimental results show that TopKFs and TopKF are more efficient than FPM, because FPM performs expensive subgraph matching computation to estimate the frequency of each subgraph pattern after all updates at the current timestamp. In contrast, TopKFs and TopKF use auxiliary data structures to estimate the frequency of each pattern in real time without constraint, which can avoid redundant computation. In addition, the throughput of TopKF is also higher than TopKFs, because FPCs only need one memory access for each subgraph insertion. While FPCs reserve the hash address set, which leads to additional checking time. Moreover, the throughput of FPM is higher under small memory, because it needs less time to partition the set of subgraphs in S into T equivalence classes. As the memory increases, FPM needs to handle more sampled subgraphs. While TopKFs and TopKF can achieve higher throughput as the memory increases, because they have more blocks to handle subgraph insertion, which greatly reduces the hash collision.
[0129] (5) Experiments with varying parameters
[0130] The performance of TopKFs, TopKF with varying parameter d is evaluated on Twitter using limited size of memory (i.e., 200MB), and then the F1 score and throughput of TopKF, TopKFs and FPM with different parameter k are evaluated on Twitter and Facebook with the same memory. Note that when changing the parameter, other parameters are kept as default. The results on other datasets are consistent.
[0131] The performance comparison of different parameter d on Twitter dataset is shown in Figure 11 , where (a) is the average relative error (ARE), (b) is the recall rate (RR), (c) is the precision rate (PR), and (d) is the throughput. In this experiment, d is changed from 12 to 48. It can be observed that the increase of d can improve the recall rate and reduce the throughput of TopKFs and TopKF. While ARE and RR are not significantly affected. The reason could be that for larger d, it is more likely to store those patterns that can be top-d patterns in the block. In addition, as d increases, the throughput of TopKFs and TopKF decreases, because they need to check more cells in each stored block and perform more subgraph matching computation for subgraph insertion. Therefore, users can adjust d to achieve a good balance between precision and speed.
[0132] The performance comparison of different parameter k on Twitter and Facebook datasets is shown in Figure 12are shown, where (a) is the effect of parameter k on F1 score on Twitter, (b) is the effect of parameter k on throughput on Twitter, (c) is the effect of parameter k on F1 score on Facebook, and (d) is the effect of parameter k on throughput on Facebook. From Figure 12 It can be seen that the throughput of TopKFs and TopKF also has a slight change with the change of k. This is because TopKFs and TopKF store all high-frequency patterns in a fixed-size auxiliary data structure regardless of the value of k. After inserting all subgraphs of the current time, TopKF and TopKFs can directly search the top-k frequent patterns from the data structure.
[0133] In one embodiment, a stream graph-based Top-K frequent pattern mining device is provided, comprising: an auxiliary data structure FPC initialization module, a stream graph of time t+1 acquisition module, an m-edge subgraph sequence determination module, an auxiliary data structure FPC update module, and a Top-K frequent pattern mining module, wherein:
[0134] The auxiliary data structure FPC initialization module is configured to initialize an initial auxiliary data structure FPC comprising l blocks, and the initial value of each block is empty. Each block comprises a counter and a subgraph set, wherein the subgraph set comprises d cells, and each cell is configured to store a subgraph pattern ID, a frequency, and an identifier. l and d are both integers greater than 0.
[0135] The stream graph of time t+1 acquisition module is configured to acquire a stream graph of a social network at time t, and add an inserted edge received at time t+1 to the stream graph at time t to obtain a stream graph at time t+1. The stream graph is a graph of a social network observed up to a specific time, comprising a plurality of data items, and each data item is an edge between two vertices arriving at a specific time.
[0136] The m-edge subgraph sequence determination module is configured to mine all m-edge subgraphs containing the inserted edge from the stream graph at time t+1 to obtain an m-edge subgraph set. m is an integer greater than 0. Each m-edge subgraph in the m-edge subgraph set is mapped to an m-edge subgraph sequence.
[0137] The auxiliary data structure FPC update module is configured to map each subgraph in the m-edge subgraph sequence to a block of the auxiliary data structure FPC using a hash function to obtain a final auxiliary data structure FPC.
[0138] The Top-K frequent pattern mining module is configured to estimate the frequency of each pattern according to the final auxiliary data structure FPC, and calculate a top-k interesting m-edge pattern set according to the estimation result of the frequency of each pattern. k is an integer greater than 0.
[0139] In one embodiment, the auxiliary data structure FPC update module is further configured to update the subgraph s in the m-edge subgraph sequence. i After processing by the first hash function, the corresponding block B[h(s) is found in the auxiliary data structure FPC based on the obtained hash value. i If the subgraph s in the m-edge subgraph sequence i Isomorphic to block B[h(s) i Pattern p in ).sub j Then when pattern p j When the identifier is true, the pattern p j The frequency increases by 1 when the pattern p j When the identifier is false, the pattern p will be... j The frequency increases by 1, and according to subgraph s i The second hash function updates B[h(s)] i The value of ).count; the second hash function is used to convert the subgraph s i Map to {+1, -1}; if the subgraph s in the m-edge subgraph sequence i With block B[h(s) i All schemas stored in ).sub are not identical, and block B[h(s)] is not identical. i If the cell in the ).sub subgraph is not full, delete the subgraph s. i The vertex ID determines the subgraph s. i mode p i ,Will <p i ,1,true> Insert into block B[h(s i In the empty cell of ).sub; if the subgraph s in the m-edge subgraph sequence i With block B[h(s) i All schemas stored in ).sub are not identical, and block B[h(s)] is not identical. i If the cell in B[h(s)].sub is full, a replacement strategy is used to achieve the desired result. i ).sub stores a higher frequency data pattern.
[0140] In one embodiment, the auxiliary data structure FPC update module is further configured to update block B[h(s)] i The value of the counter in the m-edge subgraph sequence is related to the value of the subgraph s. i Multiplying the values obtained after mapping using the second hash function, we get the subgraph s. i The frequency estimate of the pattern; if the frequency estimate of the pattern is less than that of block B[h(s)] i If the minimum frequency is found in subgraph s, then subgraph s will be... i mode p i Insert into B[h(s) i].count; if the frequency estimation value of the pattern is greater than or equal to the minimum frequency in B[h(s i ].sub, then insert the pattern p i of the subgraph s i into B[h(s i ].count, update the cell where the pattern with the minimum frequency is located, and the updated value is: wherein is the frequency estimation value of the pattern; if the identification bit of the replaced pattern is true, then insert the replaced pattern into B[h(s i ].count.
[0141] In one of the embodiments, the m-edge subgraph sequence determination module is further configured to obtain a new label l(v) of a vertex according to the degree and label of the vertex, and record a new label l(e) of each edge e=(v i ,v j ,t(e)) as l(e)=(l(v i ),l(v j )); determine an edge mapping order of the subgraph according to the weight of each edge and the new label of the vertex; each edge is assigned in a flow graph, and the weight of each edge is equal to the occurrence order of the pattern of the subgraph; and obtain a subgraph sequence of each m-edge subgraph according to the mapping order of each edge of each m-edge subgraph in the m-edge subgraph set.
[0142] In one embodiment, a flow graph-based Top-K frequent pattern mining device is provided, which comprises an enhanced auxiliary data structure FPCS initialization module, a flow graph acquisition module, an m-edge subgraph sequence determination module, an enhanced auxiliary data structure FPCS update module, and an enhanced Top-K frequent pattern mining module, wherein:
[0143] The enhanced auxiliary data structure FPCS initialization module is configured to initialize an initial enhanced auxiliary data structure FPCS comprising l blocks, and the initial value of each block is empty, and each block comprises a counter and a subgraph set, wherein the subgraph set comprises d cells, and each cell is used to store a pattern ID, a frequency, a fingerprint f(s i ), and an identification of a subgraph; wherein l and d are both integers greater than 0, f(s i )=h(s i )%F, F is an upper bound of the fingerprint, and h(s i ) is a hash value of the subgraph s i processed by a first hash function.
[0144] The flow graph acquisition module is used to acquire the flow graph of the social network at time t, and add the inserted edge received at time t+1 to the flow graph at time t to obtain the flow graph at time t+1. The flow graph is the graph of the social network observed up to a specific time, including several data items, which are the edges between two vertices reached at a specific time.
[0145] The m-edge subgraph sequence determination module is used to mine all m-edge subgraphs containing inserted edges in the flow graph at time t+1, and obtain a set of m-edge subgraphs; where m is an integer greater than 0; and to map each m-edge subgraph in the set of m-edge subgraphs to an m-edge subgraph sequence.
[0146] The Enhanced Auxiliary Data Structure (FPCS) update module is used to calculate the storage block address sequence of each subgraph in the m-edge subgraph sequence using a vertical hashing optimization strategy; based on the storage block address sequence, w storage blocks are selected using a linear congruence method to obtain candidate storage blocks, and each subgraph in the m-edge subgraph sequence is mapped to the corresponding candidate storage block to obtain the final Enhanced Auxiliary Data Structure (FPCS).
[0147] An enhanced Top-K frequent pattern mining module is used to estimate the frequency of each pattern based on the final enhanced auxiliary data structure FPCS, and to calculate the set of the top k interesting m-edge patterns based on the frequency estimation results of each pattern; where k is an integer greater than 0.
[0148] In one embodiment, the enhanced auxiliary data structure FPCS update module is further configured to update the subgraph s in the m-edge subgraph sequence. i Using the linear congruential method, r random value sequences are obtained, and the expressions for the r random value sequences are shown in equation (1). Based on the subgraph s... i The first hash function maps the hash value to the corresponding block and the random value sequence, thus obtaining the storage block address sequence.
[0149] In one embodiment, the Enhanced Auxiliary Data Structure (FPCS) update module is used to calculate w candidate storage blocks based on the storage block address sequence using the candidate storage block calculation formula; the candidate storage block calculation formula is shown in equation (2). Each subgraph s in the m-edge subgraph sequence... i mode p i Store it in the first candidate storage block with empty cells, and set the key value <ID,fre,f(s i Add the flag to the corresponding cell of the candidate storage block to obtain the final enhanced auxiliary data structure FPCS.
[0150] The specific definitions of the stream graph-based Top-K frequent pattern mining device can refer to the definitions of the stream graph-based Top-K frequent pattern mining method, which will not be repeated here. Each module in the stream graph-based Top-K frequent pattern mining device described above can be realized by software, hardware, and combinations thereof, in whole or in part. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0151] In one embodiment, a computer device, which can be a terminal, has an internal structure diagram as shown in Figure 13 The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The network interface of the computer device is configured to communicate with external terminals through a network connection. The computer program is executed by the processor to implement a stream graph-based Top-K frequent pattern mining method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball, or touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0152] Those skilled in the art can understand that Figure 13 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0153] In one embodiment, a computer device is provided, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0154] The technical features of the above embodiments can be combined in any manner. To make the description concise, not all possible combinations of the technical features in the above embodiments are described, but as long as the combinations of the technical features do not contradict, they should be considered as within the scope of the present disclosure.
[0155] The above-described embodiments are merely illustrative of several embodiments of the present application, which are described in more detail and in a specific and detailed manner, but should not be construed as limiting the scope of the patent. It should be noted that for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present application, and these are all within the scope of the present application. Therefore, the scope of protection of the patent of the present application should be subject to the appended claims.
Claims
1. A method for mining Top-K frequent patterns based on flow graphs, characterized in that, The method is applied to real-time data processing of social network flow graphs in social network servers to solve the memory and computing resource bottleneck problem under highly dynamic flow graph data; the method includes: Initialization includes l An initial auxiliary data structure FPC is used for each block, with each block initially empty. Each block includes a counter and a sub-graphet, wherein the sub-graphet includes... d Each cell stores the subgraph pattern ID, frequency, and identifier. l、d All are integers greater than 0; Get social network time t The flow graph, and the insertion edge received at time t+1 is added to the time. t From the flow graph, we obtain the time t +1 flow graph; the flow graph is a graph constructed from a continuous high-speed data stream generated by a router or monitor, and is a graph of the social network observed up to a specific time, including several data items, where each data item is an edge between two vertices that arrive at a specific time; In the flow graph at time t+1, extract all elements containing the inserted edge. m edge subgraph, obtained m A set of edge subgraphs; where m is an integer greater than 0; The m Each in the set of edge subgraphs m edge subgraph mapping to m Edge subgraph sequence; Using a hash function m Each subgraph in the edge subgraph sequence is mapped to a specific physical storage block of the auxiliary data structure FPC, resulting in the final auxiliary data structure FPC; specifically, this includes: m Subgraph in edge subgraph sequence After processing by the first hash function, the corresponding block is found in the auxiliary data structure FPC based on the obtained hash value. ;if m Subgraph in edge subgraph sequence isomorphic to block The pattern in Then when the pattern When the identifier is true, the pattern will be... The frequency increases by 1; when the pattern When the identifier is false, the pattern will be... The frequency increases by 1, and according to the subgraph Second hash function, update The value; the second hash function is used to convert the subgraph Mapped to {+1, -1}; if m Subgraph in edge subgraph sequence With block All the schemas stored in the middle are heterogeneous, and the blocks If the cell is not full, delete the sub-image. Determine the subgraph by its vertex ID. pattern ,Will Insert into block In an empty cell; if m Subgraph in edge subgraph sequence With block All the schemas stored in the middle are heterogeneous, and the blocks If the cell is full, a replacement strategy is used. A mode for storing higher frequency numbers; The frequency of each mode is estimated based on the final auxiliary data structure FPC, and the pre-calculation is performed based on the frequency estimation results of each mode. k An interesting m Edge pattern set; where k It is an integer greater than 0.
2. The method according to claim 1, characterized in that, if m Subgraph in edge subgraph sequence With block All the schemas stored in the middle are heterogeneous, and the blocks If the cell is full, a replacement strategy is used. Modes for storing higher frequency numbers include: block The value of the counter and m Subgraph in edge subgraph sequence Multiplying the values obtained after mapping using the second hash function yields a subgraph. The frequency estimate of the pattern; If the frequency estimate of the pattern is less than the block The minimum frequency in the subgraph, then the subgraph pattern Insert into middle; If the frequency estimate of the pattern is greater than or equal to the block The minimum frequency in the subgraph, then the subgraph pattern Insert into In the middle, the cell containing the pattern with the lowest frequency is updated, and the updated result is: ,in This is the frequency estimate of the pattern; if the flag of the replaced pattern is true, then the replaced pattern is inserted into... .
3. The method according to claim 1, characterized in that, The m Each in the set of edge subgraphs m The edge subgraph is mapped to a sequence of subgraphs, including: Based on the degree and label of the vertex, obtain the new label of the vertex. and each edge The new label is recorded as ; The edge mapping order of the subgraph is determined based on the weight of each edge and the new label of the vertex; each edge is assigned in the flow graph, and the weight of each edge is equal to the order in which the subgraph patterns appear. According to the above m Each in the set of edge subgraphs m The mapping order of each edge in the edge subgraph yields each m The sequence of subgraphs of an edge subgraph.
4. A Top-K frequent pattern mining device based on flow graphs, characterized in that, The device is used in a social network server to perform real-time data processing on the flow graph of a social network, thereby solving the bottleneck problem of memory and computing resources under highly dynamic flow graph data; the device includes: The auxiliary data structure FPC initialization module is used to initialize, including l An initial auxiliary data structure FPC is used for each block, with each block initially empty. Each block includes a counter and a sub-graphet, wherein the sub-graphet includes... d Each cell stores the subgraph pattern ID, frequency, and identifier. l、d All are integers greater than 0; time t The +1 flow graph acquisition module is used to obtain social network time. t The flow graph, and the insertion edge received at time t+1 is added to the time. t From the flow graph, we obtain the time t +1 flow graph; the flow graph is a graph constructed from a continuous high-speed data stream generated by a router or monitor, and is a graph of the social network observed up to a specific time, including several data items, where each data item is an edge between two vertices that arrive at a specific time; m The edge subgraph sequence determination module is used to mine all subgraphs containing the inserted edge in the flow graph at time t+1. m edge subgraph, obtained m A set of edge subgraphs; where, m The integer is greater than 0; the stated m Each in the set of edge subgraphs m edge subgraph mapping to m Edge subgraph sequence; The auxiliary data structure FPC update module is used to update data using a hash function. m Each subgraph in the edge subgraph sequence is mapped to a specific physical storage block of the auxiliary data structure FPC, resulting in the final auxiliary data structure FPC; specifically, this includes: m Subgraph in edge subgraph sequence After processing by the first hash function, the corresponding block is found in the auxiliary data structure FPC based on the obtained hash value. ;if m Subgraph in edge subgraph sequence isomorphic to block The pattern in Then when the pattern When the identifier is true, the pattern will be... The frequency increases by 1; when the pattern When the identifier is false, the pattern will be... The frequency increases by 1, and according to the subgraph Second hash function, update The value; the second hash function is used to convert the subgraph Mapped to {+1, -1}; if m Subgraph in edge subgraph sequence With block All the schemas stored in the middle are heterogeneous, and the blocks If the cell is not full, delete the sub-image. Determine the subgraph by its vertex ID. pattern ,Will Insert into block In an empty cell; if m Subgraph in edge subgraph sequence With block All the schemas stored in the middle are heterogeneous, and the blocks If the cell is full, a replacement strategy is used. A mode for storing higher frequency numbers; The Top-K frequent pattern mining module estimates the frequency of each pattern based on the final auxiliary data structure FPC, and calculates the frequency of each pattern based on the frequency estimation results. k An interesting m Edge pattern set; where k It is an integer greater than 0.
5. A method for mining Top-K frequent patterns based on flow graphs, characterized in that, The method is applied to real-time data processing of social network graphs in social network servers to address the memory and computing resource bottlenecks under highly dynamic graph data; the method includes: Initialization includes l An Initial Enhancement Auxiliary Data Structure (FPCS) is defined for each block, stored in the memory of the social network server. Each block is initially empty. Each block includes a counter and a sub-graphet, wherein the sub-graphet includes... d Each cell stores the pattern ID, frequency, and fingerprint of the subgraph. and signage; among which, l、d All are integers greater than 0. F represents the upper bound of the fingerprint. For subgraph The hash value after processing by the first hash function; Get social network time t The flow graph, and the insertion edge received at time t+1 is added to the time. t From the flow graph, we obtain the time t +1 flow graph; the flow graph is a graph constructed from a continuous high-speed data stream generated by a router or monitor, and is a graph of the social network observed up to a specific time, including several data items, each data item being at a specific time. The edge between the two vertices that are reached; In the flow graph at time t+1, extract all elements containing the inserted edge. m edge subgraph, obtained m A set of edge subgraphs; where m is an integer greater than 0; The m Each in the set of edge subgraphs m edge subgraph mapping to m Edge subgraph sequence; Calculate using a vertical hashing optimization strategy m The sequence of physical address sequences of storage blocks for each subgraph in the edge subgraph sequence; specifically including: according to m Subgraph in edge subgraph sequence Using the linear congruential method, we obtain a sequence of r random values. The expression for the sequence of r random values is: in, For subgraph The first random value sequence, For subgraph The x A sequence of random values, The number of random values. a , b and p There are three constants; According to the subgraph The storage block address sequence is obtained by mapping the hash value to the block corresponding to the random value sequence using the first hash function; Selecting based on the storage block address sequence using a linear congruential method w 1 storage block, obtain candidate storage blocks, and then m Each subgraph in the edge subgraph sequence is mapped to the corresponding candidate storage block, resulting in the final enhanced auxiliary data structure FPCS; The frequency of each mode is estimated based on the final enhanced auxiliary data structure FPCS, and the pre-calculation is performed based on the frequency estimation results of each mode. k An interesting m Edge pattern set; where k It is an integer greater than 0.
6. The method according to claim 5, characterized in that, Selecting based on the storage block address sequence using a linear congruential method w 1 storage block, obtain candidate storage blocks, and then m Each subgraph in the edge subgraph sequence is mapped to a corresponding candidate storage block, resulting in the final enhanced auxiliary data structure FPCS, which includes: The candidate memory block is calculated using the formula based on the memory block address sequence to obtain... w There are 10 candidate storage blocks; the formula for calculating the candidate storage blocks is: in, For subgraph The x A sequence of random values, The number of random values; Will m Each subgraph in the edge subgraph sequence pattern Store it in the first candidate storage block with empty cells, and set the key value Add it to the corresponding cell of the candidate storage block to obtain the final enhanced auxiliary data structure FPCS.
7. A Top-K frequent pattern mining device based on flow graphs, characterized in that, The device is used in a social network server to perform real-time data processing on the flow graph of a social network, thereby solving the bottleneck problem of memory and computing resources under highly dynamic flow graph data; the device includes: An Enhanced Auxiliary Data Structure (FPCS) initialization module is used to initialize an initial FPCS comprising l blocks. The initial FPCS is stored in the memory of the social network server. Each block has an initial value of empty. Each block includes a counter and a subgraph set. The subgraph set comprises d cells, which store the subgraph's pattern ID, frequency, and fingerprint. and signage; among which, l、d All are integers greater than 0. F represents the upper bound of the fingerprint. For subgraph The hash value after processing by the first hash function; The flow graph acquisition module is used to obtain social network time. t The flow graph, and the insertion edge received at time t+1 is added to the time. t From the flow graph, we obtain the time t +1 flow graph; the flow graph is a graph constructed from a continuous high-speed data stream generated by a router or monitor, and is a graph of the social network observed up to a specific time, including several data items, where each data item is an edge between two vertices that arrive at a specific time; m The edge subgraph sequence determination module is used to mine all subgraphs containing the inserted edge in the flow graph at time t+1. m edge subgraph, obtained m A set of edge subgraphs; where m is an integer greater than 0; [The text abruptly ends here, likely due to an incomplete sentence or missing information.] m Each in the set of edge subgraphs m edge subgraph mapping to m Edge subgraph sequence; The FPCS update module, an enhanced auxiliary data structure, is used for computation using an optimized vertical hashing strategy. m The physical address sequence of storage blocks for each subgraph in the edge subgraph sequence; selection is performed using a linear congruential method based on the storage block address sequence. w 1 storage block, obtain candidate storage blocks, and then m Each subgraph in the edge subgraph sequence is mapped to the corresponding candidate storage block, resulting in the final enhanced auxiliary data structure FPCS; An enhanced Top-K frequent pattern mining module is used to estimate the frequency of each pattern based on the final enhanced auxiliary data structure FPCS, and to calculate the frequency of each pattern based on the frequency estimate. k An interesting m Edge pattern set; where k It is an integer greater than 0; Among them, the FPCS update module of the enhanced auxiliary data structure employs a vertical hashing optimization strategy for computation. m The sequence of physical address sequences of storage blocks for each subgraph in the edge subgraph sequence specifically includes: based on m Subgraph in edge subgraph sequence Using the linear congruential method, we obtain a sequence of r random values. The expression for the sequence of r random values is: in, For subgraph The first random value sequence, For subgraph The x A sequence of random values, The number of random values. a , b and p There are three constants; According to the subgraph The storage block address sequence is obtained by mapping the hash value to the block corresponding to the hash value and the random value sequence through the first hash function.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 3 and claims 5 to 6.
Citation Information
Patent Citations
Graph querying, graph motif mining and the discovery of clusters
US20070239694A1
Method and apparatus for association rules with graph patterns
US20170228448A1