Network representation learning method based on community subgraph
Through the network representation learning method based on community subgraphs, the community structure is identified and optimized, which solves the problem of existing methods that only retain the microstructure, and achieves higher quality node representation and link prediction accuracy.
Patent Information
- Application Number
- CN202310462417.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-26
- Publication Date
- 2025-01-21
AI Technical Summary
The existing network representation learning method only retains the microstructure of the network, lacks the constraints of the community structure, and it is difficult to retain both the microstructure and the mesoscopic community structure, resulting in low quality of node characterization.
Adopt a network representation learning method based on community subgraph, identify the optimal community structure through the non-overlapping community detection algorithm Louvain, calculate the bridge nodes and merge them into the community node set, establish the community subgraph, use the DeepWalk model to learn the node representation vector, initialize and optimize the community Subgraph nodes represent vectors.
This method can simultaneously preserve microstructure and mesoscopic community structure, improve the quality of node representation, and improve the accuracy of link prediction tasks.
Smart Images

Figure CN119337858A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network representation learning, and in particular to a network representation learning method based on community subgraph. Background Art
[0002] In the era of informatization and the Internet, network structure data can be naturally used to represent the relationship between different objects, and various network structures are very common in our daily lives. Network representation learning technology aims to learn the mapping from each node in the network to the low-dimensional space vector representation. It effectively solves the problem of inputting graph data into machine learning algorithms, and uses advanced machine learning algorithms and deep learning techniques to optimize the representation vector, so that this implicit representation vector is often of higher quality, so as to efficiently perform network analysis tasks on these large-scale networks, such as node classification, clustering, link prediction, etc. A basic requirement of network representation learning is that the representation of nodes should retain the structure of the graph and its inherent properties. At present, the existing network representation learning methods only retain the microstructure of the network, that is, the proximity of nodes to nodes in the field, and lack the constraints of community structure. However, community structure plays a vital role in both the generation and evolution of the network, and it imposes constraints on node representation at a higher structural level. For example, for two nodes in a community, even if their relationship in microstructure is weak due to data sparsity, their similarity will be strengthened by the constraints of community structure. Therefore, in order to simultaneously preserve the microstructure and mesoscopic community structure of the network, the present invention proposes a network representation learning method based on community subgraphs. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a network representation learning method based on community subgraphs, which can simultaneously retain microstructures and mesoscopic community structures, thereby improving the quality of node representation.
[0004] The technical solution adopted by the present invention is a network representation learning method based on community subgraph, which comprises the following steps:
[0005] S1. Read the input network and obtain the node set and edge set of the input network;
[0006] S2. Use the non-overlapping community detection algorithm Louvain to identify the optimal community structure in the input network and obtain the set of community nodes contained in each community in the optimal community structure;
[0007] S3, calculating the bridge nodes of each community in the optimal community structure, and merging the bridge nodes into the community node set of the corresponding community to form a new community node set;
[0008] S4. Based on the new community node set obtained in step S3, a mapping dictionary is established from the input network nodes to the community nodes in the new community node set, a community subgraph node set is obtained, and an edge set of the community subgraph is established with reference to the connection structure of the input network, and finally a community subgraph is generated;
[0009] S5, inputting the input network into the DeepWalk model, allowing the DeepWalk model to learn the representation vector of the input network node, and the learned DeepWalk model outputs the representation vector of the input network node;
[0010] S6. Use the representation vector of the input network node output by the DeepWalk model in step S5 to initialize the representation vector of the community subgraph node in the community subgraph obtained in step S4. After initialization, use the DeepWalk model again to learn the representation vector of the community subgraph node in the community subgraph.
[0011] The beneficial effect of the present invention is that the above-mentioned community subgraph-based network representation learning method is adopted, which supplements the community structure information and can simultaneously retain the microstructure and mesoscopic community structure, thereby improving the quality of node representation and improving the accuracy of subsequent link prediction tasks.
[0012] Preferably, in step S1, the input network is an unweighted undirected graph network G={V,E}, wherein V represents a node set of the input network, and E represents an edge set of the input network.
[0013] Preferably, in step S2, the specific process of using the non-overlapping community detection algorithm Louvain to identify the optimal community structure in the input network and obtaining the set of community nodes contained in each community in the optimal community structure includes the following steps:
[0014] S2.1. Consider each node in the input network as a community. The community structure C1 of the input network is expressed as: C1 = {C1,…C N}, where C i represents the i-th community, i = 1, 2, 3...N, C i is a non-empty set of nodes, and Calculate the modularity Q of the community structure C1 of the input network, expressed as: Where k represents the number of communities, l i Represents community C i The number of internal edges of Vol(C i ) represents community C i The sum of the degrees of all community nodes in;
[0015] S2.2. According to the Louvain algorithm, all nodes in the input network are traversed. For each node, the modularity gain after the node is divided into the community where its neighbors are located is calculated, the maximum modularity gain corresponding to the node is found, and the node is divided into the community corresponding to the maximum modularity gain, so as to obtain the optimal community structure C2 = {C1,…,C K}, where C y represents the yth community, y = 1, 2, 3...K, thereby obtaining the set of community nodes contained in each community in the optimal community structure.
[0016] Preferably, in step S3, the bridge nodes of the community are specifically defined as: for the optimal community structure C2 = {C1, ..., C K}, there exists a community node a, a∈C y , there is a neighbor node b of community node a; if Then b is called C y The bridge node.
[0017] Preferably, the specific process of step S4 includes the following steps:
[0018] S4.1. Based on the new community node set obtained in step S3, a mapping dictionary is established from the input network node to the community node in the new community node set. The mapping dictionary is: {u:[u1,…u i ],…,v:[v1,…,v j ]}, where u and v both represent input network nodes, u i and v j Represents a community node in a new community node set;
[0019] S4.2. The node set of the community subgraph obtained from step S4.1 is V C = {u1,…u i ,…,v1,…v j}, according to the connection structure of the input network, if u i ∈C y ,v j ∈C y ,(u,v)∈E, then add the edge (u i ,v j ) to the edge set E of the community subgraph C , get the community subgraph G C = {V C ,E C}, where E is the edge set of the input network.
[0020] Preferably, the specific process of step S5 includes the following steps:
[0021] S5.1. Starting from each node v in the input network G, a random walk is performed to obtain the walk sequence set S = {s1,…,s n};
[0022] S5.2. Randomly initialize the representation vectors of the nodes in the input network G, build a skip-gram model, and use the sequence set S as the corpus of the skip-gram model to maximize the log-likelihood probability of the sequence set S, thereby updating the representation vectors of the nodes in the input network. The log-likelihood probability of the sequence set S is expressed as: Among them, c is the center word, w is the context of c in a given window size interval, and z x A representation vector representing node x.
[0023] Preferably, the specific process of step S6 includes the following steps:
[0024] S6.1. Community subgraph G C Each node v in is taken as the starting point, and a random walk is performed to obtain the walk sequence set S C ={e1,…,e n};
[0025] S6.2. Initialize the community subgraph G according to the mapping dictionary from the input network nodes to the community nodes in the new community node set. C The representation vector of the midpoint;
[0026] S6.3 builds the skip-gram model and transforms the sequence set S C As the corpus of the skip-gram model, the sequence set S C The log-likelihood probability of is maximized to output the representation vector of the new input network node. The log-likelihood probability of the sequence set S is expressed as: Among them, c is the center word, w is the context of c in a given window size interval, and z x A representation vector representing node x. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A flowchart of a network representation learning method based on a community subgraph of the present invention;
[0028] Figure 2 Schematic diagram of the mapping relationship between input network nodes and community subgraph nodes in the present invention. DETAILED DESCRIPTION
[0029] The invention will be further described below with reference to the accompanying drawings and in combination with specific implementations, so that those skilled in the art can implement the invention with reference to the description. The protection scope of the invention is not limited to the specific implementations.
[0030] The present invention relates to a network representation learning method based on community subgraph, which comprises the following steps:
[0031] S1. Reading an input network to obtain a node set and an edge set of the input network, wherein the node set of the input network includes a plurality of input network nodes;
[0032] S2. Using the non-overlapping community detection algorithm Louvain to identify the optimal community structure in the input network, and obtain the community node set contained in each community in the optimal community structure; the community node set includes a number of community nodes;
[0033] S3, calculating the bridge nodes of each community in the optimal community structure, and merging the bridge nodes into the community node set of the corresponding community to form a new community node set;
[0034] S4. Based on the new community node set obtained in step S3, a mapping dictionary is established from the input network nodes to the community nodes in the new community node set, a community subgraph node set is obtained, and an edge set of the community subgraph is established with reference to the connection structure of the input network, and finally a community subgraph is generated; the community subgraph node set includes a plurality of community subgraph nodes;
[0035] S5, inputting the input network into the DeepWalk model, allowing the DeepWalk model to learn the representation vector of the input network node, and the learned DeepWalk model outputs the representation vector of the input network node;
[0036] S6. Use the representation vector of the input network node output by the DeepWalk model in step S5 to initialize the representation vector of the community subgraph node in the community subgraph obtained in step S4. After initialization, use the DeepWalk model again to learn the representation vector of the community subgraph node in the community subgraph.
[0037] The above-mentioned community subgraph-based network representation learning method is adopted, which supplements the community structure information and can simultaneously retain the microstructure and mesoscopic community structure, thereby improving the quality of node representation and improving the accuracy of subsequent link prediction tasks.
[0038] In step S1, the input network is an unweighted undirected graph network G={V,E}, where V represents the node set of the input network and E represents the edge set of the input network.
[0039] Preferably, in step S2, the specific process of using the non-overlapping community detection algorithm Louvain to identify the optimal community structure in the input network and obtaining the set of community nodes contained in each community in the optimal community structure includes the following steps:
[0040] S2.1. Consider each node in the input network as a community. The community structure C1 of the input network is expressed as: C1 = {C1,…C N}, where C i represents the i-th community, i = 1, 2, 3...N, C i is a non-empty set of nodes, and Calculate the modularity Q of the community structure C1 of the input network, expressed as: Where k represents the number of communities, l i Represents community C i The number of internal edges of Vol(C i ) represents community C i The sum of the degrees of all community nodes in;
[0041] S2.2. According to the Louvain algorithm, all nodes in the input network are traversed. For each node, the modularity gain after the node is divided into the community where its neighbors are located is calculated, the maximum modularity gain corresponding to the node is found, and the node is divided into the community corresponding to the maximum modularity gain, so as to obtain the optimal community structure C2 = {C1,…,C K}, where C y represents the yth community, y = 1, 2, 3...K, thereby obtaining the set of community nodes contained in each community in the optimal community structure.
[0042] Preferably, in step S3, the bridge nodes of the community are specifically defined as: for the optimal community structure C2 = {C1, ..., C K}, there exists a community node a, a∈C y , there is a neighbor node b of community node a; if Then b is called C y The bridge node.
[0043] The specific process of step S4 includes the following steps:
[0044] S4.1. Based on the new community node set obtained in step S3, a mapping dictionary is established from the input network node to the community node in the new community node set. The mapping dictionary is: {u:[u1,…u i ],…,v:[v1,…,v j ]}, where u and v both represent input network nodes, u i and v j Represents a community node in a new community node set;
[0045] S4.2. The node set of the community subgraph obtained from step S4.1 is V C = {u1,…u i,…,v1,…v j}, according to the connection structure of the input network, if u i ∈C y ,v j ∈C y ,(u,v)∈E, then add the edge (u i ,v j ) to the edge set E of the community subgraph C , get the community subgraph G C = {V C ,E C}, where E is the edge set of the input network.
[0046] The specific process of step S5 includes the following steps:
[0047] S5.1. Starting from each node v in the input network G, a random walk is performed to obtain the walk sequence set S = {s1,…,s n}; thus, the disordered nodes in the network (i.e., the node set V) are converted into an ordered node sequence, and the ordered node sequence is s = {v t ,v t+1 ,...,v k};
[0048] S5.2. Randomly initialize the representation vectors of the nodes in the input network G, build a skip-gram model, and use the sequence set S as the corpus of the skip-gram model to maximize the log-likelihood probability of the sequence set S, thereby updating the representation vectors of the nodes in the input network. The log-likelihood probability of the sequence set S is expressed as: Among them, c is the center word, w is the context of c in a given window size interval, and z x A representation vector representing node x.
[0049] The specific process of step S6 includes the following steps:
[0050] S6.1. Community subgraph G C Each node v in is taken as the starting point, and a random walk is performed to obtain the walk sequence set S C ={e1,…,e n};
[0051] S6.2. Initialize the community subgraph G according to the mapping dictionary from the input network nodes to the community nodes in the new community node set. C The representation vector of the node in the input graph, for example, the node u corresponds to the node [u1,u2] in the community subgraph, then
[0052] S6.3 builds the skip-gram model and transforms the sequence set S C As the corpus of the skip-gram model, the sequence set S C The log-likelihood probability of is maximized to output the representation vector of the new input network node. The log-likelihood probability of the sequence set S is expressed as: Among them, c is the center word, w is the context of c in a given window size interval, and z x A representation vector representing node x.
[0053] The following is a public real data set to verify the effectiveness of the community subgraph-based network representation learning method proposed in the present invention.
[0054] Dataset 1: PPI, PPI is a network of protein-protein interactions disclosed by Homo sapiens, involving 3852 proteins as nodes in the network; 20881 edges, representing the physical interactions between proteins; PPI is used as the input network to implement a network representation learning method based on community subgraph proposed in the present invention, and the existing Node2vec method, Asymmetric method, M-NMF method and Splitter method are used to conduct experiments on the PPI network respectively, and the scores of the evaluation index AUC under each method are obtained, and the comparison table is shown in Table 1;
[0055] Dataset 2: ca-HepTh, ca-HepTh is a high-energy physics academic paper collaboration network from arXiv published by Leskovec et al., involving 9877 authors as nodes in the network; 25998 edges, representing whether two authors have co-authored papers; ca-HepTh is used as the input network to implement the community subgraph-based network representation learning method proposed in the present invention, and the existing Node2vec method, Asymmetric method, M-NMF method and Splitter method are used to conduct experiments on the ca-HepTh network respectively, and the scores of the evaluation index AUC under each method are obtained, and the comparison table is shown in Table 1;
[0056] Dataset 3: ca-AstroPh, ca-AstroPh is also an astrophysics academic paper collaboration network from arXiv published by Leskovec et al., involving 17,903 authors as nodes in the network; 197,031 edges, representing whether two authors have co-authored papers; ca-AstroPh is used as the input network to implement the community subgraph-based network representation learning method proposed in the present invention, and the existing Node2vec method, Asymmetric method, M-NMF method and Splitter method are used to conduct experiments on the ca-AstroPh network, and the scores of the evaluation index AUC under each method are obtained, and the comparison table is shown in Table 1;
[0057] It can be seen from Table 1 that the evaluation index AUC score obtained by using the community subgraph-based network representation learning method proposed in the present invention is the highest, that is, the performance of the community subgraph-based network representation learning method proposed in the present invention is the best, and this method is significantly better than all baseline methods of most evaluation indicators.
[0058] Table 1 Score table of the evaluation index AUC obtained by the method of the present invention and the existing method
[0059]
[0060]
Claims
1. A network representation learning method based on community subgraph, characterized by: The method comprises the following steps: S1. Read the input network and obtain the node set and edge set of the input network; S2. Use the non-overlapping community detection algorithm Louvain to identify the optimal community structure in the input network and obtain the set of community nodes contained in each community in the optimal community structure; S3, calculating the bridge nodes of each community in the optimal community structure, and merging the bridge nodes into the community node set of the corresponding community to form a new community node set; S4. Based on the new community node set obtained in step S3, a mapping dictionary is established from the input network nodes to the community nodes in the new community node set, a community subgraph node set is obtained, and an edge set of the community subgraph is established with reference to the connection structure of the input network, and finally a community subgraph is generated; S5, inputting the input network into the DeepWalk model, allowing the DeepWalk model to learn the representation vector of the input network node, and the learned DeepWalk model outputs the representation vector of the input network node; S6. Use the representation vector of the input network node output by the DeepWalk model in step S5 to initialize the representation vector of the community subgraph node in the community subgraph obtained in step S4. After initialization, use the DeepWalk model again to learn the representation vector of the community subgraph node in the community subgraph.
2. According to claim 1, a network representation learning method based on community subgraph is characterized in that: In step S1, the input network is an unweighted undirected graph network G={V,E}, where V represents the node set of the input network and E represents the edge set of the input network.
3. A community subgraph-based network representation learning method according to claim 2, characterized in that: In step S2, the non-overlapping community detection algorithm Louvain is used to identify the optimal community structure in the input network, and the specific process of obtaining the set of community nodes contained in each community in the optimal community structure includes the following steps: S2.
1. Consider each node in the input network as a community. The community structure C1 of the input network is expressed as: C1 = {C1,…C N }, where C i represents the i-th community, i = 1, 2, 3...N, C i is a non-empty set of nodes, and Calculate the modularity Q of the community structure C1 of the input network, expressed as: Where k represents the number of communities, l i Represents community C i The number of internal edges of Vol(C i ) represents community C i The sum of the degrees of all community nodes in; S2.
2. According to the Louvain algorithm, all nodes in the input network are traversed. For each node, the modularity gain after the node is divided into the community where its neighbors are located is calculated, the maximum modularity gain corresponding to the node is found, and the node is divided into the community corresponding to the maximum modularity gain, so as to obtain the optimal community structure C2 = {C1,…,C K }, where C y represents the yth community, y = 1, 2, 3...K, thereby obtaining the set of community nodes contained in each community in the optimal community structure.
4. The network representation learning method based on community subgraph according to claim 3 is characterized by: In step S3, the bridge node of the community is specifically defined as: for the optimal community structure C2 = {C1, ..., C K }, there exists a community node a, a∈C y , there is a neighbor node b of community node a; if Then b is called C y The bridge node.
5. The network representation learning method based on community subgraph according to claim 4 is characterized in that: The specific process of step S4 includes the following steps: S4.
1. Based on the new community node set obtained in step S3, a mapping dictionary is established from the input network node to the community node in the new community node set. The mapping dictionary is: {u:[u1,…u i ],…,v:]v1,…,v j ]}, where u and v both represent input network nodes, u i and v j Represents a community node in a new community node set; S4.
2. The node set of the community subgraph obtained from step S4.1 is V C ={u1,…u i ,…,v1,…v j }, according to the connection structure of the input network, if u i ∈C y ,v j ∈C y ,(u,v)∈E, then add the edge (u i ,v j ) to the edge set E of the community subgraph C , get the community subgraph G C = {V C ,E C }, where E is the edge set of the input network.
6. A community subgraph-based network representation learning method according to claim 5, characterized in that: The specific process of step S5 includes the following steps: S5.
1. Starting from each node v in the input network G, a random walk is performed to obtain the walk sequence set S = {s1,…,s n }; S5.
2. Randomly initialize the representation vectors of the nodes in the input network G, build a skip-gram model, and use the sequence set S as the corpus of the skip-gram model to maximize the log-likelihood probability of the sequence set S, thereby updating the representation vectors of the nodes in the input network. The log-likelihood probability of the sequence set S is expressed as: Among them, c is the center word, w is the context of c in a given window size interval, and z x A representation vector representing node x.
7. The network representation learning method based on community subgraph according to claim 6 is characterized in that: The specific process of step S6 includes the following steps: S6.
1. Community subgraph G C Each node v in is taken as the starting point, and a random walk is performed to obtain the walk sequence set S C ={e1,…,e n }; S6.
2. Initialize the community subgraph G according to the mapping dictionary from the input network nodes to the community nodes in the new community node set. C The representation vector of the midpoint; S6.3 builds the skip-gram model and transforms the sequence set S C As the corpus of the skip-gram model, the sequence set S C The log-likelihood probability of is maximized to output the representation vector of the new input network node. The log-likelihood probability of the sequence set S is expressed as: Among them, c is the center word, w is the context of c in a given window size interval, and z x A representation vector representing node x.