Attribute network embedding and community discovery method based on heterogeneous graph random walk

By calculating the importance of nodes in the heterogeneous graph and constructing the transition probability matrix of the weighted graph, combined with the skip-gram model and k-means clustering, the flexibility of the traditional walking method in weighing topology and attribute information in heterogeneous networks is solved. It solves the problem of insufficient data and achieves high-quality node representation and community discovery.

CN118733984APending Publication Date: 2024-10-01HARBIN UNIV OF SCI & TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410641502.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-22
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Traditional walk methods cannot effectively handle different types of nodes and edges in heterogeneous networks, are not flexible enough when weighing network topology and attribute information, and are difficult to construct high-quality random walk sequences, resulting in limited applications in heterogeneous networks.

Method used

By calculating the importance of structural nodes and attribute nodes, constructing the transition probability matrix of the weighted graph, performing a random walk, combining the skip-gram model to learn the low-dimensional vector representation of the nodes, and using the k-means clustering algorithm to achieve community division, ensuring Balanced consideration of structural and attribute information.

Benefits of technology

It improves the quality of node representation and the accuracy of community discovery in heterogeneous networks, can better handle the diversity and complexity in heterogeneous networks, and significantly improves the effect of community discovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733984A_ABST
    Figure CN118733984A_ABST
Patent Text Reader

Abstract

The invention discloses a random walk attribute network embedding and community discovery method based on a heterogeneous graph. The method comprises the following steps: firstly, calculating the influence of a structure node by combining the structure importance and attribute importance of the structure node in the heterogeneous graph and the attribute importance of an attribute node in the heterogeneous graph; secondly, constructing a weighted graph of the heterogeneous graph and a transition probability matrix of the weighted graph; then, a weighted graph random walk sequence is constructed, during walk, attribute nodes serve as intermediary nodes to achieve walk between connectionless nodes, low-influence nodes serve as bridging nodes to achieve walk crossing, and redundant information in the walk sequence is reduced; and finally, training the walk sequence by using a skip-gram model, learning the low-dimensional vector representation of each node, and clustering the low-dimensional vectors of the nodes according to a k-means clustering algorithm to realize community division.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of attribute community discovery, and in particular relates to an attribute network embedding and community discovery method based on random walk of heterogeneous graphs. Background Art

[0002] Community discovery is a core task in network analysis, which aims to discover subsets of nodes that are closely connected and compact in structure in the network. These subsets are usually considered to be related to each other, have similar functions, or participate in a task together. With the widespread application of various heterogeneous networks such as social networks, biological networks, and recommendation systems, network embedding has become a hot topic of research, especially the embedding of attribute networks. Attribute networks not only contain topological relationships between nodes, but also contain rich attribute information. Network embedding aims to map nodes in the network into a low-dimensional, dense, real-valued vector space to facilitate more effective network analysis and mining in the new vector space.

[0003] In early research, some classic network embedding methods are mainly based on eigendecomposition and matrix decomposition. The eigendecomposition method focuses on finding the eigenvalues ​​and eigenvectors of the matrix to describe the location of the nodes, while the matrix decomposition method attempts to decompose the network adjacency matrix. They mainly map the nodes to a low-dimensional space by calculating the eigenvectors of the network's relationship matrix. These methods can effectively reduce the dimensionality of network data, but usually fail to fully explore the local and global characteristics of the network, and do not make comprehensive use of topological and attribute information.

[0004] In recent years, random walk strategies and deep learning models have been introduced into network embedding, bringing significant progress. For example, inspired by Word2Vec in natural language processing, the DeepWalk algorithm maps nodes to a low-dimensional space by truncating random walks. For another example, the Node2Vec algorithm introduces two hyperparameters, p and q, to ​​control the random walk strategy to better capture the network structure. However, these methods mainly focus on the topological structure of the network and ignore the attribute information of the nodes. Recent studies have begun to incorporate the attribute information of nodes into network embedding to obtain a more comprehensive node representation. Some methods, such as TirDN, TADW, and GAT2VEC, comprehensively consider the structural information and attribute information of the network, thereby improving the effect of network embedding.

[0005] The problem with the above methods when generating attribute communities is that the random walk-based network embedding method is not flexible enough when weighing network topology and attribute information. It is difficult to build links for structural nodes without direct connections, and node selection is often arbitrary, lacking clear goals and guidance. At the same time, if the walk sequence is too short, it is easy to lose information about remote nodes, and if it is too long, it may lead to information redundancy and increase the risk of overfitting. It is unable to cover the diversity and complexity of the network, and it is difficult to handle different types of nodes and edges in heterogeneous networks, so its application in heterogeneous networks is limited. Summary of the invention

[0006] The present invention provides an attribute network embedding and community discovery method based on random walks in heterogeneous graphs. The technical problem solved is that traditional walk methods cannot handle different types of nodes and edges in heterogeneous networks, are not flexible enough when weighing network topology and attribute information, and cannot construct high-quality random walk sequences.

[0007] The technical solution of the present invention is: an attribute network embedding and community discovery method based on random walk of heterogeneous graphs, and the specific steps are as follows:

[0008] Step 1: Calculate the influence of the structural nodes by combining the structural importance and attribute importance of the structural nodes in the heterogeneous graph and the attribute importance of the attribute nodes in the heterogeneous graph;

