A knowledge graph community division method based on graph neural network

Through a graph neural network-based method, we learn the node representation of the knowledge graph and calculate the similarity, and combine it with the Louvain algorithm for community division, which solves the accuracy problem of community division of similar entities in the knowledge graph and improves the cohesion and accuracy of the community. More hidden relationships were discovered.

CN113704500BActive Publication Date: 2024-10-22ZHEJIANG UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111044470.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-07
Publication Date
2024-10-22
Estimated Expiration
2041-09-07

AI Technical Summary

Technical Problem

Existing community discovery algorithms are difficult to accurately divide communities of similar entities in knowledge graphs, and lack effective methods to mine cluster structure information hidden in the graph.

Method used

Using a graph neural network-based method, we perform node representation learning by constructing the adjacency matrix of the knowledge graph and the graph neural network GraphSAGE, calculate the similarity between nodes, and use the Louvain algorithm to perform community division in the undirected authorized node relationship network to improve The accuracy of assessment and division of community cohesion is improved.

Benefits of technology

It achieves precise community division of similar entities in the knowledge graph, improves the accuracy of community division, can discover more hidden node relationships, and has better interpretability and effect than traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113704500B_ABST
    Figure CN113704500B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for dividing communities of knowledge graphs based on graph neural networks, comprising the following steps: 1) constructing a knowledge graph and its adjacency matrix; 2) using a graph neural network to represent and learn nodes in the knowledge graph to obtain vector representations of the nodes; 3) calculating the similarity between nodes based on cosine similarity; 4) constructing an undirected authorized node relationship network based on the adjacency relationship between nodes of the same type and the node similarity; 5) setting modularity to evaluate the degree of cohesion within the community; 6) dividing target nodes in the knowledge graph into communities through a community division algorithm. The present invention learns node features of the knowledge graph through a graph neural network, and then divides communities based on node similarity in a vector space, thereby improving the accuracy of community division.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the fields of knowledge graphs, representation learning, community discovery, etc., and relates to a knowledge graph community division method based on graph neural network. Background Art

[0002] The community reflects the local characteristics of individual behaviors in the network and their mutual correlation. Studying the community in the network plays a vital role in understanding the structure and function of the entire network, and helps to analyze and predict the interaction between the elements of the entire network. Community discovery can be used to mine the hidden clustering structure information in the network, which is of great significance for the analysis of complex network structure and function, and is applied in social networks, biological networks, transaction networks and other fields.

[0003] The knowledge graph is essentially a large semantic network that aims to describe conceptual entity events and their relationships in the objective world. It uses entity concepts as nodes and relationships as edges, providing a way to view the world from a relational perspective, allowing massive and diverse data to be expressed, organized and utilized more efficiently.

[0004] Community discovery, as one of the classic problems in network science, has long attracted extensive attention from researchers. Girvan et al. proposed the GN algorithm (National Academy of Sciences, 2002), which calculates the betweenness of each edge, then deletes the edge with the largest betweenness, and then calculates the new betweenness of each edge again, and repeats this cycle; Newman et al. proposed the FN algorithm (Physical Review E Statal Nonlinear & Soft Matter Physics, 2004), the idea of ​​which is to make the edges within the community as large as possible, but the edges between communities as small as possible; Vincent D et al. proposed the Louvain algorithm (Journal of Statistical Mechanics: Theory and Practice, 2006). Experiment, 2008), which is a multi-level optimized modularity algorithm that can discover hierarchical community structures and is considered to be one of the best performing community detection algorithms; Zhang et al. proposed a spectral method for dividing the network into any number of communities (Physical Review, 2015). This method uses the mapping from modularity maximization to vector partitioning problems and combines vector partitioning to divide the network. Local community detection alleviates the efficiency problem faced by global community detection to a certain extent; Ding et al. designed a two-stage local community detection method based on core detection and community expansion (Knowledge-Based Systems, 2018). In the core detection stage, the seeds are replaced with the core members of the target community, while in the community expansion stage, the detected community core units are used as the initial community and the community is expanded according to the strength of the node relationship; Wang et al. proposed a community discovery algorithm based on improved Markov clustering (Transactions on Knowledge and Data Engineering, 2020), which improved the iterative process between random flow and transition probability, and achieved good results in both static and dynamic networks; Bian et al. proposed the RWM algorithm (Knowledge and Information Systems, 2020), which applied the random walk algorithm to the task of multi-layer network community discovery; EI et al. proposed the NIGLPA algorithm (Expert Systems with Applications, 2020), which used node importance to improve the label propagation and filtering process in the label propagation algorithm, and achieved good results in the task of overlapping network community discovery.

