Social network community division method based on graph attention mechanism

Through the graph attention mechanism and the improved KMeans clustering algorithm, combined with the node attributes and topological structure of the social network, the efficiency and accuracy problems of social network community division are solved, and more accurate and efficient community division is achieved.

CN120448845APending Publication Date: 2025-08-08BUSINESS SCHOOL OF ANHUI UNIV OF TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510542028.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

When the existing social network community division method deals with large-scale and complex social networks, there are problems of inefficiency and low division accuracy. The traditional method ignores node attribute information, resulting in inaccurate division results.

Method used

The community division method based on the graph attention mechanism is adopted, combined with the graph attention mechanism and the improved KMeans clustering algorithm, node attribute features are extracted through self-attention and multi-head attention mechanisms, and community division is performed based on the topological structure of the nodes, and the initialization and division rules of the cluster center are optimized.

Benefits of technology

It improves the accuracy and efficiency of social network community division, can better capture the similarity between node attributes, reduce the possibility of mis-dividing, and is suitable for social network data of different sizes and types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448845A_ABST
    Figure CN120448845A_ABST
Patent Text Reader

Abstract

The invention discloses a social network community division method based on a graph attention mechanism, and belongs to the technical field of social network analysis. According to the method, firstly, nodes and edges of the nodes in the social network are preprocessed, and then a graph attention mechanism is introduced through a graph neural network to capture local features and global structure information of the nodes. After node feature embedding is completed through multi-layer information aggregation, a clustering algorithm is improved by comprehensively considering the node attribute feature similarity degree and the proximity degree of nodes in a network topology structure, and community division is conducted on the nodes through the improved clustering algorithm. Experimental results show that compared with an existing community division method, the method has the advantages that the accuracy and the efficiency are remarkably improved, the potential community structure in the social network can be better recognized, and the method can be widely applied to the fields of social network analysis, user behavior prediction, recommendation systems and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of social network analysis, and more specifically, relates to a social network community division method based on a graph attention mechanism. Background Art

[0002] With the widespread adoption of the internet and the rapid development of social media, social networks have become a key platform for daily communication and information dissemination. Within social networking environments, user relationships and community structures are extremely complex and diverse. Accurately and effectively segmenting communities within social networks is crucial for understanding users' virtual social behaviors, deeply exploring information dissemination patterns, and implementing personalized recommendations.

[0003] In the architecture of social networks, users can be viewed as nodes, while the connections between users, generated through virtual social behaviors, are represented as connections between nodes, or edges. The core goal of community segmentation is to rationally group nodes with similar attributes into the same community, while simultaneously grouping nodes with different attributes into different communities. Traditional community segmentation methods are mostly based on the analysis of the connection structure between users. This focuses on the connection relationships between nodes, often ignoring the attribute information inherent in the nodes themselves. When dealing with large-scale and complex social networks, traditional segmentation methods are prone to inefficiency and low segmentation accuracy.

[0004] According to a search, in recent years, with the graph neural network (GNN), especially the graph attention network (GAT) in the research and application of deep learning, it has attracted much attention. The method of using the graph attention mechanism for classification has been disclosed, such as the Chinese patent authorization announcement number CN 114818719 B, the authorization announcement date is October 29, 2024, and the invention is named A community topic classification method based on a composite network and a graph attention mechanism. The method disclosed in the patent document includes: data preprocessing, keyword extraction, feature initialization, establishment of two graph structures, establishment of a graph attention neural network classification model and output node classification; based on the characteristics of the community topic dataset, starting from the key information and the content of the topic itself, a keyword-topic composite complex network is established, and then two graph structures of the topic nodes are extracted, and the double-layer attention mechanism is used to update the features and use them for node classification tasks. This patent uses a graph attention mechanism to extract keywords from the semantics of community topics to complete the community topic classification task. However, the method of this patent is relatively complex. It establishes and maintains a multi-level, multi-structured graph network, and includes a double-layer attention mechanism, which leads to high model complexity and increases computing resources and time costs. Most importantly, this patent document extracts keywords and topic content as basic features, which is limited by the accuracy of text preprocessing and keyword extraction, resulting in insufficient features or being affected by noise, affecting the model effect. This makes the use of the graph attention mechanism in this patent difficult to apply to the community segmentation task of social network datasets. Summary of the Invention