[0009] Step 2: Construct a weighted graph representation of the heterogeneous graph according to step 1;

[0010] Step 3: Construct the transition probability matrix of the weighted graph;

[0011] Step 4: Perform random walks on the weighted graph representation and construct random walk sequences;

[0012] Step 5: Based on the walk sequence in step 4, use the skip-gram model to train the walk sequence and learn the low-dimensional vector representation of each node;

[0013] Step 6: According to the k-means clustering algorithm, cluster the low-dimensional vectors of the nodes to achieve community division.

[0014] Furthermore, the attribute importance (AIAN) of the attribute node in step 1 is determined by the frequency of occurrence of the attribute node in the global scope, and is calculated as follows:

[0015]

[0016] Among them, δ(condition) is an indicative function, which takes the value of 1 when the condition is true and takes the value of 0 when the condition is false. A represents the attribute matrix of the heterogeneous graph;

[0017] The attribute importance of structure node (AISN) is determined by the sum of the attribute importance of the attribute nodes contained in the structure node, and is calculated as follows:

[0018]

[0019] Among them, A represents the weighted matrix of attribute importance, and the weight in the matrix is ​​the attribute importance of the attribute node associated with the structure node;

[0020] The structure importance of structure nodes (SISN) is calculated by Jaccard similarity. The Jaccard similarity calculation method of two nodes u and v in the heterogeneous graph is as follows:

[0021]

[0022] Among them, N(u), N(v) represent the set of neighbor nodes of structural nodes u and v, |N(u)∩N(v)| represents the number of common neighbors of nodes u and v, and |N(u)∪N(v)| represents the total number of neighbor nodes of nodes u and v;

[0023] The structural importance function of the structural node is calculated as follows:

[0024]

[0025] Among them, D(u) and D(v) represent the node degrees of nodes u and v respectively, and 1-Jaccard(u,v) represents the distance between two nodes. The farther the distance, the less important the structural node u is to v.

[0026] The influence of structure nodes (ISN) is calculated by the structure importance and attribute importance, and the weight is adjusted according to the number of structure nodes and attribute nodes in the neighboring nodes. The specific calculation method is:

[0027]

[0028] Where D(sn i ) and D(an i) represent the number of neighboring structural nodes and attribute nodes of the ith node respectively; the introduction of these two weight factors can balance the structural importance and attribute importance, ensuring that both are properly considered in the final importance evaluation; the greater the influence of the structural node, the richer information the node contains in the graph, and the smaller the influence of the structural node, the more likely the node is to become a bridge node in the community.

[0029] Furthermore, the weighted graph of the heterogeneous graph in step 2 comprises:

[0030] Step 2.1: Determine the node types in the weighted graph, namely attribute nodes and structure nodes;

[0031] Step 2.2: Determine the link mode of the attribute node. The attribute node is connected to the structure node, representing the attribute information of the structure node;

[0032] Step 2.3: Determine the link mode of the structure node. The structure node can be connected to the attribute node or to other structure nodes. The connection with the structure node is used to represent the topological relationship in the network.

[0033] Step 2.4: Determine the weight of the node, where the weight of the structural node is composed of the influence of the structural node, the structural importance of the structural node, and the attribute importance of the structural node, and the weight of the attribute node is composed of the attribute importance of the attribute node.

[0034] Furthermore, the process of constructing the transition probability matrix of the weighted graph in step 3 includes:

[0035] Assume that the current structure node is v and its neighbor structure node set is N str (v), the set of neighbor attribute nodes is N attr (v), u is a transfer target in the neighbor node set of the current node v;

[0036] Step 3.1: Probability calculation process when a structure node transfers to a neighboring structure node;

[0037] First, we select nodes whose influence is greater than or equal to the threshold β; we define the indicator function Indicator(u) to indicate whether this condition is met. The calculation method of Indicator(u) is:

[0038]

[0039] In order to prevent some values ​​from being much larger than other values ​​in extreme cases, a decay function f(x) is defined, which is calculated as:

[0040]

[0041] Where α is a positive adjustment parameter used to control the decay rate; combined with the structure node influence and the indicator function, the probability of a structure node with an influence greater than or equal to the threshold β transferring to a neighboring structure node is Defined as:

[0042]

[0043] If there is no node whose influence is greater than or equal to the threshold β, then the influence value As the selection probability, the selected node is not added to the walk sequence. The calculation method is:

[0044]

[0045] Taking the above two situations into consideration, the probability of selecting the structural route of the structural node is:

[0046]

[0047] Step 3.2: Probability calculation process when the structure node transfers to the neighbor attribute node;

[0048] The probability p of a structure node transferring to a neighboring attribute node attr (u|v) is calculated by the attribute importance value of the attribute node, p attr The definition of (u|v) is:

[0049]

[0050] Step 3.3: Combining steps 3.1 and 3.2, the probability that a structural node selects different types of neighbor nodes for random walk is:

[0051]

[0052] Among them, N str (v) and N attr (v) are the neighbor structure node set and neighbor attribute node set of node v respectively;

[0053] Step 3.4: Probability calculation process when attribute node transfers to neighbor structure node;