[0005] Knowledge graph is essentially a large-scale heterogeneous entity semantic network. Dividing similar entities in knowledge graph into communities is of great significance for analyzing the relationship between entities. Its task is to analyze the association between nodes in the knowledge graph, divide similar nodes in the knowledge graph into communities, and mine the hidden clustering structure information in the graph. Summary of the invention

[0006] In order to accurately divide communities of entities of the same category in a knowledge graph, the present invention proposes a knowledge graph community division method based on a graph neural network. The structural features of knowledge graph nodes are learned through the graph neural network, and the knowledge graph is embedded in a low-dimensional vector space. Community division is performed in the vector space based on node similarity.

[0007] A knowledge graph community division method based on graph neural network includes the following steps:

[0008] 1) Construct a knowledge graph and its adjacency matrix;

[0009] 2) Use graph neural networks to learn the representation of nodes in the knowledge graph and obtain vector representations of nodes;

[0010] 3) Calculate the similarity between nodes;

[0011] 4) Construct an undirected authorized node relationship network based on the adjacency relationship and node similarity between nodes of the same type;

[0012] 5) Set modularity to assess the degree of cohesion within the community;

[0013] 6) Divide the target nodes in the knowledge graph into communities through the community partitioning algorithm.

[0014] The knowledge graph describes the relationship between entities and defines KG = (E, R, F), where E = {e1, e2, …, e N} represents an entity set, including instances and their attribute values; R = {r1, r2, …, r N} represents the set of relations between entities; F∈E i ×R×E j ; E i ≠E j Represents a set of triples, where the associated entity types are different; a pair of nodes with a direct link relationship in the knowledge graph, the distance between the nodes is 1;

[0015] Assume the number of entities is N, and construct the direct adjacency matrix of the relationship graph:

[0016]

[0017] Furthermore, the step 2) is to use the graph neural network GraphSAGE to perform representation learning on the knowledge graph. The network includes three layers, each layer has input, two full samplings of neighbor nodes, and convolution aggregation operations. The input is the direct adjacency matrix and feature matrix of the knowledge graph and the aggregation function. The sampling and aggregation learn the information of the direct neighbor nodes and the indirect neighbor nodes through the convolution operation. The output after the three-layer sampling and aggregation is used as the final vector representation of the entity. The specific steps are as follows;

[0018] (1) Features of all sampled neighbor nodes

[0019] Sample the direct neighbor nodes and 2-hop neighbor nodes of each central node and learn the features x of the direct neighbor nodes n(v) and 2-hop neighbor node x N(v) The features of , embed the learned features into vector representation;

[0020] (2) Characteristics of Aggregated Neighboring Nodes

[0021] Aggregate the vector representation of the central node and the vector representations of its neighboring nodes to obtain a new vector representation of the central node;

[0022] First, initialize the vector representation of the central node. The initialization formula of the vector representation is:

[0023]

[0024] , where x v represents the vector representation of the central node v, is the vector representation of the initial input, and V is the set of central nodes;

[0025] Then, the vector representation of the central node and the vector representation of its neighboring nodes are aggregated. The aggregation formula is as follows:

[0026]

[0027] , where v is the central node, N(v) is the set of neighboring nodes, mean represents the operation of vector concatenation and averaging each dimension of the vector, and W is the weight matrix; is the vector representation of the central node before aggregation, is the vector representation of neighbor nodes before aggregation;

[0028] (3) Update the vector representation of the central node

[0029] First, aggregate the vector representations of the 2-hop indirect neighbor nodes to update the direct neighbor nodes, and then use the newly obtained vector representations of the direct neighbor nodes to update the vector representation of the current center node. The update formula of the center node vector representation is as follows:

[0030]

[0031] where a v is the vector representation of the currently aggregated node, is the direct neighbor node vector of the currently aggregated node, f update is the aggregation function of GraphSAGE;

