A subgraph indicator feature obtaining method, device, equipment and storage medium

By traversing the nodes within each target subgraph in the subgraph set and obtaining the indicator features of each target subgraph based on the matching relationship between node information and indicator information, the problem of how to effectively utilize subgraphs to obtain indicator features is solved, thus improving data utilization.

CN113946717BActive Publication Date: 2025-12-05HAINAN PUSHI INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111209794.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-18
Publication Date
2025-12-05
Estimated Expiration
2041-10-18

AI Technical Summary

Technical Problem

How to effectively utilize the obtained subgraphs to acquire indicator features and improve data utilization.

Method used

By obtaining the metric information constructed by the user, the set of subgraphs to be processed is determined, and each node in each target subgraph is traversed in turn. Based on the matching relationship between node information and metric information, the metric characteristics of each target subgraph are obtained.

Benefits of technology

Effectively utilize the obtained subgraphs to acquire indicator features and improve data utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113946717B_ABST
    Figure CN113946717B_ABST
Patent Text Reader

Abstract

The application discloses a subgraph index feature obtaining method, which comprises the following steps: obtaining index information constructed by a user; determining a current subgraph set to be processed, the subgraph set comprising one or more target subgraphs; sequentially traversing each node in each target subgraph in the subgraph set, and obtaining an index feature of each target subgraph according to a matching relationship between node information of the nodes and the index information. By applying the technical solution provided in the application, the index feature can be effectively obtained by using the obtained subgraph, and the data utilization rate is improved. The application also discloses a subgraph index feature obtaining device, equipment and a storage medium, which have corresponding technical effects.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer application, in particular to a subgraph index feature obtaining method and device, equipment and storage medium. BACKGROUND

[0002] A graph is a widely used data structure, which is suitable for describing data with inherent correlation and close connection. In many application fields, information mining problems can be solved by graph-related theories and corresponding technologies, and subgraph matching technology, as a basic operation for efficient query on graph data, is widely used in practical problems in various fields and industries, such as data analysis in social networks, data analysis of web links in the Internet, and biological data analysis.

[0003] The obtained subgraph needs to be further analyzed to obtain more index features for machine learning, and to mine more valuable things from existing data. Therefore, how to effectively use the obtained subgraph to obtain index features and improve data utilization is a technical problem that needs to be solved by the technical personnel in the field. SUMMARY

[0004] The purpose of the present application is to provide a subgraph index feature obtaining method, device, equipment and storage medium, so as to effectively use the obtained subgraph to obtain index features and improve data utilization.

[0005] To solve the above technical problems, the present application provides the following technical solutions:

[0006] A subgraph index feature obtaining method comprises:

[0007] Obtaining index information constructed by a user;

[0008] Determining a current subgraph set to be processed, wherein the subgraph set comprises one or more target subgraphs;

[0009] Iterating each node in each target subgraph in the subgraph set in sequence, and obtaining index features of each target subgraph according to a matching relationship between node information of each node and the index information.

[0010] In one specific embodiment of the present application, the iteration of each node in each target subgraph in the subgraph set in sequence and the obtaining of index features of each target subgraph according to a matching relationship between node information of each node and the index information comprises:

[0011] Iterating each node in each target subgraph in the subgraph set in sequence, and determining a node to be calculated in each target subgraph according to a matching relationship between node information of each node and the index information.

[0012] Based on the node information of the to-be-calculated nodes in each target subgraph, determine the index features of each target subgraph.

[0013] In an embodiment of the present application, the target subgraph is a subgraph matched with a pre-constructed query graph, the index information includes the identification and attributes of the query points, and the matching of the node information of each node with the index information includes:

[0014] For each node in each target subgraph, determine whether the identification of the current node and the query point matched in the query graph is consistent with the identification of the query point in the index information;

[0015] If consistent, determine whether the current node meets the attribute limit in the index information according to the attributes of the current node;

[0016] If consistent, determine the current node as the to-be-calculated node of the corresponding target subgraph.

[0017] In an embodiment of the present application, the target subgraph is a subgraph obtained based on a subgraph segmentation algorithm, the index information includes the entity point type and attributes in the ontology, and the matching of the node information of each node with the index information includes:

[0018] For each node in each target subgraph, determine whether the type of the current node is consistent with the entity point type in the ontology in the index information;

[0019] If consistent, determine whether the current node meets the attribute limit in the index information according to the attributes of the current node;

[0020] If consistent, determine the current node as the to-be-calculated node of the corresponding target subgraph.

[0021] In an embodiment of the present application, before the nodes in each target subgraph in the subgraph set are sequentially traversed, the method further includes:

[0022] Determine the attributes in the index information;

[0023] Pull back the attributes related to the attributes in the index information in the nodes in each target subgraph in the subgraph set in the database.

[0024] In an embodiment of the present application, before the nodes in each target subgraph in the subgraph set are sequentially traversed, the method further includes:

[0025] The subgraph set is split such that the number of nodes in each resulting subset is less than or equal to a preset upper limit for the number of nodes;