[0054] Let the current attribute node be w and its neighbor structure node set be N str (w), u is a transfer target of the neighbor node set of the current node w; in order to solve the problem that nodes with less attribute importance have less attribute importance gain on neighbor structure nodes, which makes such neighbor structure nodes difficult to be selected during random walk; define the enhancement function g(AISN,α) to adjust the selection probability according to the attribute importance of the structure node, and the calculation method of g(AISN,α) is:

[0055]

[0056] AISN represents the attribute importance of the structural node, the adjustment parameter α≥1, and ε is a small positive number, generally set to 10 -6 , used to prevent the situation when AISN is close to 0;

[0057] For nodes whose structural node influence is greater than or equal to the threshold β, the selection probability is calculated by combining the influence value and the indicator function. At this time, the emphasis is on the strong connection between the structure node and the current attribute node. The calculation method is:

[0058]

[0059] If there is no node whose structural node influence is greater than or equal to the threshold β, then the influence value As the selection probability, the selected node is not added to the walk sequence. The calculation method is:

[0060]

[0061] Taking the above two situations into consideration, the route selection probability of attribute node w is:

[0062]

[0063] Furthermore, the key to step 3.4 is to select structural nodes with smaller attribute importance from the structural nodes whose influence values ​​are greater than the threshold β and add them to the walking sequence to ensure that the attribute information represented by the current attribute node accounts for a high proportion in the selected structural nodes; when the node type is an attribute node, when selecting the next structural node, a strong connection relationship is established between the current attribute node and the selected structural node, highlighting the importance of the attribute information represented by the current attribute node in the overall structural node attribute information.

[0064] Furthermore, the random walk sequence construction process in step 4 includes:

[0065] Step 4.1: Randomly select a node from the heterogeneous weighted graph and determine whether the current node type is a structure node or an attribute node;

[0066] Step 4.2: Determine whether the current node has neighbor nodes (including neighbor attribute nodes and neighbor structure nodes). If yes, execute step 4.3; if not, stop walking, return a walking sequence and go back to step 4.1 until all nodes have been walked;

[0067] Step 4.3: According to the judgment result of step 4.1, if the current node is an attribute node and has neighbor nodes, select a qualified structure node from the neighbor node set and add it to the walking sequence;

[0068] The specific operation is as follows: calculate the influence values ​​of all neighboring structural nodes of the attribute node, and determine whether there is a node with an influence value greater than the threshold β; if not, use the influence value as the weight, select the node with a larger influence value as the wandering node, and then return to step 4.2; if yes, select a structural node with a smaller attribute importance from these structural nodes with an influence value greater than β and add it to the wandering sequence, and use this node as the wandering node;

[0069] Step 4.4: According to the judgment result of step 4.1, if the current node is a structure node and has neighbor nodes (including structure nodes and attribute nodes), there are two route options;

[0070] The specific operation is as follows: if a structural node is selected, the influence values ​​of all neighboring nodes of the structural node are calculated. If there is a node with an influence greater than the threshold value β, a structural node with a greater influence is selected from these structural nodes with an influence value greater than β to be added to the walking sequence, and the node is used as the walking node; if there is no node with an influence greater than the threshold value β, the influence value is used as the weight, and the node with a greater influence value is selected as the walking node, and then return to step 4.2; if an attribute node is selected, the node with a greater attribute importance among the neighboring attribute nodes is selected to act as the walking intermediary, and the node is used as the walking node.

[0071] Step 4.5: Determine whether the current walking sequence meets the sequence length ds (ds is generally 40). If it does not meet the length requirement, continue walking and return to step 4.2; if it meets the requirement, return to step 4.1 until all nodes have been walked.

[0072] Furthermore, the step of training the walk sequence using the skip-gram model in step 5 to learn the low-dimensional vector representation of each node includes:

[0073] Step 5.1: Model structure design; the model consists of three layers: input layer, hidden layer and output layer; the output layer uses the Softmax function to convert the output of the model into a probability representation; the definition of the Softmax function is:

[0074]

[0075] Among them, V is the set of network nodes, score(w i ,w j ) is the central node w iand the next node w in the sequence j The vector inner product between ;

[0076] Step 5.2: Define the loss function. For the training sample (w i ,w j ), the objective loss function is defined as:

[0077]

[0078] Among them, δ is the Sigmoid function, is the kth node in the negative example node set. The negative example node set is generally the number of nodes except w i and w j Other nodes outside; the Sigmoid function is defined as follows:

[0079]

[0080] Furthermore, in step 6, the low-dimensional vectors of the nodes are clustered according to the k-means clustering algorithm to achieve community division, and the steps include:

[0081] Step 6.1: Set the number of clusters k. The value of k is determined according to the average node degree of the real network;

[0082] Step 6.2: Randomly select k nodes as the initial center points;

[0083] Step 6.3: Calculate the distance between all nodes and the center point, and add each center point according to the principle of minimum distance to form a cluster.

[0084] Step 6.4: Every time a new cluster is formed, the center point is updated according to the following formula;

[0085]

[0086] Where X i is the i-th cluster in the network, μ i Is cluster X i The center point of the cluster, x is the other nodes in the cluster except the center point;