[0005] The present invention aims to solve the accuracy and efficiency problems of community division in social networks. It provides a community division method based on the graph attention mechanism. With the help of the powerful representation ability of the graph attention mechanism, it effectively integrates the network topology structure and node attribute information to improve the accuracy of community division. Especially when dealing with social networks with complex user relationships and multi-dimensional attributes, it can effectively capture the similarity between node attributes, overcome the limitations faced by traditional division methods, and thus achieve more accurate and efficient community division.

[0006] To achieve the above objectives, the present invention provides a community segmentation method based on a graph attention mechanism, which specifically includes the following steps:

[0007] S1, social network data collection and preprocessing;

[0008] S2, build a social network graph;

[0009] Based on the preprocessed data, a social network graph G = (V, E) is constructed, where V is a set of nodes and E is a set of edges, representing the relationships between social nodes. At the same time, an initial feature vector is assigned to each node.

[0010] S3. Apply the graph attention mechanism, which specifically includes the following steps:

[0011] S3.1, linear transformation of node features;

[0012] S3.2. Use self-attention mechanism;

[0013] S3.3, use multi-head attention mechanism;

[0014] S3.4, node feature dimensionality reduction and optimization;

[0015] S4. Implement community division;

[0016] Use the improved KMeans clustering algorithm to implement community division of network nodes;

[0017] S5, result evaluation and model optimization;

[0018] If the results of the qualitative and quantitative assessments do not meet the expected standards, then:

[0019] 1) Adjust the parameters in the graph attention mechanism to optimize the quality of node feature embeddings; and / or

[0020] 2) Adjust the parameters in the clustering algorithm and re-divide the community until the community division results meet the expected standards.

[0021] As a further improvement of the present invention, in step S4, the specific division method is as follows:

[0022] S4.1. Initialize cluster centers;

[0023] The node feature vector processed by the graph attention mechanism is used as input, and the KMeans++ clustering algorithm is used to select K nodes with the farthest possible network distance as the initial cluster centers;

[0024] S4.2. Implement node clustering;

[0025] The similarity of the feature vectors between social network nodes and cluster centers is measured. The similarity of the feature vectors between nodes and the network distance is comprehensively considered, and each node is divided into the community where the nearest cluster center is located.

[0026] As a further improvement of the present invention, step S4.2 specifically includes the following process:

[0027] S4.2.1. Calculate the shortest path length between each node in the network and each cluster center, as well as the similarity between the feature vectors of each node and each cluster center. Sort the cluster centers by similarity from high to low, and set a network distance threshold and a node feature vector similarity threshold.

[0028] S4.2.2. Complete node division according to the following division rules:

[0029] 1) Iteratively search for cluster centers whose similarity is not less than the node feature vector similarity threshold and whose network distance does not exceed the network distance threshold;

[0030] 2) Select the cluster with the highest similarity and assign the nodes to it;

[0031] S4.2.3. After all nodes in the social network are divided, recalculate the new cluster centers of each cluster;

[0032] S4.2.4. Repeat steps S4.2.2 and S4.2.3 until the cluster center no longer changes significantly, that is, after the clustering process converges, the obtained clusters are the community division results.

[0033] It should be noted that the node feature vector similarity threshold and network distance threshold should be set based on the actual segmentation requirements. The specific values should be set to ensure that all nodes can complete the segmentation. In practice, you can set the initial value as the threshold and bring it into the model for segmentation training. Then, evaluate the model performance. If the performance evaluation is qualified, the set initial value is the appropriate threshold. If the performance evaluation is unsatisfactory, adjust the initial value based on the specific evaluation results and bring it into the model for training again until a threshold that meets the requirements is found.

[0034] As a further improvement of the present invention, in step S4.2.3, the mean of the eigenvectors of all nodes in the same cluster is calculated as the eigenvector of the new cluster center of the cluster.

[0035] As a further improvement of the present invention, the similarity between the feature vectors of each node and each cluster center is calculated using the Euclidean distance formula or the cosine similarity formula.

[0036] As a further improvement of the present invention, in step S1, the collected data includes two dimensions, one is the attribute information of the social nodes, and the other is the relationship information between the social nodes; data preprocessing includes data cleaning, eliminating invalid social node attribute information and relationship information from the collected data.