[0026] Accordingly, retrieving from the database the attributes related to the attributes in the indicator information for each node within each target subgraph of the subgraph set includes:

[0027] Retrieve from the database the attributes related to the attributes in the indicator information for each node within each target subgraph of each subset;

[0028] The step of sequentially traversing each node within each target subgraph in the subgraph set includes:

[0029] The nodes in each target subgraph of each subset are traversed in batches.

[0030] In one specific embodiment of this application, the target subgraph is a subgraph that matches a pre-constructed query graph. The step of retrieving from the database the attributes related to the attributes in the indicator information for each node within each target subgraph of each subset includes:

[0031] For each subset, perform deduplication on the nodes within each target subgraph in the current subset;

[0032] Retrieve from the database the attributes of the nodes in the current subset that are related to the attributes in the indicator information;

[0033] Accordingly, the process of sequentially traversing each node within each target subgraph of each subset, and obtaining the indicator features of each target subgraph based on the matching relationship between the node information and the indicator information, includes:

[0034] By traversing the graph, the matching results between the node information of each node in each target subgraph of each subset and the index information are obtained.

[0035] By merging the nodes and their corresponding matching results within the same target subgraph using the subgraph identifiers recorded by each node, the index characteristics of each target subgraph are obtained.

[0036] A device for obtaining subgraph index features, comprising:

[0037] The indicator information acquisition module is used to obtain indicator information constructed by the user;

[0038] The subgraph set determination module is used to determine the current set of subgraphs to be processed, wherein the subgraph set includes one or more target subgraphs;

[0039] An index feature obtaining module is configured to sequentially traverse each node in each target subgraph in the subgraph set, and obtain an index feature of each target subgraph according to a matching relationship between node information of each node and the index information.

[0040] A subgraph index feature obtaining device comprises:

[0041] A memory is configured to store a computer program.

[0042] A processor is configured to implement the steps of the subgraph index feature obtaining method according to any one of the preceding embodiments when the computer program is executed.

[0043] A computer readable storage medium has a computer program stored thereon, and the computer program is configured to implement the steps of the subgraph index feature obtaining method according to any one of the preceding embodiments when executed by a processor.

[0044] According to the technical solution provided in the embodiments of the present application, the index information constructed by a user is obtained, and after a current subgraph set to be processed is determined, each node in each target subgraph in the subgraph set is sequentially traversed, and an index feature of each target subgraph is obtained according to a matching relationship between node information of each node and the index information. The index feature of the obtained subgraph can be effectively utilized, and the data utilization rate is improved. BRIEF DESCRIPTION OF DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.

[0046] Figure 1 An implementation flowchart of a subgraph index feature obtaining method in the embodiments of the present application;

[0047] Figure 2 A specific example schematic diagram of a query graph in the embodiments of the present application;

[0048] Figure 3 A construction schematic diagram of an entity index in the embodiments of the present application;

[0049] Figure 4 A specific example schematic diagram of an ontology in the embodiments of the present application;

[0050] Figure 5 A construction schematic diagram of another subgraph index in the embodiments of the present application;

[0051] Figure 6It is a structural schematic diagram of a subgraph index feature obtaining device in an embodiment of the present application.

[0052] Figure 7 It is a structural schematic diagram of a subgraph index feature obtaining device in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to enable persons skilled in the art to better understand the present application, the present application will be further described in detail below in combination with the drawings and specific embodiments. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor fall within the scope of protection of the present application.

[0054] Referring to Figure 1 As shown in the drawing, it is an implementation flowchart of a subgraph index feature obtaining method provided by an embodiment of the present application, which can include the following steps:

[0055] S110: Obtain index information constructed by a user.

[0056] In actual application, there can be multiple index feature obtaining requirements, and the user can construct corresponding indexes according to actual requirements. For example, the following index operators:

[0057] Total number: that is, calculate the number of nodes in the subgraph that meet the total number index query point, the nodes in the subgraph not only match the type of the query point, but also match the attribute limit when the total number index is set, for example, calculate the total number of nodes that match the consumer 2 rule point in the subgraph, and the gender of the node matching consumer 2 needs to be female, the number of such attribute limitations is unlimited, multiple attribute limitations can be performed on one query point; if there are multiple attributes, the attribute limitation relationship can be "and" or "or", for example, the gender of the node of consumer 2 is female and the age is greater than 25; or, the gender of the node of consumer 2 is female or the age is greater than 25;

[0058] Percentage: that is, calculate the percentage of the number of nodes in the subgraph that meet the percentage index query point in the number of all nodes in the subgraph, and the attribute limit is the same as above;

[0059] Ratio: that is, calculate the ratio of the number of nodes that meet the numerator and denominator settings in the subgraph, and the attribute limit is the same as above, and the attribute limit can be performed on the numerator and denominator respectively;