[0087] Step 6.5: Repeat steps 6.3 and 6.4 until all nodes are clustered and the algorithm stops, outputting the community structure. BRIEF DESCRIPTION OF THE DRAWINGS

[0088] Attached Figure 1 The algorithm flow chart of the present invention is

[0089] Attached Figure 2 A heterogeneous graph example for a social network

[0090] Attached Figure 3 Visualization effect diagram for the Cora dataset

[0091] Attached Figure 4 Visualization effect diagram of Citesser dataset DETAILED DESCRIPTION

[0092] The following will be combined with the accompanying drawings in the embodiments of the present invention to provide a detailed and complete description of the technical solution of the present invention. Obviously, the embodiments are only a part of the present invention, not all of it. All other embodiments that can be obtained based on the embodiments of the present invention by ordinary technicians in the field without creative work are also subject to the protection scope of the present invention.

[0093] Embodiment 1:

[0094] A method for attribute network embedding and community discovery based on random walks in heterogeneous graphs. The specific steps are as follows:

[0095] Step 1: Calculate the influence of the structural nodes by combining the structural importance and attribute importance of the structural nodes in the heterogeneous graph and the attribute importance of the attribute nodes in the heterogeneous graph;

[0096] Step 2: Construct a weighted graph representation of the heterogeneous graph according to step 1;

[0097] Step 3: Construct the transition probability matrix of the weighted graph;

[0098] Step 4: Perform random walks on the weighted graph representation and construct random walk sequences;

[0099] Step 5: Based on the walk sequence in step 4, use the skip-gram model to train the walk sequence and learn the low-dimensional vector representation of each node;

[0100] Step 6: According to the k-means clustering algorithm, cluster the low-dimensional vectors of the nodes to achieve community division.

[0101] Furthermore, the attribute importance (AIAN) of the attribute node in step 1 is determined by the frequency of occurrence of the attribute node in the global scope, and is calculated as follows:

[0102]

[0103] Among them, δ(condition) is an indicative function, which takes the value of 1 when the condition is true and takes the value of 0 when the condition is false. A represents the attribute matrix of the heterogeneous graph;

[0104] The attribute importance of structure node (AISN) is determined by the sum of the attribute importance of the attribute nodes contained in the structure node, and is calculated as follows:

[0105]

[0106] in, A weighted matrix representing the importance of attributes. The weights in the matrix are the importance of the attributes of the attribute nodes associated with the structure nodes.

[0107] The structure importance of structure nodes (SISN) is calculated by Jaccard similarity. The Jaccard similarity calculation method of two nodes u and v in the heterogeneous graph is as follows:

[0108]

[0109] Among them, N(u), N(v) represent the set of neighbor nodes of structural nodes u and v, |N(u)∩N(v)| represents the number of common neighbors of nodes u and v, and |N(u)∪N(v)| represents the total number of neighbor nodes of nodes u and v;

[0110] The structural importance function of the structural node is calculated as follows:

[0111]

[0112] Among them, D(u) and D(v) represent the node degrees of nodes u and v respectively, and 1-Jaccard(u,v) represents the distance between two nodes. The farther the distance, the less important the structural node u is to v.

[0113] The influence of structure nodes (ISN) is calculated by the structure importance and attribute importance, and the weight is adjusted according to the number of structure nodes and attribute nodes in the neighboring nodes. The specific calculation method is:

[0114]

[0115] Where D(sn i ) and D(an i) represent the number of neighboring structural nodes and attribute nodes of the ith node respectively; the introduction of these two weight factors can balance the structural importance and attribute importance, ensuring that both are properly considered in the final importance evaluation; the greater the influence of the structural node, the richer information the node contains in the graph, and the smaller the influence of the structural node, the more likely the node is to become a bridge node in the community.

[0116] Furthermore, the weighted graph of the heterogeneous graph in step 2 comprises:

[0117] Step 2.1: Determine the node types in the weighted graph, namely attribute nodes and structure nodes;

[0118] Step 2.2: Determine the link mode of the attribute node. The attribute node is connected to the structure node, representing the attribute information of the structure node;

[0119] Step 2.3: Determine the link mode of the structure node. The structure node can be connected to the attribute node or to other structure nodes. The connection with the structure node is used to represent the topological relationship in the network.

[0120] Step 2.4: Determine the weight of the node, where the weight of the structural node is composed of the influence of the structural node, the structural importance of the structural node, and the attribute importance of the structural node, and the weight of the attribute node is composed of the attribute importance of the attribute node.

[0121] Furthermore, the process of constructing the transition probability matrix of the weighted graph in step 3 includes:

[0122] Assume that the current structure node is v and its neighbor structure node set is N str (v), the set of neighbor attribute nodes is N attr (v), u is a transfer target in the neighbor node set of the current node v;

[0123] Step 3.1: Probability calculation process when a structure node transfers to a neighboring structure node;

[0124] First, we select nodes whose influence is greater than or equal to the threshold β; we define the indicator function Indicator(u) to indicate whether this condition is met. The calculation method of Indicator(u) is:

[0125]

[0126] In order to prevent some values ​​from being much larger than other values ​​in extreme cases, a decay function f(x) is defined, which is calculated as:

[0127]