[0032] Through the above steps, the nodes of the knowledge graph can be converted into low-dimensional vector representations. The vector integrates the feature information of the node and its neighboring nodes, which is the basis for realizing community division.

[0033] Furthermore, the step 3) uses cosine similarity to calculate the similarity represented by the node vectors. The closer the cosine similarity of the vectors is to 1, the more consistent the directions are, and the more similar they are; the closer the cosine similarity of the vectors is to -1, the less similar they are. The formula for calculating cosine similarity is as follows:

[0034]

[0035] , where A and B are two n-dimensional vector representations, · represents the dot product;

[0036] Furthermore, the knowledge graph contains multiple types of nodes, and community division is generally aimed at nodes of the same type. Therefore, nodes of the same type are extracted from the knowledge graph, and an undirected weighted node relationship network is constructed based on the adjacency relationship between nodes. The network records the connection relationship of nodes of the same type, and the node similarity in step 3) is used to assign corresponding weight values ​​to the connection relationship between nodes. After the above steps, a node relationship network is obtained, which is the input of node community division.

[0037] Furthermore, in step 6), Louvain algorithm is used to divide node communities based on the node relationship network. By continuously traversing the nodes in the network, a single node is tried to be added to the community that can maximize the modularity improvement until all nodes no longer change. Then, each small community is merged into a super node to reconstruct the network. The edge weight is the sum of the edge weights of all original nodes in the two nodes. The algorithm is continuously iterated until it is stable. The community division result of the relationship network when the modularity is the largest is the final community division.

[0038] Community modularity is the weight of the edge within the community minus the sum of the weights of all edges connected to the community nodes. It is used to evaluate the degree of cohesion within the community. The calculation formula is:

[0039]

[0040] Among them, A ij represents the weight of the edge between node i and node j, k i =Σ j Aij represents the sum of the weights of all edges connected to node i; c i represents the community to which node i belongs; δ(c i ,c j ) is a function that, when nodes i and j are in the same community, δ(c i ,c j )=1, otherwise δ(c i ,c j )=0, the function is to automatically calculate the nodes in each community separately, because when calculating the nodes in different communities, this term is 0, then the whole formula is 0; A ij represents the actual weight of the edge connecting node i and node j, k j represents the sum of the weights of all edges connected to the node, k i Similarly; Represents the probability of a node being linked to any node in the entire graph;

[0041] The calculation formula for the modularity increment generated by adding a node to a community is:

[0042]

[0043] , where ∑ in represents the sum of edge weights within a community c; ∑ tot represents the sum of the edge weights connected to all nodes in the community; k i.in represents the sum of the edge weights between node i and nodes in community c; k i represents the sum of the weights of all edges connected to node i; m represents the sum of the weights of all edges in the network;

[0044] The calculation steps of the Louvain algorithm are as follows:

[0045] Input: node relationship network, modularity gain threshold;

[0046] Output: community division results;

[0047] Step 1: Initially, each node is considered as a separate community, and the number of communities is the same as the number of vertices;

[0048] Step 2: For any node i, add it to the community where its neighboring nodes are located in turn, and calculate the modularity change ΔQ before and after the node is added. If ΔQ>0, add node i to the community where the neighboring node is located, otherwise do not make any adjustments; when ΔQ is the largest, record the neighboring node;

[0049] Step 3: Iterate step 2 until the algorithm is stable, that is, the communities to which all nodes in the network belong no longer change;

[0050] Step 4: When the communities to which all nodes in the network belong no longer change, each community is compressed into a new node, the weights of the nodes within the community are converted into the weights of the new nodes, and the weights between communities are converted into the weights of the edges of the new nodes;

[0051] Step 5: Repeat steps 1 to 3 until the algorithm is stable, that is, the modularity of each community no longer changes;

[0052] Step 6: The community division result of the relationship network when the modularity is the largest is the final community division;

[0053] After all the above steps, the community division results of the target node in the knowledge graph can be obtained.

[0054] The beneficial effects of the present invention are:

[0055] The advantage of the present invention is that it learns the embedded representation of the knowledge graph through the graph neural network, obtains the accurate vector representation of the node, and then calculates the similarity between the nodes based on the vector representation, and divides the community according to the similarity, thereby improving the accuracy of the knowledge graph community division. Compared with the traditional unsupervised neural network model based on the adam optimizer, this method flexibly replaces the method of the downstream vector processing task with an algorithm that is more suitable for community division, and has better interpretability; compared with the traditional network community division method, the knowledge graph representation learning based on the neural network can discover more and more comprehensive hidden relationships between nodes, and improve the accuracy of division. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 It is an academic knowledge graph.