[0037] As a further improvement of the present invention, in step S3.2, the attention coefficient between the node and its neighboring nodes is first calculated, and then the attention coefficient is processed using the softmax function to obtain a normalized attention coefficient. The normalized attention coefficient is then used to perform weighted summation on the feature vectors of all neighboring nodes to complete the aggregation of the feature vectors of the neighboring nodes. Finally, the aggregation result is subjected to a nonlinear transformation to obtain an updated node feature representation.

[0038] As a further improvement of the present invention, in step S3.3, the number of attentions is first set, and the weight matrix and weight vector in each attention head are initialized; then, each attention head independently calls the self-attention mechanism, calculates the attention coefficient of the node, completes the aggregation of node features, and obtains the updated node feature representation; finally, the node feature representation of each attention head is spliced to obtain a high-dimensional node feature vector.

[0039] As a further improvement of the present invention, in step S3.4, the output high-dimensional node feature vector is first subjected to a linear transformation to obtain a low-dimensional node feature vector, and then the self-attention mechanism is used to aggregate and update each low-dimensional node feature vector to obtain the final node feature vector.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] (1) The method of the present invention effectively extracts more discriminative and efficient features from node attribute features by using a graph attention mechanism. First, using the self-attention mechanism, different attention weights are assigned to each neighbor node according to the similarity of the attribute features between nodes, the feature vectors of all neighbor nodes are aggregated, and the feature vector representation of the node is updated. This can capture the complex structural relationships between nodes and the potential relationships between node attribute features, and learn node feature representations that are more useful for completing the community division task. Then, a multi-head attention mechanism is introduced to stabilize the self-attention learning process of each head, capture more node attribute feature information, and help further improve the accuracy of community division. Finally, the self-attention mechanism is used to compress and reduce the dimensionality of the heterogeneous node features output by the multi-head attention, avoiding the overfitting problem of high-dimensional features, which is conducive to improving the efficiency of community division.

[0042] (2) The method of the present invention proposes an improved KMeans clustering algorithm to implement community division. In the stage of initializing the cluster center, the initialization selection strategy of the cluster center node is improved, striving to achieve the dispersion of the cluster center in the spatial distribution, effectively reducing the risk of the clustering process falling into the local optimal solution, and thus obtaining a better clustering effect and a faster convergence speed. When determining the community affiliation of the node, the attribute characteristics of the node and the network topology are comprehensively considered. On the one hand, the similarity of the node attribute characteristics is evaluated by calculating the feature similarity between the nodes; on the other hand, the proximity of the nodes in the topology is evaluated by calculating the network distance between the nodes. This improvement aims to minimize the possibility of mistakenly dividing nodes with similar attribute characteristics but long network distances into the same community, so that the community division is more in line with reality.

[0043] (3) The method of the present invention combines the feature extraction and optimization of the graph attention mechanism and improves the community division of the KMeans clustering algorithm, and continuously trains and optimizes the model and algorithm parameters based on the evaluation of the community division results, so that the algorithm model has strong versatility and significantly improves the implementation effect of community division. It overcomes the problems of low efficiency and local optimal solutions in traditional community division algorithms, makes the learned community division results more consistent with the actual situation of social networks, and reduces the situation of unreasonable division.

[0044] (4) The method of the present invention has wide applicability and can be applied to social network data of different sizes and types. The community division results can be updated in a timely manner when new users and relationships join the social network. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a schematic diagram of the overall process of a social network community segmentation method based on a graph attention mechanism of the present invention;

[0046] Figure 2 This is a schematic diagram of the graph attention mechanism processing flow of the present invention;

[0047] Figure 3 This is a schematic diagram of the community division process based on the improved KMeans clustering algorithm of the present invention;

[0048] Figure 4 This is a schematic diagram of the Cora social network involved in Example 1 of the present invention;

[0049] Figure 5 This is a schematic diagram of the Cora social network community division results based on the improved KMeans clustering algorithm involved in Example 1 of the present invention;

[0050] Figure 6This is a schematic diagram of the Cora social network community division results based on the KMeans clustering algorithm involved in Comparative Example 1 of the present invention. DETAILED DESCRIPTION