[0128] Where α is a positive adjustment parameter used to control the decay rate; combined with the structure node influence and the indicator function, the probability of a structure node with an influence greater than or equal to the threshold β transferring to a neighboring structure node is Defined as:

[0129]

[0130] If there is no node whose influence is greater than or equal to the threshold β, then the influence value As the selection probability, the selected node is not added to the walk sequence. The calculation method is:

[0131]

[0132] Taking the above two situations into consideration, the probability of selecting the structural route of the structural node is:

[0133]

[0134] Step 3.2: Probability calculation process when the structure node transfers to the neighbor attribute node;

[0135] The probability p of a structure node transferring to a neighboring attribute node attr (u|v) is calculated by the attribute importance value of the attribute node, p attr The definition of (u|v) is:

[0136]

[0137] Step 3.3: Combining steps 3.1 and 3.2, the probability that a structural node selects different types of neighbor nodes for random walk is:

[0138]

[0139] Among them, N str (v) and N attr (v) are the neighbor structure node set and neighbor attribute node set of node v respectively;

[0140] Step 3.4: Probability calculation process when attribute node transfers to neighbor structure node;

[0141] Let the current attribute node be w and its neighbor structure node set be N str (w), u is a transfer target of the neighbor node set of the current node w; in order to solve the problem that nodes with less attribute importance have less attribute importance gain on neighbor structure nodes, which makes such neighbor structure nodes difficult to be selected during random walk; define the enhancement function g(AISN,α) to adjust the selection probability according to the attribute importance of the structure node, and the calculation method of g(AISN,α) is:

[0142]

[0143] AISN represents the attribute importance of the structural node, the adjustment parameter α≥1, and ε is a small positive number, generally set to 10 -6 , used to prevent the situation when AISN is close to 0;

[0144] For nodes whose structural node influence is greater than or equal to the threshold β, the selection probability is calculated by combining the influence value and the indicator function. At this time, the emphasis is on the strong connection between the structure node and the current attribute node. The calculation method is:

[0145]

[0146] If there is no node whose structural node influence is greater than or equal to the threshold β, then the influence value As the selection probability, the selected node is not added to the walk sequence. The calculation method is:

[0147]

[0148] Taking the above two situations into consideration, the route selection probability of attribute node w is:

[0149]

[0150] Furthermore, the key to step 3.4 is to select structural nodes with smaller attribute importance from the structural nodes whose influence values ​​are greater than the threshold β and add them to the walking sequence to ensure that the attribute information represented by the current attribute node accounts for a high proportion in the selected structural nodes; when the node type is an attribute node, when selecting the next structural node, a strong connection relationship is established between the current attribute node and the selected structural node, highlighting the importance of the attribute information represented by the current attribute node in the overall structural node attribute information.

[0151] Furthermore, the random walk sequence construction process in step 4 includes:

[0152] Step 4.1: Randomly select a node from the heterogeneous weighted graph and determine whether the current node type is a structure node or an attribute node;

[0153] Step 4.2: Determine whether the current node has neighbor nodes (including neighbor attribute nodes and neighbor structure nodes). If yes, execute step 4.3; if not, stop walking, return a walking sequence and go back to step 4.1 until all nodes have been walked;

[0154] Step 4.3: According to the judgment result of step 4.1, if the current node is an attribute node and has neighbor nodes, select a qualified structure node from the neighbor node set and add it to the walking sequence;

[0155] The specific operation is as follows: calculate the influence values ​​of all neighboring structural nodes of the attribute node, and determine whether there is a node with an influence value greater than the threshold β; if not, use the influence value as the weight, select the node with a larger influence value as the wandering node, and then return to step 4.2; if yes, select a structural node with a smaller attribute importance from these structural nodes with an influence value greater than β and add it to the wandering sequence, and use this node as the wandering node;

[0156] Step 4.4: According to the judgment result of step 4.1, if the current node is a structure node and has neighbor nodes (including structure nodes and attribute nodes), there are two route options;

[0157] The specific operation is as follows: if a structural node is selected, the influence values ​​of all neighboring nodes of the structural node are calculated. If there is a node with an influence greater than the threshold value β, a structural node with a greater influence is selected from these structural nodes with an influence value greater than β to be added to the walking sequence, and the node is used as the walking node; if there is no node with an influence greater than the threshold value β, the influence value is used as the weight, and the node with a greater influence value is selected as the walking node, and then return to step 4.2; if an attribute node is selected, the node with a greater attribute importance among the neighboring attribute nodes is selected to act as the walking intermediary, and the node is used as the walking node.

[0158] Step 4.5: Determine whether the current walking sequence meets the sequence length ds (ds is generally 40). If it does not meet the length requirement, continue walking and return to step 4.2; if it meets the requirement, return to step 4.1 until all nodes have been walked.

[0159] Furthermore, the step of training the walk sequence using the skip-gram model in step 5 to learn the low-dimensional vector representation of each node includes:

[0160] Step 5.1: Model structure design; the model consists of three layers: input layer, hidden layer and output layer; the output layer uses the Softmax function to convert the output of the model into a probability representation; the definition of the Softmax function is:

[0161]

[0162] Among them, V is the set of network nodes, score(w i ,w j ) is the central node w iand the next node w in the sequence j The vector inner product between ;