[0060] Max: that is to calculate the maximum value of the specified attribute of the query node in the subgraph that meets the maximum value index, which involves attribute calculation of the nodes in the subgraph, the nodes in the subgraph need to meet the type requirements of the query graph or the query point in the query graph, and meet the corresponding attribute limit, and the corresponding attribute calculation is performed under the premise of meeting the type and attribute limit. For example, the index is to calculate the maximum value of the age of the node that meets consumer 2, and the gender attribute of this node is female. That is, the maximum value of the age of the node that matches consumer 2 in the subgraph and is female is calculated;

[0061] Min: that is to calculate the minimum value of the specified attribute of the current query point in the subgraph, which involves attribute calculation, and the attribute limit is the same as above;

[0062] Variance: that is to calculate the variance of the specified attribute of the current query point in the subgraph, which involves attribute calculation, and the attribute limit is the same as above;

[0063] Sum: that is to calculate the sum of the specified attribute of the current query point in the subgraph, which involves attribute calculation, and the attribute limit is the same as above;

[0064] Average: that is to calculate the average of the specified attribute of the current query point in the subgraph, which involves attribute calculation, and the attribute limit is the same as above.

[0065] In the specific construction process, the query graph can be constructed first. Specifically, the query graph can be constructed according to the preset query rule, the query graph is a one-layer or multi-layer tree structure, includes multiple query points, each query point has its own node type, and the edges between the query points represent the relationship between the query points. Figure 2 As shown in a query graph example constructed, the query graph includes three query points of consumer 1, consumer 2 and province, indicating that consumer 1 and consumer 2 are in the same province.

[0066] After constructing the query graph, the entity index can be further constructed, and the index name, Chinese name, operator, calculation subject and the like can be set. For example, Figure 3 As shown in a construction diagram of an entity index, the constructed entity index is constructed by selecting a query point in the query graph, such as consumer 2, and the entity index is to calculate the number of nodes that match the query point consumer 2 in the subgraph.

[0067] That is, the index information is constructed for a query point in the query tree. For example, a count index can be constructed to count the number of nodes that meet a query point in the subgraph, or the average value of an attribute of a query point in the subgraph can be calculated. When constructing the index information, not only can a query point in the query graph be specified, but also the attribute of the query point can be limited, so the constructed index information records the identification of the query point corresponding to the index, the query point type, and the limit information of the attribute field involved in the index.

[0068] Subgraph metrics can also be constructed based on ontology, converting tabular data into graph data. Subgraph metric calculations are performed on the subgraphs obtained through a subgraph segmentation algorithm. Figure 4 The diagram shown is a specific example of an ontology construction. Based on this ontology, subgraph indicators can be further constructed, and indicator names, Chinese names, operators, and calculation subjects can be set. For example... Figure 5 The diagram illustrates the construction of a subgraph metric, which calculates the average age of consumers in each community. One community corresponds to one subgraph.

[0069] In practical applications, user-defined metrics can be obtained through a human-computer interaction interface.

[0070] S120: Determine the current set of subgraphs to be processed. The set of subgraphs includes one or more target subgraphs.

[0071] The set of subgraphs to be processed can be determined based on actual needs. This set includes one or more target subgraphs. The original graph can be filtered by vertex-edge processing based on the query point types and relationships between query points to obtain the target graph. Then, the subgraphs within the target graph that match the query graph are determined. In other words, the target subgraphs to be processed can be obtained based on a pre-constructed query graph; these can be one or more, and the set they constitute is the subgraph set. Alternatively, target subgraphs can be obtained based on community partitioning; again, this can be one or more, and the set they constitute is the subgraph set.

[0072] S130: Iterate through each node in each target subgraph in the subgraph set in turn, and obtain the indicator features of each target subgraph based on the matching relationship between the node information and indicator information of each node.

[0073] After obtaining the indicator information constructed by the user and determining the current set of subgraphs to be processed, the nodes in each target subgraph in the subgraph set can be traversed sequentially to determine the matching relationship between the node information and indicator information of each traversed node. Based on the matching relationship, the indicator features of each target subgraph can be obtained.

[0074] In one specific embodiment of this application, this step may include the following steps:

[0075] Step 1: Iterate through each node in each target subgraph in the subgraph set in turn, and determine the node to be calculated in each target subgraph based on the matching relationship between the node information and the indicator information.

[0076] Step 2: Based on the node information of the nodes to be calculated in each target subgraph, determine the index characteristics of each target subgraph.

[0077] For ease of description, the above two steps are described together.

[0078] In the embodiment of the present application, after determining the current subgraph set to be processed, each node in each target subgraph in the subgraph set can be traversed in turn, and the node information of each node is matched with the index information. The node information can include node type, node identifier, identifier of the query point matched by the node, identifier of the target subgraph where the node is located, node attribute, and the like.

[0079] According to the matching relationship between the node information of each node and the index information, the to-be-calculated nodes in each target subgraph can be determined. The nodes having node information matched with the index information can be determined as to-be-calculated nodes.

[0080] Specifically, if the target subgraph is a subgraph matched with the pre-constructed query graph, and the index information includes the identifier and attribute of the query point, according to the matching relationship between the node information of each node and the index information, the to-be-calculated nodes in each target subgraph can include the following steps:

[0081] The first step: for each node in each target subgraph, it is determined whether the identifier of the query point matched by the current node in the query graph is consistent with the identifier of the query point in the index information; if consistent, the operation of the second step is performed;

[0082] The second step: according to the attribute of the current node, it is determined whether the current node meets the limitation of the attribute in the index information; if consistent, the operation of the third step is performed;

[0083] The third step: the current node is determined as the to-be-calculated node of the corresponding target subgraph.

[0084] The target subgraph can be a subgraph matched with the pre-constructed query graph, and the obtained user-constructed index information can include the identifier and attribute of the query point, such as the identifier of the query point being consumer 2 and the attribute being female. The determined current subgraph set to be processed can include one or more target subgraphs. For each node in each target subgraph, it can be determined whether the identifier of the query point matched by the current node in the query graph is consistent with the identifier of the query point in the index information. If consistent, it is considered that the current node corresponds to the query point included in the index information. If not consistent, it is considered that the current node does not correspond to the query point included in the index information, and the current node can be ignored, and the determination of the next node is continued.

[0085] In a case where the identification of the current node and the query point matched in the query graph is consistent with the identification of the query point targeted in the index information, the attribute of the current node can be further determined, and whether the current node meets the attribute limit in the index information is determined according to the attribute of the current node, such as whether the attribute of the current node is female.

[0086] If the current node meets the attribute limit in the index information, the current node can be determined as a to-be-calculated node of the corresponding target subgraph. If not, the current node can be ignored, and the determination of the next node is continued.

[0087] The target subgraph can also be a subgraph obtained based on community division, and the index information includes an entity point type and an attribute in an ontology targeted. According to the matching relationship between the node information of each node and the index information, the to-be-calculated node in each target subgraph can include the following steps:

[0088] Step one: For each node in each target subgraph, it is determined whether the type of the current node is consistent with the entity point type in the ontology targeted in the index information. If yes, the operation of step two is performed.

[0089] Step two: According to the attribute of the current node, it is determined whether the current node meets the attribute limit in the index information. If yes, the operation of step three is performed.

[0090] Step three: The current node is determined as a to-be-calculated node of the corresponding target subgraph.

[0091] In the embodiments of the present application, the target subgraph is a subgraph obtained based on community division, and the index information includes an entity point type and an attribute in an ontology targeted. The entity point type is, for example, a consumer, and the attribute is, for example, an average age.

[0092] The determined current to-be-processed subgraph set includes one or more target subgraphs. Each node in each target subgraph in the subgraph set can be traversed in turn. For each node in each target subgraph, it can be first determined whether the type of the current node is consistent with the entity point type in the ontology targeted in the index information. If yes, it is considered that the current node corresponds to the entity point in the ontology targeted in the index information, otherwise, it is considered that the two do not correspond, and the current node can be ignored, and the determination of the next node is continued.

[0093] In a case where the type of the current node is consistent with the entity point type in the ontology targeted in the index information, the attribute of the current node can be further determined, and whether the current node meets the attribute limit in the index information is determined according to the attribute of the current node. If yes, the current node can be determined as a to-be-calculated node of the corresponding target subgraph, otherwise, the current node can be ignored, and the determination of the next node is continued.

[0094] After the to-be-calculated nodes are determined, the index feature of each target subgraph can be determined based on the node information of the to-be-calculated nodes in each target subgraph.

[0095] For example, the index information constructed by the user is the number of nodes in the calculation target subgraph that match the query point of consumer 2. After the to-be-calculated nodes are determined according to the matching relationship between the node information of each node in the target subgraph and the index information, the total number of the to-be-calculated nodes is the index feature of the target subgraph.

[0096] The acquisition of the index feature of each target subgraph can increase the description latitude of the target of the index information, and the target can be a query point or an ontology. In addition, the subgraph obtained by using the subgraph division algorithm has a certain similarity between the nodes in the subgraph. Through index calculation, the attribute dimension of each node in the subgraph obtained by the subgraph division algorithm can be used to describe the feature of the community corresponding to the subgraph. The subgraph division algorithm includes a community division algorithm and a connected graph algorithm. The subgraph obtained by the community division algorithm or the connected graph algorithm does not affect the implementation of the embodiments of the present application, and the embodiments of the present application are not limited in this regard. After the index feature of each target subgraph is obtained, it can be applied to machine learning to predict the behavior of the user or possible problems, and can also be applied to strategy making to better and more targeted make strategies.

[0097] After the index information constructed by the user is obtained and the current to-be-processed subgraph set is determined, each node in each target subgraph in the subgraph set can be traversed in sequence, and the index feature of each target subgraph can be obtained according to the matching relationship between the node information of each node and the index information. The index feature can be effectively obtained by using the obtained subgraph, and the data utilization rate can be improved.

[0098] In an embodiment of the present application, after the current to-be-processed subgraph set is determined and before each node in each target subgraph in the subgraph set is traversed in sequence, the method can further include the following steps:

[0099] Step one: determine the attribute in the index information;

[0100] Step two: pull back the attribute related to the attribute in the index information of each node in each target subgraph in the subgraph set in the database.