[0057] Figure 2 It is the knowledge graph that represents the learning process.

[0058] Figure 3 is a node vector representing the update process.

[0059] Figure 4 It is a constructed node relationship network.

[0060] Figure 5 This is a diagram showing the results of the academic team division. DETAILED DESCRIPTION

[0061] The following is combined with specific academic knowledge maps and reference Figure 1 , Figure 2 , Figure 3 , Figure 4 and Figure 5 The present invention is further described, comprising the following steps:

[0062] 1) Build an academic knowledge graph

[0063] Extract teacher entities and achievement entities from teacher and scientific research achievement data, and construct an academic knowledge graph based on the relationship between teachers and achievements, such as Figure 1 As shown;

[0064] 2) Establish the knowledge graph adjacency matrix

[0065] Construct the adjacency matrix corresponding to the knowledge graph, Figure 1 The direct adjacency matrix A of the academic knowledge graph s for:

[0066]

[0067] 3) Knowledge graph representation learning based on graph neural network

[0068] The knowledge graph neural network GraphSAGE is used to represent the knowledge graph. Its structure includes three layers of input and convolution. The vector dimension of each layer is [128, 128, 128]. Except for the first layer network, the input is initialized as feature vector through formula (1). The feature vector input of each layer is the output vector of the previous layer. First, the direct adjacency matrix A obtained in step (2) s , the dimension of the vector is 128, and the feature vector h is input into the GraphSAGE network. In each layer of the network, it is firstly input through the direct adjacency matrix A s Perform full sampling of 2-hop neighboring nodes for each node and save the sampling results; use formula (2) to Figure 3 First, the 2-hop neighbor nodes are aggregated to the 1-hop neighbor nodes, and then the updated 1-hop neighbor nodes are aggregated to the central node to complete the 2-hop aggregation of the central node. Finally, formula (3) is used to Figure 2 The output feature vector of each layer is input to the next layer of the network in a way of cyclic updating and representation of the nodes to obtain the final representation vector h of the nodes in the knowledge graph. k , in order to learn the characteristic information of teachers and achievements in the academic knowledge graph;

[0069] 4) Calculate the similarity of community nodes

[0070] The direct adjacency matrix A of the social graph obtained in step (1) s Input into the GraphSAGE network model in step (3), and update the vector representation h of all current teacher nodes through formula (3): k , and then calculate the cosine similarity between teachers by formula (4), for example Figure 1After calculating the vector representation, the cosine similarity between teacher 1 and teacher 3 in the equation (4) needs to be used to represent the node similarity as the weight of the subsequent relationship network edge.

[0071] 5) Build a node relationship network

[0072] according to Figure 1 The actual cooperation of teachers in the knowledge graph, such as Figure 4 Construct an undirected authorized academic cooperation network, where nodes represent teachers. If two teachers are in Figure 1 If there is a cooperative result in , there is an edge connecting the two teacher nodes, and the weight of the edge is the similarity between the teacher nodes obtained in step (4); the network records the cooperative relationship of the teacher nodes as the input of the following community division algorithm;

[0073] 6) Based on Louvain community partition algorithm

[0074] First, the reconstructed teacher cooperation relationship network and the modularity gain threshold obtained in step (5) are input into the Louvain algorithm, and the algorithm is continuously traversed. Figure 4 For nodes in the academic network, each teacher node is regarded as a separate community, and then added to the team of its neighboring nodes in turn. The modularity and modularity increment are calculated according to the modularity formula (5) and (6). If the modularity increment ΔQ>0, node i is added to the community of the neighboring node, otherwise no adjustment is made. When ΔQ is the largest, the neighboring node is recorded. Through continuous iteration until the algorithm is stable, that is, the communities to which all nodes in the network belong no longer change, each team is compressed into a new node, the weights of the nodes in the community are converted into the weights of the new nodes, and the weights between communities are converted into the weights of the edges of the new nodes. Repeat the above steps until the algorithm is stable, that is, the modularity of each academic team no longer changes. The community division result of the relationship network when the modularity is the largest is as follows: Figure 5 Team 1 and Team 2 are the final academic team division results.

