Maximum compact subgraph index search method and system based on k value and p value
By constructing an index Tk that records the connection relationship of the graph node, the problem of low efficiency of the KP-Index index when finding the (k,p)-core tight subgraph containing a given graph node is solved, and efficient search and low space are achieved Extremely tight subgraph search for complexity.
Patent Information
- Application Number
- CN202210443433.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-25
- Publication Date
- 2024-11-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing KP-Index indexes are inefficient when looking for (k,p)-core tight subgraphs containing a given graph node because the connection relationship between graph nodes is not recorded and cannot be simply modified to record connections. information.
Through (k,p)-core decomposition of sample graphs, an index Tk that records the connection relationship between each graph node is constructed, an index is constructed in the offline stage, and an index search method with the best time in the online stage is realized to obtain a given graph node. Pointed (k,p)-core tight sub-picture.
It realizes efficient search of (k,p)-core tight subgraphs containing given graph nodes, improves search efficiency, reduces spatial complexity, and supports extremely tight subgraph search with optimal time efficiency.
Smart Images

Figure CN115033744B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of graph algorithm technology, and in particular to a maximum compact subgraph index search method based on k value and p value for finding a maximum compact subgraph with a (k, p)-core as a model in a social network. Background Art
[0002] Graphs are widely used to model complex relational objects, such as social networks, brain maps, and drug target maps. Communities exist widely in a large number of real networks, for example, online communities in social networks, functional units in brain maps, and diseases in drug target maps. At present, the academic community generally believes that a community is a subgraph with dense internal connections, so in this specification, dense subgraphs and communities are regarded as the same concept.
[0003] As the size of graphs grows, traditional methods for finding communities, such as community discovery, are difficult to meet the needs of users to quickly find compact subgraphs customized by search parameters in large graphs. People usually use community search methods to meet this search need and solve the problem of search efficiency. Community search can quickly respond to user query requests on various graphs in an online service manner and return high-quality query results, that is, the returned communities should have internal compactness. In order to ensure the internal compactness of the community, people have proposed community models as search constraints, such as k-clique, k-core, and k-truss. Although the above community models all guarantee internal compactness to a certain extent, they all ignore the interaction (i.e., edges) between graph nodes in the community and graph nodes outside the community, and this interaction relationship will affect the participation of graph nodes in the community. In some applications, such as organizing activities through social networks, we hope that users can have a high degree of participation. At this time, none of the above community models is the most appropriate choice. To this end, people have proposed a new (k, p)-core community model based on k-core. The p value is the minimum value of the ratio of the number of internal neighbors of a point in the community to the total number of neighbors, while ensuring that the community is k-core. The neighbor points are the points connected to the point. At present, the algorithm for finding (k,p)-core has only stayed at the community discovery stage. That is, after given the parameters k and p, the researchers have solved the problem of how to quickly find all the maximum (k,p)-core tight subgraphs with specified k and p values in the graph through the KP-Index tight subgraph discovery index. The search results may contain several indistinguishable maximum (k,p)-core tight subgraphs. However, KP-Index cannot efficiently find the (k,p)-core tight subgraph containing a given graph node because the connectivity relationship between graph nodes is not recorded in the index, and the index cannot be simply modified to record connectivity information. Summary of the invention
[0004] The purpose of the present invention is to overcome the deficiencies of the above-mentioned background technology and to provide a method and system for extremely large compact subgraph index search based on k value and p value.
[0005] In a first aspect, the present application provides a method for searching a very large compact subgraph index based on a k value and a p value, comprising the following steps:
[0006] Step S1: In the offline stage, the sample graph is decomposed by (k, p)-core to obtain the k value and p value information of all graph nodes, and the index T that records the connectivity relationship between each graph node is constructed for each graph node with different k values. k ;
[0007] Step S2: Based on index T k A time-optimal index search method is implemented in the online phase to obtain the corresponding index search results.
[0008] According to the first aspect, in a first possible implementation manner of the first aspect, step S1 specifically includes the following steps:
[0009] Step S11: In the offline stage, the sample graph is decomposed by (k, p)-core to obtain the k value and p value information of all graph nodes, and a top-down index T is constructed for graph nodes with different k values. k ;
[0010] Step S12: In the offline stage, the sample graph is decomposed by (k, p)-core to obtain the k value and p value information of all graph nodes, and a bottom-up index T is constructed for graph nodes with different k values. k .
[0011] According to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, step S11 specifically includes the following steps:
[0012] Step S110: construct a subtree of each connected component in ascending order of p value, connect the tree nodes of the newly constructed subtree with larger p value to the tree nodes of the subtree with smaller p value, and complete the whole T k Construction of tree index.
[0013] The connected component is a subgraph in which there is at least one path between any two nodes that connects the two nodes.
[0014] The tree node is called tree node in English, that is, a node on a tree structure. The emphasis on tree nodes is to distinguish them from graph nodes.
[0015] According to the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, step S110 specifically includes the following steps:
[0016] Step S1101, select graph nodes with fixed p values from the original connected component subgraph, build subtrees for these graph nodes with fixed p values and delete these graph nodes from the original connected component subgraph;
[0017] Starting from the minimum p value, select graph nodes in ascending order of p value as fixed p value graph nodes, repeat step S1101, and connect the subtree nodes with larger p value to the subtree nodes with smaller p value to complete the whole T k Construction of tree index.
[0018] According to the first possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, step S12 specifically includes the following steps:
[0019] S120, constructing a subtree of each connected component in descending order of p value, and connecting the tree nodes of the newly constructed subtree with a smaller p value to the tree nodes of the newly constructed subtree with a larger p value, to complete the entire T k Construction of tree index.
[0020] According to the fourth possible implementation manner of the first aspect, in the fifth possible implementation manner of the first aspect, step S120 specifically includes the following steps:
[0021] Step S1201, select graph nodes with fixed p values in the sample graph, and construct a subtree for these graph nodes with fixed p values and interconnected;
[0022] Step S1202, obtaining the root node of the subtree where the neighbors of the graph nodes in these tree nodes are located, which already existed before the execution of step S1201, and connecting the tree node constructed in this step S1201 with the above existing root node according to the connectivity relationship;
[0023] Starting from the maximum p value, select the graph nodes with the second smallest p value as the graph nodes with the fixed p value in descending order, repeat steps S121 and S122, and connect the tree nodes of the newly constructed subtree with the smaller p value with the tree nodes of the newly constructed subtree with the larger p value, until every tree node in the original connected component subgraph is added to T k in tree index.
[0024] According to the first possible implementation manner of the first aspect, in a sixth possible implementation manner of the first aspect, step S2 specifically includes the following steps:
[0025] Step S21: For a given legal query (v, k, p), find T k The tree index contains the tree nodes of the query graph node v;
[0026] Step S22, start from the queried tree node and backtrack to find the first current or ancestor graph node such that the p value of the parent graph node of x is lower than the query p value;
[0027] Step S23, return to T k The tree index combines the graph nodes in the subtree tree node with x as the root node.
[0028] In a second aspect, the present application provides a very large compact subgraph index search system based on k value and p value, comprising:
[0029] The index building module is used to obtain the k-value and p-value information of all graph nodes by decomposing the sample graph through (k, p)-core in the offline stage, and to build the index T that records the connectivity relationship between each graph node for different k-value graph nodes. k ;
[0030] An index search method building module is connected in communication with the index building module and is used to search based on the index T k A time-optimal index search method is implemented in the online phase to obtain the corresponding index search results.
[0031] According to the second aspect, in a first possible implementation manner of the second aspect, the index construction module includes:
[0032] The top-down index construction module is used to obtain the k-value and p-value information of all graph nodes by decomposing the sample graph through (k, p)-core in the offline stage, and to construct top-down indexes T for graph nodes with different k values. k ;
[0033] The bottom-up index construction module is used to obtain the k-value and p-value information of all graph nodes through (k, p)-core decomposition of the sample graph in the offline stage, and to construct bottom-up indexes T for graph nodes with different k values. k .
[0034] According to a first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect, the top-down index construction module includes:
[0035] A connected component subtree construction module is used to select graph nodes with fixed p values from the original connected component subgraph, construct tree nodes for these graph nodes with fixed p values, and delete these graph nodes from the original connected component subgraph;
[0036] The connected component subtree connection module is in communication connection with the connected component subtree construction module, and is used to select graph nodes as fixed p-value graph nodes in ascending order of p-value starting from the minimum p-value, repeatedly execute step S1101, and connect the subtree nodes with larger p-values to the subtree nodes with smaller p-values, and complete the whole T k Construction of tree index.
[0037] Compared with the prior art, the advantages of the present invention are as follows:
[0038] The maximum compact subgraph index search method based on k value and p value provided in this application constructs an index T for each k value to record the connectivity relationship between each graph node based on the k value and p value information of all graph nodes. k , thereby recording the connectivity relationship between graph nodes. By simply modifying the index to record the connectivity information, efficient search for the (k, p)-core compact subgraph containing a given graph node can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 is a method flow chart of a maximum compact subgraph index search method based on k value and p value according to an embodiment of the present invention;
[0040] Figure 2 is another method flow chart of the maximum compact subgraph index search method based on k value and p value according to an embodiment of the present invention;
[0041] Figure 3 is a sample diagram of an embodiment of the present invention;
[0042] Figure 4 is the total number of T constructed by the maximum compact subgraph index search method based on k value and p value for the sample graph in the embodiment of the present invention. k Tree index;
[0043] Figure 5 This is the anchoring and querying used by this application when constructing T3 for the sample graph of the embodiment;
[0044] Figure 6 This is an example diagram of the search algorithm for query Q(v1,3,0.6) implemented on the sample graph of the embodiment of the present application;
[0045] Figure 7 It is a functional module block diagram of a maximum compact subgraph index search system based on k value and p value according to an embodiment of the present application. DETAILED DESCRIPTION
[0046] The specific embodiments of the present application will now be described in detail, examples of which are illustrated in the accompanying drawings. Although the present application will be described in conjunction with the specific embodiments, it will be understood that it is not intended to limit the present application to the described embodiments. On the contrary, it is intended to cover the changes, modifications and equivalents included in the spirit and scope of the present application as defined by the appended claims. It should be noted that the method steps described herein can be implemented by any functional block or functional arrangement, and any functional block or functional arrangement can be implemented as a physical entity or a logical entity, or a combination of the two.
[0047] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0048] Note: The example to be introduced below is only a specific example, and is not intended to limit the embodiments of the present application to the following specific steps, values, conditions, data, sequences, etc. Those skilled in the art can apply the concept of the present application to construct more embodiments not mentioned in the present description by reading the present description.
[0049] Graphs are widely used to model complex relational objects. As the size of graphs grows, traditional methods for finding communities, such as community discovery, are unlikely to meet the needs of users to quickly find compact subgraphs customized by search parameters in large graphs. People usually use community search methods to meet this search need and solve the problem of search efficiency. The existing KP-Index compact subgraph discovery index does not record the connectivity between graph nodes, and cannot efficiently find the (k,p)-core compact subgraph containing a given graph node.
[0050] In view of this, please refer to Figure 1 , the present application provides a method for searching a large compact subgraph index based on k value and p value, comprising the following steps:
[0051] Step S1: In the offline stage, the sample graph is decomposed by (k, p)-core to obtain the k value and p value information of all graph nodes, and the index T that records the connectivity relationship between each graph node is constructed for each graph node with different k values. k ;
[0052] Step S2: Based on index T k A time-optimal index search method is implemented in the online phase to obtain the corresponding index search results.
[0053] The maximum compact subgraph index search method based on k value and p value provided in this application constructs an index T for each k value to record the connectivity relationship between each graph node based on the k value and p value information of all graph nodes. k, thereby recording the connectivity relationship between graph nodes. By simply modifying the index to record the connectivity information, efficient search for the (k, p)-core compact subgraph containing a given graph node can be achieved.
[0054] In one embodiment, the step S1 specifically includes the following steps:
[0055] Step S11: In the offline stage, the sample graph is decomposed by (k, p)-core to obtain the k value and p value information of all graph nodes, and a top-down index T is constructed for graph nodes with different k values. k ;
[0056] Step S12: In the offline stage, the sample graph is decomposed by (k, p)-core to obtain the k value and p value information of all graph nodes, and a bottom-up index T is constructed for graph nodes with different k values. k .
[0057] In one embodiment, the step S11 specifically includes the following steps:
[0058] Step S110: construct a subtree of each connected component in ascending order of p value, connect the tree nodes of the newly constructed subtree with larger p value to the tree nodes of the subtree with smaller p value, and complete the whole T k Construction of tree index.
[0059] In one embodiment, the step S110 specifically includes the following steps:
[0060] Step S1101, select graph nodes with fixed p values from the original connected component subgraph, build subtrees for these graph nodes with fixed p values and delete these graph nodes from the original connected component subgraph;
[0061] Starting from the minimum p value, select graph nodes in ascending order of p value as fixed p value graph nodes, repeat step S1101, and connect the subtree nodes with larger p value to the subtree nodes with smaller p value to complete the whole T k Construction of tree index.
[0062] In one embodiment, the step S12 specifically includes the following steps:
[0063] S120, constructing a subtree of each connected component in descending order of p value, and connecting the tree nodes of the newly constructed subtree with a smaller p value to the tree nodes of the newly constructed subtree with a larger p value, to complete the entire T k Construction of tree index.
[0064] In one embodiment, the step S120 specifically includes the following steps:
[0065] Step S1201, select graph nodes with fixed p values in the sample graph, build a subtree for these graph nodes with fixed p values and connected to each other, and delete these graph nodes from the original connected component subgraph;
[0066] Step S1202, obtaining the root node of the subtree where the neighbors of the graph nodes in these tree nodes are located, which already existed before the execution of step S1201, and connecting the tree node constructed in this S1201 with the above existing root node according to the connectivity relationship;
[0067] The step S1201 of this time executes step S1201 and step S1202 once for a certain p value.
[0068] Starting from the maximum p value, select the graph nodes with smaller p values than the fixed p value in descending order as the graph nodes with fixed p values, repeat steps S121 and S122, and connect the tree nodes of the newly constructed subtree with smaller p values with the tree nodes of the newly constructed subtree with larger p values, until every tree node in the original connected component subgraph is added to T k in tree index.
[0069] As mentioned above, the smaller and larger are secondary comparison relations. For example, in the number set 1, 6, 5, 8, 7, 1 is the secondary smaller or smaller relative to 5, 5 is the secondary larger relative to 1, 5 is the secondary smaller relative to 6, and 6 is the secondary larger relative to 5.
[0070] In one embodiment, graph nodes with a fixed p-value are selected from the original connected component subgraph, and the connectivity of these graph nodes with a fixed p-value is checked by anchor-and-find, and a subtree is constructed for the mutually connected graph nodes with a fixed p-value, and the p-value of the subtree tree nodes is the fixed p-value; then, the parent graph nodes of the existing tree nodes in these tree nodes are determined by anchor-and-find, and connected; finally, the p-value that is less than the current p-value is selected.
[0071] The anchored union-find used in the (k,p)-core maximal compact subgraph index search method described above has the following characteristics:
[0072] Feature 1: Compared with the classic union-find, the anchored union-find sets an additional anchor point. The anchor point is used to find the connected component in T k The root node of the subtree corresponding to the tree is obtained by anchoring and querying the newly constructed child nodes of the tree node in the bottom-up index construction process, that is, the root node of the constructed subtree. If the direction of the edge of the subtree is from the parent node to the child node, the root node is defined as the node with an in-degree of 0 in the subtree.
[0073] Feature 2: The root node is the anchor point, and the anchor point is the point with the minimum p value. That is, anchoring and finding is implemented by a flat search tree. Each search tree represents a connected component in the original graph, and the root node of each search tree is the anchor point of the search tree. In order to make the anchor point the T corresponding to the connected component k The root node of the subtree, this anchor point should have the smallest p value among the connected components.
[0074] Feature 3: Compared with the classic union-find, the union operation of anchored union-find updates the anchor point. When performing a union operation on two graph nodes, a traditional union operation checks the height or size of the search trees to which the two graph nodes belong, and merges the shorter or smaller search tree into the taller or larger search tree, and further flattens the search tree during the search operation. In the union operation of anchored union-find, the p-values of the anchor points of the search trees where the two graph nodes are located are compared, and the anchor point with the smaller p-value is used as the anchor point of the merged search tree.
[0075] In one embodiment, the step S2 specifically includes the following steps:
[0076] Step S21: For a given legal query (v, k, p), find T k The tree index contains the tree nodes of the query graph node v;
[0077] Step S22, start from the queried tree node and backtrack to find the first current or ancestor graph node such that the p value of the parent graph node of x is lower than the query p value;
[0078] Step S23, return to T k The tree index combines the graph nodes in the subtree tree node with x as the root node.
[0079] The maximum compact subgraph index search method based on k value and p value provided in this application has the following characteristics:
[0080] Feature 1: Injectivity, i.e. index T k The injective relationship between the tree nodes and the (k,p)-core maximal compact subgraph. Specifically, for each tree node x, let the p value of x be p, then the set of graph nodes in all tree nodes in the subtree with x as the root node, there exists a set of graph nodes of a (k,p)-core maximal compact subgraph on the original graph, making these two graph node sets equal. The basis for the injective property is the nested relationship of the (k,p)-core maximal compact subgraph after a given k value, that is, the (k,p)-core compact self with a smaller p value is embedded in the (k,p)-core maximal compact subgraph with a larger p value;
[0081] Feature 2: Separability, index T kThe graph nodes in the tree nodes of T do not overlap. Specifically, each T k The tree nodes of the index contain a set of graph nodes, and in the same T k The graph node sets of different tree nodes indexed do not have a non-empty intersection. This property ensures that T k The index is space efficient.
[0082] Feature 3: Completeness, Index T k The graph node set of all tree nodes of contains all the graph nodes of the k-core subgraph. Specifically, for each k-core there is a corresponding T k Index, which records the p-value nesting relationship of the k-core in terms of subtree affiliation, so that the index records all graph nodes of the k-core;
[0083] Feature 4: Time and space efficiency, based on index T k The search algorithm is time-optimal and takes only O(m) space, where m is the number of edges in the original graph.
[0084] The maximum compact subgraph index search method based on k value and p value provided in this application has the following advantages:
[0085] The index has a small space cost, and its space complexity is only O(m), where m is the number of edges in the graph. Its space cost complexity is on par with the existing global (k,p)-core maximal compact subgraph discovery index. The index is fast to build, and the complexity of the bottom-up index construction algorithm using anchor-and-find is O(kmaxmlog(n)), where kmax is the maximum k value in the graph, n is the number of graph nodes, and m is the number of graph edges. It is significantly improved over the top-down index construction algorithm (whose complexity is O(m2)), and is only slightly slower than the existing global (k,p)-core maximal compact subgraph discovery index, which is on par with the difference of O(log(n)). The index supports the most time-efficient maximal compact subgraph search, that is, the time complexity of the search cost is O(|Va|), where |Va| is the number of graph nodes of the (k,p)-core maximal compact subgraph returned by the query.
[0086] In a more specific embodiment, the method provided by the present invention can be implemented using computer software technology, see Figure 2 ,in Figure 2 Two different index construction methods are included. The embodiment uses a small sample graph to specifically illustrate the structure and construction of the index and the search algorithm based on the index. The sample graph used in the embodiment is shown in Figure 3 The specific description of the method flow is as follows:
[0087] Step 1: To build the Tk Index, this application first Figure 2 The sample graph is decomposed by (k, p)-core to obtain the p-values of the graph nodes when the k value is 1, 2, 3, and 4, and then the corresponding T is constructed for each k value. k Tree index. Take the construction of T3 index when k is 3 as an example. When k is other values, the construction method is similar. When k is 3, the (k,p)-core decomposition result is as follows Figure 3 As shown in the mark, the p value of each graph node is the maximum p value of the (3,p)-core to which it belongs. For example, the p value of v6 is 0.6, and v 13 The p-value of v7 is 0.75 and the p-value of v1 is 0.8. v7 and v8 do not belong to any (3,p)-core.
[0088] The specific implementation process of constructing the T3 index through the top-down construction algorithm in the embodiment is as follows:
[0089] First, the algorithm will create a virtual root node, such as Figure 4 The root node of the rightmost T3 tree index. When k is 3, the original graph has two connected components, one is S1, which is composed of graph nodes v9, ..., v12, and the other is S2, which is composed of graph nodes v1, ..., v6, v13, ..., v19. We construct T3 subtrees on S1 and S2 respectively, and splice these subtrees to the virtual root node. Among them, the virtual root node is called dummy root in English, which is a commonly used method to treat multiple subtrees as the same tree, that is, it is recognized that the root nodes of these subtrees have a common father node. For S1, the minimum value within it is 0.75 and the p value of each graph node is 0.75. Therefore, the construction algorithm moves all the graph nodes of S1 into a tree node x1, and the p value of x1 is 0.75. Since there are no other graph nodes in S1, the subtree construction of S1 is completed, and the subtree is connected to the root node, such as Figure 3 As shown. For S2, the minimum value is 0.6 and only v6 has a p value of 0.6. So the construction algorithm moves v6 into a tree node x2, and the p value of x2 is 0.6. After removing v6, S2 is divided into two connected components, one of which is S3 consisting of v 13 , …, v 19 One is S4, which is composed of v1, ..., v5. Using the same top-down subtree construction method: construct T3 subtree for S3, and get the subtree with x3 as the root node, such as Figure 4 As shown; construct T3 subtree for S4, and get the subtree with x4 as the root node, as Figure 3 As shown. By connecting the tree nodes, i.e. the root nodes x3 and x4, to x2, we obtain the T3 subtree of S2 with x2 as the root node. Next, we connect x1 and x2 to the virtual root node to construct the entire T3 tree index.
[0090] The specific implementation process of constructing the T3 index through the top-down construction algorithm in the embodiment is as follows:
[0091] When k is 3, the method first constructs an anchored union-find set for each graph node in the 3-core subgraph, and then performs the following operations until there are no unchecked graph nodes in the 3-core subgraph. The algorithm obtains the nodes with the largest p-value in the graph (p-value is 0.8), and performs a union operation on these nodes and their neighbors whose p-value is not less than the p-value of the node through anchored union-find, and obtains the following: Figure 5 (a) Anchor Union-Find search tree. Through anchor union-find, we can see that these nodes form two different connected components: one is S4, which is composed of v1, ..., v5; the other is S5, which is composed of v 14 , …, v 18 We construct tree nodes x4 and x5 with p-values of 0.8 for S4 and S5 respectively, as Figure 4 Then we get the graph nodes with p value of 0.75 and perform the union operation on them and their neighboring graph nodes with p value not less than 0.75, and get Figure 5 (b) Anchor-and-find search tree shows that there are currently three different connected components, among which the newly added graph nodes have connected components: 13 , …, v 19 S3 composed of v9,…,v 12 S1 is composed of. We have a new node v in S3 13 and v 19 Construct a tree node x3 with a p value of 0.75. Similarly, for v 13 , …, v 19 Construct the tree node x1. Through anchored union-find, we know that S3 contains S5, so we connect x3 and x5. Finally, we get the graph node v6 with a p value of 0.6. Through anchored union-find, we perform a union operation on v6 and its neighbors, and get Figure 5 (c) From the search tree, we can see that the addition of v6 connects S3 and S4, so we construct a tree node x6 that only contains v6 with a p value of 0.6, and connects x6 to x3, and x6 to x4. Since there are no unchecked nodes in the graph, we connect the tree node where the anchor point of the anchor-check is located to the virtual root node, and we get Figure 4 The T3 subtree.
[0092] Step 2: After building each T kAfter indexing, the present invention can quickly respond to the user's search community request, that is, find the (k,p)-core maximal dense subgraph that contains the user-specified query graph node v and the specified k value and p value. In this embodiment, assuming that the user-specified query graph node v is v1 and the specified k value is 3 and the p value is 0.6, the query is recorded as Q(v1,3,0.6), and the search algorithm is executed as follows:
[0093] First, we use a hash table to find that the tree node x4 where v1 is located in T3 (the hash table can be created at the same time during the index construction process), and then we check whether the p value of x4's parent graph node x2 is less than the given p value. Since the p value of x2 is not less than the given p value, we check the parent graph node of x2, which is a virtual root node (for the simplicity of the algorithm, we record the p value of the virtual root node as 0). Therefore, the search algorithm stops looking for ancestor graph nodes upwards, and obtains the subtree with x2 as the root node, and takes the graph node set in the subtree as the query result of Q(v1,3,0.6) and returns it.
[0094] Based on the same application idea, please refer to Figure 7 The present application provides a large compact subgraph index search system based on k value and p value, including:
[0095] The index building module is used to obtain the k-value and p-value information of all graph nodes by decomposing the sample graph through (k, p)-core in the offline stage, and to build the index T that records the connectivity relationship between each graph node for different k-value graph nodes. k ;
[0096] An index search method building module is connected in communication with the index building module and is used to search based on the index T k A time-optimal index search method is implemented in the online phase to obtain the corresponding index search results.
[0097] In one embodiment, the index building module includes:
[0098] The top-down index construction module is used to obtain the k-value and p-value information of all graph nodes by decomposing the sample graph through (k, p)-core in the offline stage, and to construct top-down indexes T for graph nodes with different k values. k ;
[0099] The bottom-up index construction module is used to obtain the k-value and p-value information of all graph nodes through (k, p)-core decomposition of the sample graph in the offline stage, and to construct bottom-up indexes T for graph nodes with different k values. k .
[0100] In one embodiment, the top-down index building module includes:
[0101] A connected component subtree construction module is used to select graph nodes with fixed p values from the original connected component subgraph, construct tree nodes for these graph nodes with fixed p values, and delete these graph nodes from the original connected component subgraph;
[0102] The connected component subtree connection module is in communication connection with the connected component subtree construction module, and is used to select graph nodes as fixed p-value graph nodes in ascending order of p-value starting from the minimum p-value, repeatedly execute step S1101, and connect the subtree nodes with larger p-values to the subtree nodes with smaller p-values, and complete the whole T k Construction of tree index.
[0103] Based on the same application concept, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, all or part of the method steps of the above method are implemented.
[0104] The present application implements all or part of the processes in the above method, and can also be completed by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, USB flash drive, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.
[0105] Based on the same application concept, an embodiment of the present application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program running on the processor, and when the processor executes the computer program, all or part of the method steps in the above method are implemented.
[0106] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of a computer device, and uses various interfaces and lines to connect various parts of the entire computer device.
[0107] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the computer device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, video data, etc.). In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Car rd), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0108] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, servers or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.
[0109] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), servers, and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0110] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0111] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0112] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A maximum compact subgraph index search method based on k value and p value, characterized in that: The following steps are involved: Step S1: In the offline stage, the sample graph is decomposed by (k, p)-core to obtain the k value and p value information of all graph nodes, and an index is constructed for each graph node with different k values to record the connectivity relationship between each graph node. ; Step S2: Based on index Implementing the time-optimal index search method in the online phase to obtain the corresponding index search results; The step S1 specifically comprises the following steps: Step S11: In the offline stage, the sample graph is decomposed by (k, p)-core to obtain the k value and p value information of all graph nodes, and a top-down index is constructed for graph nodes with different k values. ; Step S12: In the offline stage, the sample graph is decomposed by (k, p)-core to obtain the k value and p value information of all graph nodes, and a bottom-up index is constructed for graph nodes with different k values. ; The step S11 specifically includes the following steps: Step S110: construct a subtree of each connected component in order of p value from small to large, connect the tree nodes of the newly constructed subtree with larger p value to the tree nodes of the subtree with smaller p value, and complete the whole connected component. Construction of tree index; The step S110 specifically includes the following steps: Step S1101, select graph nodes with fixed p values from the original connected component subgraph, build subtrees for these graph nodes with fixed p values and delete these graph nodes from the original connected component subgraph; Starting from the minimum p value, select graph nodes in ascending order of p value as fixed p value graph nodes, repeat step S1101, and connect the subtree nodes with larger p value to the subtree nodes with smaller p value to complete the whole graph. Construction of tree index; The step S2 specifically comprises the following steps: Step S21: For a given legal query (v, k, p), find The tree index contains the tree nodes of the query graph node v; Step S22, start from the queried tree node and backtrack to find the first current or ancestor graph node such that the p value of the parent graph node of x is lower than the query p value; Step S23: Return The tree index combines the graph nodes in the subtree tree node with x as the root node.
2. The maximum compact subgraph index search method based on k value and p value according to claim 1, characterized in that: The step S12 specifically includes the following steps: S120, construct a subtree of each connected component in descending order of p value, and connect the tree nodes of the newly constructed subtree with smaller p value to the tree nodes of the newly constructed subtree with larger p value, to complete the whole connected component. Construction of tree index.
3. The maximum compact subgraph index search method based on k value and p value as claimed in claim 2, characterized in that: The step S120 specifically includes the following steps: Step S1201, select graph nodes with fixed p values in the sample graph, build a subtree for these graph nodes with fixed p values and connected to each other, and delete these graph nodes from the original connected component subgraph; Step S1202, obtaining the root node of the subtree where the neighbors of the graph nodes in these tree nodes are located, which already existed before the execution of step S1201, and connecting the tree node constructed in this step S1201 with the above existing root node according to the connectivity relationship; Starting from the maximum p value, select the graph nodes with smaller p values than the fixed p value in descending order as the graph nodes with the fixed p value, repeat steps S121 and S122, and connect the tree nodes of the newly constructed subtree with smaller p values with the tree nodes of the newly constructed subtree with larger p values, until every tree node in the original connected component subgraph is added to the in tree index.
4. A maximum compact subgraph index search system based on k value and p value, characterized in that: include: The index building module is used to decompose the sample graph through (k, p)-core in the offline stage to obtain the k value and p value information of all graph nodes, and to build indexes that record the connectivity relationship between each graph node for different k value graph nodes. ; An index search method building module is connected to the index building module for Implementing the time-optimal index search method in the online phase to obtain the corresponding index search results; The index building module includes: The top-down index construction module is used to obtain the k-value and p-value information of all graph nodes through (k, p)-core decomposition of the sample graph in the offline stage, and to construct top-down indexes for graph nodes with different k values. ; The bottom-up index construction module is used to obtain the k-value and p-value information of all graph nodes through (k, p)-core decomposition of the sample graph in the offline stage, and to construct bottom-up indexes for graph nodes with different k values. ; The top-down index building module includes: A connected component subtree construction module is used to select graph nodes with fixed p values from the original connected component subgraph, construct tree nodes for these graph nodes with fixed p values, and delete these graph nodes from the original connected component subgraph; The connected component subtree connection module is connected to the connected component subtree construction module, and is used to select graph nodes as fixed p-value graph nodes in ascending order of p value starting from the minimum p value, repeatedly execute step S1101, and connect the subtree nodes with larger p value to the subtree nodes with smaller p value to complete the whole graph. Construction of tree index.