[0101] In the embodiment of the present application, the obtained user-constructed index information can include attribute information and the like. After determining the current to-be-processed subgraph set, the nodes in each target subgraph included in the subgraph set can only record the identification of the query point that the node meets and the identification of the subgraph to which the node belongs. If each node in the target subgraph included in the subgraph set is missing attribute recording, the attribute in the index information can be determined, and the attribute related to each node in each target subgraph in the subgraph set and the attribute in the index information can be pulled back in the database.

[0102] The database can record large and complete node information. Each node in each target subgraph can only record several necessary information. When the attribute is needed for index calculation, the corresponding attribute can be pulled back in the database, so as to reduce the data amount.

[0103] In one embodiment of the present application, before sequentially traversing each node in each target subgraph in the subgraph set, the following step can be further included:

[0104] The subgraph set is split, so that each sub-set obtained by splitting includes a number of nodes less than or equal to a preset upper limit of the number of nodes;

[0105] Correspondingly, the attribute related to each node in each target subgraph in the subgraph set and the attribute in the index information is pulled back in the database, including:

[0106] The attribute related to each node in each target subgraph in each sub-set and the attribute in the index information is respectively pulled back in the database;

[0107] Sequentially traversing each node in each target subgraph in the subgraph set, including:

[0108] Batching sequentially traversing each node in each target subgraph in each sub-set.

[0109] In the embodiment of the present application, after determining the current to-be-processed subgraph set, the subgraph set can be split to obtain a plurality of sub-sets, and each sub-set obtained by splitting includes a number of nodes less than or equal to a preset upper limit of the number of nodes. The upper limit of the number of nodes can be set and adjusted according to actual conditions.

[0110] After splitting the subgraph set, each sub-set can be processed in batches. Specifically, the attribute related to each node in each target subgraph in each sub-set and the attribute in the index information can be respectively pulled back in the database, and then each node in each target subgraph in each sub-set can be sequentially traversed in batches. Finally, the index feature of each target subgraph is obtained.

[0111] In an embodiment of the present application, the target subgraph is a subgraph matched with the pre-constructed query graph, and the attributes related to the attributes in the node information and the index information of each node in each target subgraph in each sub-set are pulled back from the database, which can include the following steps:

[0112] For each sub-set, the nodes in each target subgraph in the current sub-set are de-duplicated;

[0113] The attributes related to the attributes in the node information and the index information of the nodes in the current sub-set are pulled back from the database;

[0114] Correspondingly, each node in each target subgraph in each sub-set is traversed in batches, and the index feature of each target subgraph is obtained according to the matching relationship between the node information and the index information of each node, including:

[0115] Through the traversal operation, the matching results of the node information and the index information of each node in each target subgraph in each sub-set are obtained respectively;

[0116] Through the subgraph identifier recorded by each node, the nodes in the same target subgraph and the corresponding matching results are merged to obtain the index feature of each target subgraph.

[0117] In an embodiment of the present application, the target subgraph is a subgraph matched with the pre-constructed query graph, and after the subgraph set is split to obtain multiple sub-sets, the same node can appear in multiple subgraphs. If this situation occurs frequently, it will cause memory overflow. Therefore, for each sub-set, the nodes in each target subgraph in the current sub-set can be de-duplicated, and subsequent operations are performed on the de-duplicated sub-set, such as pulling back the attributes related to the attributes in the node information and the index information of the nodes in the current sub-set from the database.

[0118] Through the traversal operation, the matching results of the node information and the index information of each node in each target subgraph in each sub-set are obtained respectively, and the subgraph identifier is recorded in each node. Through the subgraph identifier recorded by each node, the nodes in the same target subgraph and the corresponding matching results are merged to obtain the index feature of each target subgraph.

[0119] Overall, the attribute pulling operation is involved in the embodiment of the present application. Since the same node can exist in multiple target subgraphs, the resource size occupied by the pulled attributes is actually larger than the resource size of the point attributes in the original graph. If the attributes of the nodes in all target subgraphs are directly pulled, it is extremely likely to cause memory overflow under limited resources. Therefore, the following optimizations are made in the embodiment of the present application:

[0120] I. Only pull part of the attributes needed in the process of obtaining the index feature, that is, the attributes included in the index information.

[0121] Second, split the subgraph set and obtain the indicator features of the target subgraphs in batches.

[0122] Third, after deduplicating nodes within the target subgraph in the same subset, first calculate the index features corresponding to the nodes, and then perform the aggregation operation to calculate the index features corresponding to the target subgraph.

[0123] The attribute acquisition operation for indicator features can include attributes inherent to the indicator itself and attributes related to indicator constraints. Operators for the attributes inherent to the indicator itself include those for calculating specific attribute values ​​such as maximum, minimum, average, summation, and variance. Attributes related to indicator constraints refer to the restrictions that a node in the target subgraph must meet after matching the query point before calculation can be performed. After obtaining the indicator information, the relevant attributes can be recorded. When retrieving node attributes, only the attributes that need to be calculated are retrieved, while other attributes are not retrieved. This reduces the resources consumed by attribute retrieval.