[0051] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings and specific embodiments. Obviously, the embodiments described are part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0052] Traditional community segmentation methods are limited by their shortcomings. For example, community segmentation methods based on modularity optimization are prone to local optimal solutions in practical applications, resulting in low segmentation accuracy. Community segmentation methods based on machine learning, such as clustering methods based on node attribute similarity and community segmentation methods based on spectral clustering, often ignore the selection and enhancement of node attribute characteristics for specific tasks, resulting in inaccurate segmentation results. Furthermore, they are not only inefficient when processing high-dimensional data and dynamic networks, but also highly dependent on data. Furthermore, they fail to reflect that the formation of communities in reality is influenced by both node attribute characteristics and the network distance between nodes.

[0053] In recent years, with the research and application of Graph Neural Network (GNN), especially Graph Attention Network (GAT), it has attracted much attention in the field of deep learning. The graph attention mechanism can effectively capture the similarity between the attribute features of nodes in the graph, which provides a new idea for solving the problem of community division in social networks. Based on this, the present invention provides a community division method based on the graph attention mechanism. With the help of the powerful representation ability of the graph attention mechanism, the network topology structure and node attribute information are effectively integrated to improve the accuracy of community division, especially in the division of social networks with complex user relationships and multi-dimensional attributes. It can effectively capture the similarity between node attributes, overcome the limitations faced by traditional division methods, and thus achieve more accurate and efficient community division.

[0054] Specifically, such as Figure 1 As shown, the community division method of the present invention includes the following steps:

[0055] Step S1, social network data collection and preprocessing;

[0056] Social network data is collected using internet scraping and web crawling techniques. The collected data primarily covers two dimensions: first, the attributes of social nodes, such as user age, gender, and hobbies; and second, the relationships between social nodes, such as friendships and interaction frequency. After data collection, data preprocessing is performed. This includes data cleaning, which removes invalid social node attribute or relationship information from the collected data; then, standardization is performed to ensure that the data falls within a reasonable range.

[0057] Step S2: constructing a social network graph;

[0058] Based on the preprocessed social network data, a social network graph G = (V, E) is constructed, where V is the set of nodes and E is the set of edges, representing the relationships between social nodes. Whether an edge exists between two nodes is determined based on the relationship information between the social nodes. For example, if two users are friends and their interaction frequency exceeds a certain threshold, an edge will exist in the graph connecting the two nodes. Each node is also assigned an initial feature vector, which contains attribute information about the social node.

[0059] Step S3: Apply graph attention mechanism;

[0060] Applying the graph attention mechanism, we can learn node feature embeddings from social network data that are beneficial for completing community division tasks, such as Figure 2 As shown, the specific process is as follows:

[0061] Step S3.1: Node feature linear transformation

[0062] A linear transformation is performed on the node feature vector using a learnable weight matrix to obtain a new feature representation of the node. The linear transformation can adjust the node feature dimension and enhance the abstraction ability of the original node features.

[0063] Step S3.2: Use self-attention mechanism

[0064] For each node, the attention weights of its neighboring nodes are calculated. The feature vectors of all neighboring nodes are aggregated based on the attention weights to update the node's feature representation. The updated node feature representation can capture the complex network structure relationships between nodes and is more context-aware.

[0065] Step S3.3: Use multi-head attention mechanism

[0066] Using multiple attention heads, each independently calling a self-attention mechanism, we obtain different node feature representations. The node features from each head are concatenated (or averaged) to obtain the final node feature vector. This multi-head attention mechanism can stabilize the learning process of a single self-attention mechanism.

[0067] Step S3.4: Node feature dimensionality reduction and optimization

[0068] The high-dimensional node features output by multi-head attention are compressed and reduced to avoid overfitting of high-dimensional features. The self-attention mechanism is used to aggregate and update the heterogeneous features captured by multi-head attention, filtering out redundant information and retaining key features to form a more robust node feature vector representation.

[0069] Step S4: Implement community division;

[0070] Improve the KMeans clustering algorithm and implement community division of network nodes, such as Figure 3 The specific process is as follows:

[0071] Step S4.1: Initialize cluster centers

[0072] The node feature vector processed by the graph attention mechanism is used as input, and the KMeans++ clustering algorithm is used to select K nodes with the farthest possible network distance as the initial clustering centers.

[0073] Step S4.2: Implement node clustering

[0074] The feature similarity between network nodes and cluster centers is measured. Taking into account the feature similarity and network distance between nodes, each node is divided into the community with the closest cluster center. This is an iterative process that includes:

[0075] Step S4.2.1. Calculate the shortest path length between each node in the network and each cluster center, as well as the similarity between each node and the feature vector of each cluster center. Sort the cluster centers by similarity from high to low, and set the network distance threshold and the node feature vector similarity threshold.