[0163] Step 5.2: Define the loss function. For the training sample (w i ,w j ), the objective loss function is defined as:

[0164]

[0165] Among them, δ is the Sigmoid function, is the kth node in the negative example node set. The negative example node set is generally the number of nodes except w i and w j Other nodes outside; the Sigmoid function is defined as follows:

[0166]

[0167] Furthermore, in step 6, the low-dimensional vectors of the nodes are clustered according to the k-means clustering algorithm to achieve community division, and the steps include:

[0168] Step 6.1: Set the number of clusters k. The value of k is determined according to the average node degree of the real network;

[0169] Step 6.2: Randomly select k nodes as the initial center points;

[0170] Step 6.3: Calculate the distance between all nodes and the center point, and add each center point according to the principle of minimum distance to form a cluster.

[0171] Step 6.4: Every time a new cluster is formed, the center point is updated according to the following formula;

[0172]

[0173] Where X i is the i-th cluster in the network, μ i Is cluster X i The center point of the cluster, x is the other nodes in the cluster except the center point;

[0174] Step 6.5: Repeat steps 6.3 and 6.4 until all nodes are clustered and the algorithm stops, outputting the community structure.

[0175] The algorithm flow chart is attached Figure 1 shown.

[0176] Embodiment 2:

[0177] For a heterogeneous graph G = (V, E, A, T), where V is the node set, E is the edge set, A is the attribute set, and T is the node type set. First, according to the calculation method described in step 1, calculate the attached Figure 2 The structural importance, attribute importance, and influence value of the structural nodes, as well as the attribute importance of the attribute nodes, are calculated as shown in the following table.

[0178]

[0179] Then, according to the calculation method in step 3, the route selection probability of the structural node and the probability of each node being selected are obtained. The calculation results are as follows:

[0180] Route selection probability:

[0181]

[0182] The probability of a node being selected:

[0183]

[0184] Next, based on the probability of the node being selected, the walk sequence construction method in step 4 is used to select specific nodes to add to the walk sequence.

[0185] Finally, according to the walk sequence, the embedded representation of the structural nodes is obtained based on step 5, and the community division result is obtained using step 6.

[0186] Embodiment 3:

[0187] The superiority of the proposed method in community discovery tasks was verified by comparative experiments with DeepWalk and Node2Vec algorithms. Specifically, two real datasets, Cora and Citeseer, were used to compare the performance of different algorithms in terms of NMI, ARI and F1-score evaluation indicators. The experimental results show that the proposed method has obvious advantages in these evaluation indicators, verifying its effectiveness and reliability in community discovery tasks.

[0188] The Cora dataset is a dataset for literature citation networks, mainly used to study the relationship between documents and subject classification. The dataset contains 2708 papers from the field of computer science, divided into 7 different research directions (categories). Each paper is represented by a bag-of-words model, containing 1433 word features.

[0189] The Citeseer dataset is a literature citation network dataset used to study the citation relationship and subject classification between academic documents. The dataset contains 3,327 papers from the field of computer and information science. Each paper is represented by a bag-of-words model, containing 3,703 word features.

[0190] The specific information of the dataset is:

[0191]

[0192] F-score is an indicator used to measure classification or clustering results, which combines the information of precision and recall. The calculation formula of F-score is as follows:

[0193]

[0194] Precision is the ratio of the number of correctly classified positive examples to the number of all samples classified as positive examples, and Recall is the ratio of the number of correctly classified positive examples to the number of all true positive examples. The value range of F-score is between 0 and 1. The larger the value, the better the quality of the classification or clustering result.

[0195] ARI (Adjusted Rand Index) is an indicator used to measure the similarity between two clustering results. The calculation formula of ARI is as follows:

[0196]

[0197] Where RI is the Rand Index, E[RI] is the expected Rand Index under random conditions, and RI max and RI min are the maximum and minimum values ​​of the Rand Index, respectively. The ARI value range is between -1 and 1, and the larger the value, the more similar the clustering results are.

[0198] NMI (Normalized Mutual Information) is an indicator used to measure the similarity between two clustering results. It calculates the similarity by comparing the proportion of samples in the same cluster in the two clustering results. The calculation formula of NMI is as follows:

[0199]

[0200] Among them, U and V are two clustering results, I(U,V) is their mutual information, H(U) and H(V) are their entropy. The value range of NMI is between 0 and 1, and the larger the value, the more similar the clustering results are.

[0201] The experimental results are shown in the following table. It can be seen from the experimental results that the present invention has significant advantages in two real data sets and three evaluation indicators, which verifies the effectiveness and reliability of the present invention in the community discovery task.

[0202]

[0203] Attached Figure 3 and attached Figure 4 This is the visualization effect of the present invention on two real data sets. It can be seen from the attached figure that the node structure of the same community is more compact and the community discovery effect is good.

[0204] The above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them. The protection scope of the present application is not limited thereto. Personnel familiar with the technical field should understand that within the technical scope disclosed in the present application, the technical solutions of the above embodiments may be modified, changed or replaced by equivalents. These modifications, changes or replacements do not change the essence of the technical solutions and still fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the scope of the claims.

Claims