[0124] Batch computation involves setting an upper limit on the number of nodes before acquiring indicator features. This upper limit restricts the maximum number of points that can be computed in the same batch. By using the upper limit on the number of nodes, the subgraph set is split into multiple parts, and indicator features are acquired and output for each part.

[0125] To prevent the frequent occurrence of the same node appearing in multiple target subgraphs within the same batch after batching, thus causing memory overflow issues, this embodiment of the application gathers all nodes calculated in this batch for deduplication, resulting in a unique set of nodes. Each node in this set records which query points it has matched. Then, the attributes of this node set are retrieved, and the identifiers of the query points recorded on the nodes are used to determine if they match the identifiers of the query points involved in the indicator information. If they match, the node's attributes are used to calculate the relevant indicator features. Ultimately, these unique nodes record the identifier of their respective subgraph, the identifier of the matched indicator information, and the indicator features. Since the attributes have already been calculated, they are no longer needed. After completing the above steps, nodes within the same target subgraph and their corresponding indicator features can be merged using the identifier of their respective subgraph to obtain the indicator features of the corresponding target subgraph.

[0126] Corresponding to the above method embodiments, this application also provides a subgraph indicator feature acquisition device. The subgraph indicator feature acquisition device described below and the subgraph indicator feature acquisition method described above can be referred to in correspondence.

[0127] See Figure 6 As shown, the device may include the following modules:

[0128] The index information obtaining module 610 is configured to obtain index information constructed by a user.

[0129] The subgraph set determining module 620 is configured to determine a current subgraph set to be processed, the subgraph set including one or more target subgraphs.

[0130] The index feature obtaining module 630 is configured to sequentially traverse each node in each target subgraph in the subgraph set, and obtain an index feature of each target subgraph according to a matching relationship between node information of each node and the index information.

[0131] By using the apparatus provided in the embodiments of the present application, the index information constructed by the user is obtained, and after the current subgraph set to be processed is determined, each node in each target subgraph in the subgraph set is sequentially traversed, and the index feature of each target subgraph is obtained according to the matching relationship between the node information of each node and the index information. The index feature can be effectively obtained by using the obtained subgraph, and the data utilization rate is improved.

[0132] In one specific embodiment of the present application, the index feature obtaining module 630 is configured to:

[0133] sequentially traverse each node in each target subgraph in the subgraph set, and determine a to-be-calculated node in each target subgraph according to a matching relationship between node information of each node and the index information.

[0134] determine an index feature of each target subgraph based on node information of the to-be-calculated node in each target subgraph.

[0135] In one specific embodiment of the present application, the target subgraph is a subgraph matched with a pre-constructed query graph, and the index information includes an identifier and an attribute of a query point, and the index feature obtaining module 630 is configured to:

[0136] for each node in each target subgraph, determine whether an identifier of a query point matched with the current node in the query graph is consistent with the identifier of the query point in the index information;

[0137] if the identifiers are consistent, determine whether the current node meets a limitation on the attribute in the index information according to the attribute of the current node;

[0138] if the current node meets the limitation, the current node is determined as a to-be-calculated node of the corresponding target subgraph.

[0139] In one specific embodiment of the present application, the target subgraph is a subgraph obtained based on community division, the index information includes an entity point type and an attribute in an ontology, and the index feature obtaining module 630 is configured to:

[0140] For each node in each target subgraph, determine whether the type of the current node is consistent with the entity point type in the ontology targeted by the attribute information;

[0141] If consistent, determine whether the current node meets the limit of the attribute in the attribute information according to the attribute of the current node;

[0142] If consistent, determine the current node as a to-be-calculated node of the corresponding target subgraph.

[0143] In an embodiment of the present application, the attribute pulling module is further used for:

[0144] Before determining the current to-be-processed subgraph set and before sequentially traversing each node in each target subgraph in the subgraph set, the attribute in the attribute information is determined.

[0145] The attribute related to the attribute in the attribute information is pulled back in the database for each node in each target subgraph in the subgraph set.

[0146] In an embodiment of the present application, the splitting module is further used for:

[0147] Before sequentially traversing each node in each target subgraph in the subgraph set, the subgraph set is split, so that each sub-set obtained by the splitting includes a number of nodes less than or equal to the preset upper limit of the number of nodes.

[0148] Correspondingly, the attribute pulling module is used for:

[0149] The attribute related to the attribute in the attribute information is pulled back in the database for each node in each target subgraph in each sub-set;

[0150] The attribute feature obtaining module 630 is used for:

[0151] Each node in each target subgraph in each sub-set is sequentially traversed in batches.

[0152] In an embodiment of the present application, the target subgraph is a subgraph matched with a pre-constructed query graph, and the attribute pulling module is used for:

[0153] For each sub-set, the nodes in each target subgraph in the current sub-set are processed for deduplication;

[0154] The attribute related to the attribute in the attribute information is pulled back in the database for the nodes in the current sub-set;

[0155] Correspondingly, the attribute feature obtaining module 630 is used for:

[0156] The matching results of the node information and the index information of each node in each target subgraph in each sub-set are obtained through the traversal operation;

[0157] The nodes in the same target subgraph and the corresponding matching results are merged through the subgraph identifier recorded by each node, and the index feature of each target subgraph is obtained.

[0158] Corresponding to the above method embodiment, the embodiment of the application further provides a subgraph index feature obtaining device, comprising:

[0159] a memory for storing a computer program;

[0160] a processor for executing the computer program to realize the steps of the above subgraph index feature obtaining method.

[0161] As shown in Figure 7 , it is a component structure diagram of the subgraph index feature obtaining device. The subgraph index feature obtaining device can include a processor 10, a memory 11, a communication interface 12 and a communication bus 13. The processor 10, the memory 11 and the communication interface 12 all complete the communication among each other through the communication bus 13.

[0162] In the embodiment of the application, the processor 10 can be a central processing unit (CPU), a specific application integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic devices, etc.

[0163] The processor 10 can call the program stored in the memory 11. Specifically, the processor 10 can execute the operations in the embodiment of the subgraph index feature obtaining method.

[0164] The memory 11 is used to store one or more programs. The program can include program code, and the program code includes computer operation instructions. In the embodiment of the application, the memory 11 at least stores a program for realizing the following functions:

[0165] obtaining the index information constructed by the user;

[0166] determining the current subgraph set to be processed, the subgraph set including one or more target subgraphs;

[0167] sequentially traversing each node in each target subgraph in the subgraph set, and obtaining the index feature of each target subgraph according to the matching relationship between the node information and the index information of each node.

[0168] In a possible implementation, the memory 11 can include a program storage area and a data storage area, where the program storage area can store an operating system and application programs required by at least one function (such as the information comparison function and the index calculation function), and the like; and the data storage area can store data created during use, such as subgraph node data and index information data.

[0169] In addition, the memory 11 can include a high-speed random access memory, and can also include a non-volatile memory, for example, at least one magnetic disk storage device or other volatile solid-state storage device.

[0170] The communication interface 12 can be an interface of a communication module, and is configured to be connected with other devices or systems.

[0171] Of course, it needs to be noted that, Figure 7 The structures shown do not constitute a limitation on the subgraph index feature obtaining device in the embodiments of the present application, and the subgraph index feature obtaining device can include more or fewer components than those shown, or combine certain components in actual applications. Figure 7 The structures shown do not constitute a limitation on the subgraph index feature obtaining device in the embodiments of the present application, and the subgraph index feature obtaining device can include more or fewer components than those shown, or combine certain components in actual applications.

[0172] Corresponding to the method embodiments above, the embodiments of the present application further provide a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the subgraph index feature obtaining method.

[0173] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other.

[0174] The skilled person can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed in the present text can be realized in electronic hardware, computer software or a combination of both. In order to clearly show the interchangeability of hardware and software, the composition and steps of each example have been described in the above description. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0175] The steps of the method or algorithm described in conjunction with the embodiments disclosed in the present text can be directly implemented by hardware, a software module executed by a processor, or a combination of both. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0176] The principles and implementations of the present application are described herein with specific examples. The above examples are only used to help understand the technical solutions of the present application and the core ideas thereof. It should be indicated that, for those skilled in the art, without departing from the principles of the present application, some improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.

Claims

1. A subgraph indicator feature obtaining method, characterized by, The method comprises the following steps: obtaining user-constructed index information; the index information comprises a query graph and an entity index, and the entity index comprises an index name, a Chinese name, an operator and a calculation subject; constructing a query graph according to a preset query rule, wherein the query graph is a one-layer or multi-layer tree structure, comprises a plurality of query points, each query point comprises a respective node type, and the edges between the query points represent the relationships between the query points; setting the index name, the Chinese name, the operator and the calculation subject according to the query points in the query graph to construct the entity index; determining a current to-be-processed subgraph set, wherein the subgraph set comprises one or more target subgraphs, the subgraph set comprises data in a social network, and the determination of the current to-be-processed subgraph set comprises: performing point-edge filtering processing on an original graph according to the node types and the relationships between the query points of the query graph to obtain a target graph, and then determining a subgraph in the target graph that matches the query graph; sequentially traversing each node in each target subgraph in the subgraph set, and obtaining the index features of each target subgraph according to the matching relationship between the node information of each node and the index information; the sequentially traversing each node in each target subgraph in the subgraph set and obtaining the index features of each target subgraph according to the matching relationship between the node information of each node and the index information comprises: sequentially traversing each node in each target subgraph in the subgraph set, and determining the to-be-calculated nodes in each target subgraph according to the matching relationship between the node information of each node and the index information; determining the index features of each target subgraph based on the node information of the to-be-calculated nodes in each target subgraph; the target subgraph is a subgraph that matches a pre-constructed query graph, the index information comprises the identification and attributes of the query points, and the determination of the to-be-calculated nodes in each target subgraph according to the matching relationship between the node information of each node and the index information comprises: for each node in each target subgraph, determining whether the identification of the matching query point in the query graph and the identification of the query point in the index information are consistent; if consistent, determining whether the current node meets the attribute restrictions in the index information according to the attributes of the current node; if consistent, determining the current node as the to-be-calculated node of the corresponding target subgraph.