[0076] S4.2.2. Complete node division according to the following division rules:

[0077] 1) Iteratively search for cluster centers whose similarity is not less than the node feature vector similarity threshold and whose network distance does not exceed the network distance threshold;

[0078] 2) Select the cluster with the highest similarity and assign the nodes to it;

[0079] S4.2.3. After dividing all nodes in the social network, calculate the new cluster center of each cluster;

[0080] S4.2.4. Repeat steps S4.2.2 and S4.2.3 until the cluster centers no longer change significantly. After the clustering process converges, the resulting clusters are the community division results.

[0081] Step S5: Result evaluation and model optimization

[0082] (1) Qualitative evaluation

[0083] Visualization techniques such as dimensionality reduction technology and visualization tools are used to draw visual charts to visualize node features and the relative distance relationship between nodes, making it easier for users to intuitively observe and compare the effects of community division.

[0084] (2) Quantitative evaluation

[0085] Combined with the domain characteristics of social network datasets, reasonable clustering evaluation indicators are used to quantitatively evaluate and compare the community division quality of clustering algorithms.

[0086] (3) Model optimization

[0087] If the results of qualitative and quantitative evaluations do not meet the expected standards, adjust the parameters in the graph attention mechanism (such as the number of attention heads, the output dimension of the weight matrix, etc.) to optimize the quality of node feature embedding; adjust the parameters in the clustering algorithm (such as the K value, network distance threshold, similarity threshold, etc.) and re-perform community division until the community division results meet the expected standards.

[0088] The present invention will be further described below with reference to specific embodiments.

[0089] Example 1

[0090] This embodiment uses the community partitioning of the Cora social network as an example to illustrate. The Cora dataset is a typical social network dataset that describes scientific papers and their citation relationships. This dataset can be collected through graph learning libraries such as PyTorch Geometric (PyG) and Deep Graph Library (DGL). The Cora dataset is relatively small, containing 2708 papers, with 5429 citation relationships between papers. Each paper has 1433 dimensional features, indicating whether a certain word is contained in the paper (a total of 1433 words). The papers have been divided into 7 categories, with roughly the same number of papers in each category.

[0091] The specific method for dividing the Cora social network into communities in this embodiment is as follows:

[0092] Step S1, Cora social network data preprocessing;

[0093] Data cleaning of the Cora dataset involves key steps such as filling missing values for paper features and citation relationships, removing outliers, and filtering duplicate samples. The cleaned data is then preprocessed. Paper features are encoded as binary values ranging from 0 to 1. Paper categories are encoded as integers ranging from 0 to 6.

[0094] Step S2: constructing a social network graph;

[0095] Based on the preprocessed Cora dataset, we used the Matplotlib visualization tool to plot a social network graph G = (V, E), where V is the node set representing the papers in the social network, and E is the edge set representing the citation relationships between papers. V contains 2708 nodes and E contains 5429 undirected edges, with each node having 1433 dimensional features. Node class labels, integer values ranging from 0 to 6, are used to train the algorithm model. Class labels are represented by seven different colors to facilitate comparison with the community segmentation results.

[0096] Step S3: Apply graph attention mechanism;

[0097] Step S3.1, linear transformation of node features;

[0098] 1) The feature vector of node i Input into the weight matrix W. Set the input feature dimension of W to F = 1433 and the output feature dimension to F′ = 64.

[0099] 2) The input feature vector of node i Multiplying with the weight matrix W and undergoing linear transformation, we get a low-dimensional node feature representation.

[0100] S3.2. Use self-attention mechanism;

[0101] 1) Calculate the attention coefficient of the node and its neighboring nodes. First, for each node i, calculate its neighborhood N i The attention coefficient e of any node j in the node ij , Among them, || represents the splicing operation, and the node feature vector after linear transformation and Perform simple concatenation to form a combined feature embedding; It is a 128×1 learnable weight vector, which performs a dot product operation with the concatenated feature embedding to complete a simple weighted sum linear transformation; LeakyReLu is an activation function with a negative semi-axis slope of 0.2 and a positive semi-axis slope of 1, which further completes the nonlinear transformation of the feature embedding.

[0102] Then, the softmax function is used to process the attention coefficient to obtain the normalized attention coefficient In order to unify and compare the attention coefficients of different neighbor nodes.