[0075] The contents described in the embodiments of this specification are merely enumerations of implementation forms of the inventive concept and are for illustrative purposes only. The protection scope of the present invention should not be considered to be limited to the specific forms described in this embodiment, and the protection scope of the present invention also extends to equivalent technical means that can be thought of by ordinary technicians in this field based on the inventive concept.

Claims

1. A knowledge graph community partitioning method based on graph neural network, characterized in that: The following steps are involved: 1) Construct a knowledge graph and its adjacency matrix; 2) Use graph neural networks to learn the representation of nodes in the knowledge graph and obtain vector representations of nodes; 3) Calculate the similarity between nodes; 4) Construct an undirected authorized node relationship network based on the adjacency relationship and node similarity between nodes of the same type; 5) Set modularity to assess the degree of cohesion within the community; 6) Divide the target nodes in the knowledge graph into communities through the community division algorithm; The step 2) is to use the graph neural network GraphSAGE to perform representation learning on the knowledge graph. The network includes three layers, each layer has input, two full samplings of neighbor nodes, and convolution aggregation operations. The input is the direct adjacency matrix and feature matrix of the knowledge graph and the aggregation function. The sampling and aggregation learn the information of the direct neighbor nodes and the indirect neighbor nodes through the convolution operation. The output after the three-layer sampling and aggregation is used as the final vector representation of the entity; Each layer in the graph neural network described above performs the following: (1) Features of all sampled neighbor nodes Sample the direct neighbor nodes and 2-hop neighbor nodes of each central node and learn the features x of the direct neighbor nodes n(v) and 2-hop neighbor x N(v) The features of , embed the learned features into vector representation; (2) Characteristics of Aggregated Neighboring Nodes Aggregate the vector representation of the central node and the vector representation of its neighboring nodes to obtain a new vector representation of the central node: First, initialize the vector representation of the central node. The initialization formula of the vector representation is: where x v represents the vector representation of the central node v, is the vector representation of the initial input, and V is the set of central nodes; Then, the vector representation of the central node and the vector representation of its neighboring nodes are aggregated. The aggregation formula is as follows: Where N(v) is the set of neighbor nodes, mean represents the operation of vector concatenation and averaging each dimension of the vector, and W is the weight matrix; is the vector representation of the central node before aggregation, is the vector representation of neighbor nodes before aggregation; (3) Update the vector representation of the central node First, aggregate the vector representations of the 2-hop indirect neighbor nodes to update the direct neighbor nodes, and then use the newly obtained vector representations of the direct neighbor nodes to update the vector representation of the current center node. The update formula of the center node vector representation is as follows: where a v is the vector representation of the currently aggregated node, is the direct neighbor node vector of the currently aggregated node, f update It is the aggregation function of GraphSAGE.

2. The method for dividing knowledge graph communities based on graph neural network according to claim 1 is characterized in that: The step 3) specifically uses cosine similarity to calculate the similarity represented by the node vector. The closer the cosine similarity of the vector is to 1, the more the direction is consistent, and the more similar they are; the closer the cosine similarity of the vector is to -1, the less similar they are; the cosine similarity calculation formula is as follows: Where A and B are two n-dimensional vector representations and · represents the dot product.

3. The method for dividing knowledge graph communities based on graph neural network according to claim 1 is characterized in that: The step 4) is to extract nodes of the same type from the knowledge graph, and construct an undirected weighted node relationship network based on the adjacency relationship between the nodes. The network records the connection relationship between nodes of the same type, and uses the node similarity obtained in step 3) to assign corresponding weight values ​​to the connection relationship between the nodes to obtain a node relationship network.

4. The method for dividing knowledge graph communities based on graph neural network according to claim 1 is characterized in that: In step 6), Louvain algorithm is used to divide node communities based on the node relationship network. By continuously traversing the nodes in the network, a single node is tried to be added to the community that can maximize the modularity until all nodes no longer change. Then, each small community is merged into a super node to reconstruct the network. The edge weight is the sum of the edge weights of all original nodes in the two nodes. The algorithm is continuously iterated until it is stable. The community division result of the relationship network when the modularity is the largest is the final community division.