2. The subgraph indicator feature obtaining method of claim 1, wherein, the target subgraph is a subgraph obtained based on a subgraph segmentation algorithm, the index information comprises the entity point types and attributes in an ontology, and the determination of the to-be-calculated nodes in each target subgraph according to the matching relationship between the node information of each node and the index information comprises: for each node in each target subgraph, determining whether the type of the current node is consistent with the entity point types in the ontology in the index information; if consistent, determining whether the current node meets the attribute restrictions in the index information according to the attributes of the current node; if consistent, determining the current node as the to-be-calculated node of the corresponding target subgraph.

3. The subgraph indicator feature obtaining method of claim 1, wherein, after the determination of the current to-be-processed subgraph set and before the sequential traversal of each node in each target subgraph in the subgraph set, the method further comprises the following steps: determining attributes in the index information; pulling back, in the database, attributes of each node in each target subgraph in the subgraph set and the attributes in the index information.

4. The subgraph indicator feature obtaining method of claim 3, wherein, Before the nodes in each target subgraph in the subgraph set are traversed in sequence, the method further includes: splitting the subgraph set so that each sub-set obtained by splitting includes a number of nodes less than or equal to a preset upper limit of the number of nodes; correspondingly, the pulling back, in the database, of the attributes of each node in each target subgraph in the subgraph set and the attributes in the index information includes: pulling back, in the database, the attributes of each node in each target subgraph in each sub-set and the attributes in the index information respectively; the traversing of the nodes in each target subgraph in each sub-set in batches in sequence includes: traversing the nodes in each target subgraph in each sub-set in batches in sequence.

5. The subgraph indicator feature obtaining method of claim 4, wherein, The target subgraph is a subgraph matched with the pre-constructed query graph, and the pulling back, in the database, of the attributes of each node in each target subgraph in each sub-set and the attributes in the index information includes: for each sub-set, performing a de-duplication process on the nodes in each target subgraph in the current sub-set; pulling back, in the database, the attributes of the nodes in the current sub-set and the attributes in the index information; correspondingly, the traversing of the nodes in each target subgraph in each sub-set in batches in sequence includes, according to the matching relationship between the node information of each node and the index information, obtaining the index feature of each target subgraph, including: obtaining, through the traversal operation, the matching results of the node information of each node in each target subgraph in each sub-set and the index information respectively; merging the nodes in the same target subgraph and the corresponding matching results through the subgraph identifiers recorded by the nodes to obtain the index feature of each target subgraph.

6. A subgraph indicator feature obtaining apparatus characterized by comprising: including: an index information obtaining module, configured to obtain index information constructed by a user; the index information includes a query graph and an entity index, and the entity index includes an index name, a Chinese name, an operator and a calculation subject; the query graph is constructed according to a preset query rule and is a one-layer or multi-layer tree structure including a plurality of query points, each query point including a respective node type, and the edges between the query points representing the relationship between the query points; the index name, the Chinese name, the operator and the calculation subject are set according to the query points in the query graph to construct the entity index; a subgraph set determining module, configured to determine a current subgraph set to be processed, the subgraph set including one or more target subgraphs; the subgraph set includes data in a social network; the determination of the current subgraph set to be processed includes: performing point-edge filtering processing on an original graph according to the node types and the relationship between the query points of the query graph to obtain a target graph, and then determining the subgraphs in the target graph matched with the query graph; an index feature obtaining module, configured to traverse the nodes in each target subgraph in the subgraph set in sequence and obtain the index feature of each target subgraph according to the matching relationship between the node information of each node and the index information; the index feature obtaining module is configured to The nodes in each target subgraph in the subgraph set are sequentially traversed, and according to the matching relationship between the node information and the index information of each node, the to-be-calculated nodes in each target subgraph are determined; Based on the node information of the to-be-calculated nodes in each target subgraph, the index feature of each target subgraph is determined; The target subgraph is a subgraph matched with the pre-constructed query graph, and the index information includes the identifier and attribute of the query point. The index feature obtaining module is used to: For each node in each target subgraph, it is determined whether the identifier of the matched query point in the current node and the query graph is consistent with the identifier of the query point in the index information; If consistent, it is determined whether the current node meets the attribute limit in the index information according to the attribute of the current node; If consistent, the current node is determined as the to-be-calculated node of the corresponding target subgraph.

7. A subgraph indicator feature obtaining device characterized by comprising: Comprise: A memory for storing a computer program; A processor for executing the computer program to implement the steps of the subgraph index feature obtaining method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer program is stored on the computer readable storage medium, and the computer program is executed by the processor to implement the steps of the subgraph index feature obtaining method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Graph pattern matching method for supporting fuzzy constraint relation

    CN105138601A

  • Sub-graph matching method, device and equipment and storage medium

    CN112667860A