[0103] 2) Update node feature representation. First, use the normalized attention coefficient α ij Perform weighted summation on all neighbor node feature vectors to complete the aggregation of neighbor node feature vectors. Then, perform nonlinear transformation on the aggregation result to obtain the updated node feature vector representation Among them, ELU is a smooth nonlinear activation function, which has an exponential decay in the negative area and a slope of 1 in the positive area.

[0104] S3.3, use multi-head attention mechanism;

[0105] 1) Set the number of attention heads to 8 and initialize the weight matrix and weight vector in each attention head.

[0106] 2) Each attention head independently calls the self-attention mechanism to calculate the attention coefficient of the node, complete the aggregation of node features, and obtain the updated node feature vector

[0107] 3) Concatenate the node feature representations of each head to obtain a high-dimensional node feature vector

[0108] S3.4, node feature dimensionality reduction and optimization;

[0109] 1) The node feature vector Input into another weight matrix W'. Set the input feature dimension of W' to F = 64 × 8 and the output feature dimension to F' = 128.

[0110] 2) The node feature vector Multiplying with the weight matrix W′ and undergoing linear transformation, we get the low-dimensional node feature vector

[0111] 3) Use the self-attention mechanism to analyze the feature vectors of each node Aggregate and update to get the final node feature vector representation

[0112] S4. Implement community division;

[0113] S4.1. Initialize cluster centers;

[0114] Set the number of communities K = 7. The node feature vector obtained by the graph attention mechanism Use the K-Means++ algorithm to initialize K cluster centers.

[0115] S4.2. Implement node clustering;

[0116] S4.2.1. In the social network graph G, use the breadth-first search algorithm to calculate the shortest path length between any node and each cluster center, and use the Euclidean distance formula The similarity between each node and the feature vector of each cluster center is calculated. The cluster centers are sorted from high to low according to the similarity, and the network distance threshold network_distance_threshold is set to 4, and the node feature vector similarity threshold similarity_threshold is set to 0.3.

[0117] S4.2.2. Divide according to the node division rule of the present invention.

[0118] S4.2.3. After all nodes in the network are clustered, the mean of the feature vectors of all nodes in the same cluster is calculated as the feature vector of the new cluster center of the cluster.

[0119] S4.2.4. Repeat steps S4.2.2 and S4.2.3 until the cluster centers no longer change significantly. Set the clustering process convergence condition atol = 1e-4 to allow for slight numerical differences between the old and new cluster centers. After the clustering process converges, the resulting clusters are the community delineation results.

[0120] S5, result evaluation and model optimization;

[0121] 1. Qualitative evaluation

[0122] Use t-SNE (t-distributed stochastic neighbor embedding) technology to reduce the dimensionality of high-dimensional node features and embed them into two-dimensional space to obtain better visualization effects. Use matplotlib visualization tools to draw a two-dimensional scatter plot, such as Figure 5 As shown in the figure, different colors are used to represent different communities, and the community division results are displayed intuitively.

[0123] 2. Quantitative evaluation

[0124] We quantitatively assessed the quality of community delineation using metrics such as Normalized Mutual Information (Normalized Mutual Information), Adjusted Rand Index (Adjusted Rand Index), and Silhouette Score (Silhouette Score). After multiple rounds of adjusting model parameters, the overall evaluation metrics reached optimal values. Among them, Normalized Mutual Information (Normalized Mutual Information) = 0.5721, Adjusted Rand Index = 0.5534, and Silhouette Score = 0.4491. At this point, the community delineation results are satisfactory.

[0125] Comparative Example 1

[0126] In this comparative example, only the K-Means algorithm was used to complete the community segmentation of the Cora social network. The evaluation index values were Normalized Mutual Information = 0.2206, Adjusted Rand Index = 0.1278, and Silhouette Score = 0.1263, which are significantly inferior to the evaluation index values of the segmentation results of the method proposed in this invention. The two-dimensional scatter plot was drawn using the matplotlib visualization tool, as shown in Figure 2. Figure 6 As shown in the figure, it can be seen that the result of community division is obviously inferior to that of the present invention.

[0127] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A social network community segmentation method based on graph attention mechanism, characterized by: The steps include: S1, social network data collection and preprocessing; S2, build a social network graph; Based on the preprocessed data, a social network graph G = (V, E) is constructed, where V is a set of nodes and E is a set of edges, representing the relationships between social nodes. At the same time, an initial feature vector is assigned to each node. S3. Apply the graph attention mechanism, which specifically includes the following steps: S3.1, linear transformation of node features; S3.