1. A method for attribute network embedding and community discovery based on random walks in heterogeneous graphs, characterized in that: The following steps are involved: Step 1: Calculate the influence of the structural nodes by combining the structural importance and attribute importance of the structural nodes in the heterogeneous graph and the attribute importance of the attribute nodes in the heterogeneous graph; Step 2: Construct a weighted graph representation of the heterogeneous graph according to step 1; Step 3: Construct the transition probability matrix of the weighted graph; Step 4: Perform random walks on the weighted graph representation and construct random walk sequences; Step 5: Based on the walk sequence in step 4, use the skip-gram model to train the walk sequence and learn the low-dimensional vector representation of each node; Step 6: According to the k-means clustering algorithm, cluster the low-dimensional vectors of the nodes to achieve community division.

2. According to claim 1, a method for attribute network embedding and community discovery based on random walks in heterogeneous graphs, characterized in that: The attribute importance (AIAN) of the attribute node in step 1 is determined by the frequency of occurrence of the attribute node in the global scope, and is calculated as follows: Among them, δ(condition) is an indicative function, which takes the value of 1 when the condition is true and takes the value of 0 when the condition is false. A represents the attribute matrix of the heterogeneous graph; The attribute importance of structure node (AISN) is determined by the sum of the attribute importance of the attribute nodes contained in the structure node, and is calculated as follows: Among them, A represents the weighted matrix of attribute importance, and the weight in the matrix is ​​the attribute importance of the attribute node associated with the structure node; The structure importance of structure nodes (SISN) is calculated by Jaccard similarity. The Jaccard similarity calculation method of two nodes u and v in the heterogeneous graph is as follows: Among them, N(u), N(v) represent the set of neighbor nodes of structural nodes u and v, |N(u)∩N(v)| represents the number of common neighbors of nodes u and v, and |N(u)∪N(v)| represents the total number of neighbor nodes of nodes u and v; The structural importance function of the structural node is calculated as follows: Among them, D(u) and D(v) represent the node degrees of nodes u and v respectively, and 1-Jaccard(u,v) represents the distance between two nodes. The farther the distance, the less important the structural node u is to v. The influence of structure nodes (ISN) is calculated by the structure importance and attribute importance, and the weight is adjusted according to the number of structure nodes and attribute nodes in the neighboring nodes. The specific calculation method is: Where D(sn i ) and D(an i ) represent the number of neighboring structural nodes and attribute nodes of the ith node respectively; the introduction of these two weight factors can balance the structural importance and attribute importance, ensuring that both are properly considered in the final importance evaluation; the greater the influence of the structural node, the richer information the node contains in the graph, and the smaller the influence of the structural node, the more likely the node is to become a bridge node in the community.

3. According to claim 1, a method for attribute network embedding and community discovery based on random walks in heterogeneous graphs, characterized in that: The weighted graph of the heterogeneous graph in step 2 is constructed by: Step 2.1: Determine the node types in the weighted graph, namely attribute nodes and structure nodes; Step 2.2: Determine the link mode of the attribute node. The attribute node is connected to the structure node, representing the attribute information of the structure node; Step 2.3: Determine the link mode of the structure node. The structure node can be connected to the attribute node or to other structure nodes. The connection with the structure node is used to represent the topological relationship in the network. Step 2.4: Determine the weight of the node, where the weight of the structural node is composed of the influence of the structural node, the structural importance of the structural node, and the attribute importance of the structural node, and the weight of the attribute node is composed of the attribute importance of the attribute node.

4. According to claim 1, a method for attribute network embedding and community discovery based on random walks in heterogeneous graphs, characterized in that: The process of constructing the transition probability matrix of the weighted graph in step 3 includes: Assume that the current structure node is v and its neighbor structure node set is N str (v), the set of neighbor attribute nodes is N attr (v), u is a transfer target in the neighbor node set of the current node v; Step 3.1: Probability calculation process when a structure node transfers to a neighboring structure node; First, we select nodes whose influence is greater than or equal to the threshold β; we define the indicator function Indicator(u) to indicate whether this condition is met. The calculation method of Indicator(u) is: In order to prevent some values ​​from being much larger than other values ​​in extreme cases, a decay function f(x) is defined, which is calculated as: Where α is a positive adjustment parameter used to control the decay rate; combined with the structure node influence and the indicator function, the probability of a structure node with an influence greater than or equal to the threshold β transferring to a neighboring structure node is Defined as: If there is no node whose influence is greater than or equal to the threshold β, then the influence value As the selection probability, the selected node is not added to the walk sequence. The calculation method is: Taking the above two situations into consideration, the probability of selecting the structural route of the structural node is: Step 3.2: Probability calculation process when the structure node transfers to the neighbor attribute node; The probability p of a structure node transferring to a neighboring attribute node attr (u|v) is calculated by the attribute importance value of the attribute node, p attr The definition of (u|v) is: Step 3.3: Combining steps 3.1 and 3.2, the probability that a structural node selects different types of neighbor nodes for random walk is: Among them, N str (v) and N attr (v) are the neighbor structure node set and neighbor attribute node set of node v respectively; Step 3.4: Probability calculation process when attribute node transfers to neighbor structure node; Let the current attribute node be w and its neighbor structure node set be N str (w), u is a transfer target of the neighbor node set of the current node w; in order to solve the problem that nodes with less attribute importance have less attribute importance gain on neighbor structure nodes, which makes such neighbor structure nodes difficult to be selected during random walk; define the enhancement function g(AISN,α) to adjust the selection probability according to the attribute importance of the structure node, and the calculation method of g(AISN,α) is: AISN represents the attribute importance of the structural node, the adjustment parameter α≥1, and ε is a small positive number, generally set to 10 -6 , used to prevent the situation when AISN is close to 0; For nodes whose structural node influence is greater than or equal to the threshold β, the selection probability is calculated by combining the influence value and the indicator function. At this time, the emphasis is on the strong connection between the structure node and the current attribute node. The calculation method is: If there is no node whose structural node influence is greater than or equal to the threshold β, then the influence value As the selection probability, the selected node is not added to the walk sequence. The calculation method is: Taking the above two situations into consideration, the route selection probability of attribute node w is:

5. According to claim 4, a method for attribute network embedding and community discovery based on random walks in heterogeneous graphs, characterized in that: The key to step 3.4 is to select structural nodes with smaller attribute importance from structural nodes whose influence value is greater than the threshold β and add them to the walking sequence, so as to ensure that the attribute information represented by the current attribute node accounts for a higher proportion in the selected structural nodes; When the node type is an attribute node, when selecting the next structure node, a strong connection relationship is established between the current attribute node and the selected structure node, highlighting the importance of the attribute information represented by the current attribute node in the overall structure node attribute information.

6. According to claim 1, a method for attribute network embedding and community discovery based on random walks in heterogeneous graphs, characterized in that: The random walk sequence construction process in step 4 includes: Step 4.1: Randomly select a node from the heterogeneous weighted graph and determine whether the current node type is a structure node or an attribute node; Step 4.2: Determine whether the current node has neighbor nodes (including neighbor attribute nodes and neighbor structure nodes); if yes, execute step 4.3; if no, stop walking, return a walking sequence and return to step 4.1 until all nodes are walked; Step 4.3: According to the judgment result of step 4.1, if the current node is an attribute node and has neighbor nodes, select a qualified structure node from the neighbor node set and add it to the walking sequence; The specific operation is as follows: calculate the influence values ​​of all neighboring structural nodes of the attribute node, and determine whether there is a node with an influence value greater than the threshold β; if not, use the influence value as the weight, select the node with a larger influence value as the wandering node, and then return to step 4.2; if yes, select a structural node with a smaller attribute importance from these structural nodes with an influence value greater than β and add it to the wandering sequence, and use this node as the wandering node; Step 4.4: According to the judgment result of step 4.1, if the current node is a structure node and has neighbor nodes (including structure nodes and attribute nodes), there are two route options; The specific operation is as follows: if a structural node is selected, the influence values ​​of all neighboring nodes of the structural node are calculated; if there is a node with an influence greater than a threshold value β, a structural node with a greater influence is selected from these structural nodes with an influence value greater than β to be added to the walking sequence, and the node is used as the walking node; if there is no node with an influence greater than the threshold value β, the influence value is used as the weight, and the node with a greater influence value is selected as the walking node, and then return to step 4.2; if an attribute node is selected, a node with a greater attribute importance among the neighboring attribute nodes is selected to act as a walking intermediary, and the node is used as the walking node; Step 4.5: Determine whether the current walking sequence meets the sequence length ds (ds is generally 40). If it does not meet the length requirement, continue walking and return to step 4.2; if it meets the requirement, return to step 4.1 until all nodes have been walked.

7. According to claim 1, a method for attribute network embedding and community discovery based on random walks in heterogeneous graphs, characterized in that: The skip-gram model is used to train the walk sequence in step 5, and the steps of learning the low-dimensional vector representation of each node include: Step 5.1: Model structure design; the model consists of three layers: input layer, hidden layer and output layer; the output layer uses the Softmax function to convert the output of the model into a probability representation; the definition of the Softmax function is: Among them, V is the set of network nodes, score(w i ,w j ) is the central node w i and the next node w in the sequence j The vector inner product between ; Step 5.2: Define the loss function; for the training sample (w i ,w j ), the objective loss function is defined as: Among them, δ is the Sigmoid function, is the kth node in the negative example node set. The negative example node set is generally the number of nodes except w i and w j Other nodes outside; the Sigmoid function is defined as follows:

8. The attribute network embedding and community discovery method based on random walk of heterogeneous graphs according to claim 1, characterized in that: In step 6, the low-dimensional vectors of the nodes are clustered according to the k-means clustering algorithm to achieve community division, and the steps include: Step 6.1: Set the number of clusters k. The value of k is determined according to the average node degree of the real network; Step 6.2: Randomly select k nodes as the initial center points; Step 6.3: Calculate the distance between all nodes and the center point, and add each center point according to the principle of minimum distance to form a cluster; Step 6.4: Every time a new cluster is formed, the center point is updated according to the following formula; Where X i is the i-th cluster in the network, μ i Is cluster X i The center point of the cluster, x is the other nodes in the cluster except the center point; Step 6.5: Repeat steps 6.3 and 6.4 until all nodes are clustered and the algorithm stops, outputting the community structure.

Citation Information

Cited By

  • Structural multi-view clustering method based on heterogeneous graph random walk

    CN121901773A