2. Use self-attention mechanism; S3.3, use multi-head attention mechanism; S3.4, node feature dimensionality reduction and optimization; S4. Implement community division; Use the improved KMeans clustering algorithm to implement community division of network nodes; S5, result evaluation and model optimization; If the results of the qualitative and quantitative assessments do not meet the expected standards, then: 1) Adjust the parameters in the graph attention mechanism to optimize the quality of node feature embeddings; and / or 2) Adjust the parameters in the clustering algorithm and re-divide the community until the community division results meet the expected standards.

2. The method for dividing social network communities based on graph attention mechanism according to claim 1, characterized in that: In step S4, the specific division method is as follows: S4.

1. Initialize cluster centers; The node feature vector processed by the graph attention mechanism is used as input, and the KMeans++ clustering algorithm is used to select K nodes with the farthest possible network distance as the initial cluster centers; S4.

2. Implement node clustering; The similarity of the feature vectors between social network nodes and cluster centers is measured. The similarity of the feature vectors between nodes and the network distance is comprehensively considered, and each node is divided into the community where the nearest cluster center is located.

3. The method for dividing social network communities based on graph attention mechanism according to claim 2, characterized in that: Step S4.2 specifically includes the following process: S4.2.

1. Calculate the shortest path length between each node in the network and each cluster center, as well as the similarity between the feature vectors of each node and each cluster center. Sort the cluster centers by similarity from high to low, and set a network distance threshold and a node feature vector similarity threshold. S4.2.

2. Complete node division according to the following division rules: 1) Iteratively search for cluster centers whose similarity is not less than the node feature vector similarity threshold and whose network distance does not exceed the network distance threshold; 2) Select the cluster with the highest similarity and assign the nodes to it; S4.2.

3. After all nodes in the social network are divided, recalculate the new cluster centers of each cluster; S4.2.

4. Repeat steps S4.2.2 and S4.2.3 until the cluster center no longer changes significantly, that is, after the clustering process converges, the obtained clusters are the community division results.

4. The method for dividing social network communities based on graph attention mechanism according to claim 3, characterized in that: In step S4.2.3, the mean of the eigenvectors of all nodes in the same cluster is calculated as the eigenvector of the new cluster center of the cluster.

5. The method for dividing social network communities based on graph attention mechanism according to claim 3, characterized in that: Use the Euclidean distance formula or the cosine similarity formula to calculate the similarity of the feature vectors between each node and each cluster center.

6. The method for dividing social network communities based on graph attention mechanism according to any one of claims 1 to 5, characterized in that: In step S1, the collected data includes two dimensions: one is the attribute information of social nodes, and the other is the relationship information between social nodes; data preprocessing includes data cleaning, which removes invalid social node attribute information and relationship information from the collected data.

7. The method for dividing social network communities based on a graph attention mechanism according to any one of claims 1 to 5, characterized in that: In step S3.2, the attention coefficient between the node and its neighboring nodes is first calculated, and then the attention coefficient is processed using the softmax function to obtain the normalized attention coefficient. The normalized attention coefficient is then used to perform weighted summation on the feature vectors of all neighboring nodes to complete the aggregation of the feature vectors of the neighboring nodes. Finally, the aggregation result is subjected to a nonlinear transformation to obtain the updated node feature representation.

8. The method for dividing social network communities based on graph attention mechanism according to claim 7, characterized in that: In step S3.3, the number of attentions is first set, and the weight matrix and weight vector in each attention head are initialized; then, each attention head independently calls the self-attention mechanism, calculates the attention coefficient of the node, completes the aggregation of node features, and obtains the updated node feature representation; finally, the node feature representation of each attention head is spliced to obtain a high-dimensional node feature vector.

9. The method for dividing social network communities based on graph attention mechanism according to claim 8, characterized in that: In step S3.4, the output high-dimensional node feature vector is first linearly transformed to obtain a low-dimensional node feature vector, and then the self-attention mechanism is used to aggregate and update each low-dimensional node feature vector to obtain the final node feature vector.

Citation Information

Cited By

  • Artificial intelligence-based front-end burying point recommendation method and system

    CN122153169A