## 3 Graph Clustering Methods
### Graphsage for Community Detection  
GraphSAGE (Graph Sample and Aggregated) [29] is a variant of a Graph Neuronal Network (GNN) in the family of deep learning methods for graphs. GraphSAGE lever  
Figure 3: Overview of graph encoding with the GNNs neighborhood aggregation methods. ages the concept of graph convolution [26], which enables the aggregation of information from adjacent nodes to update the representation of a target node like GCNs. However, in GraphSAGE neighbor sampling to handle large graphs efficiently, GraphSAGE adopts a sampling strategy where it randomly selects a consistent number of neighbors for every node. This helps reduce computational overhead while preserving the overall graph structure. For a given central node \(i\) with current embedding \(h_{i}^{t}\) the message passing the update rule to transform it into \(h_{i}^{t+1}\) is as follows:  
\[h_{i}^{t+1}=W_{dst}\cdot h_{i}^{t}+W_{src}\cdot AGG\Big{\{}h_{j}^{t},\forall jN (i)\Big{\}} \tag{5}\]  
The aggregated representations are then combined with the current node embeddings to create a new embedding that captures both local and global graph information. The new embeddings are computed with \(W_{dst}\) and \(W_{src}\) learned by neural networks. After sampling the neighbors, the information from the selected neighbors is aggregated to create a summary representation for each node. This aggregation step is typically performed using an aggregation function such as mean for example. \[AGG\Big{\{}h_{j}^{t},\forall jN(i)\Big{\}}=\frac{1}{N(i)}\sum_{jN(i)}\Big{(}h_ {j}^{t}\Big{)} \tag{6}\]  
The entire process of neighbor sampling, aggregation, and updating node embeddings is performed in multiple iterations, also known as training epochs. During training, GraphSAGE aims to minimize a loss function assessing the quality of the learned node embeddings. Our problem is to perform unsupervised learning to update the embeddings. Indeed, the idea here is to update node embeddings using only the structure of the graph and the characteristics of the nodes, without using any known class labels for the nodes. The main goal is to do clustering with the new embeddings to detect communities in the graph. Unsupervised GraphSAGE is adapted to updating node embeddings through the resolution of a classification task [46]. For this, \"positive\" pairs of nodes are produced by conducting random walks on the graph (Figure 4 [29]). Another equal set of \"negative\" node pairs is randomly chosen from the graph based on a distribution linked to the average degree of connection in the graph. By mastering the straightforward binary classification task of node pairs, the model naturally develops an inductive mapping that converts node attributes and their neighboring nodes into node embeddings in a high-dimensional vector space. This mapping efficiently preserves the structural and feature similarities among the nodes. Unlike embeddings generated by algorithms such as Node2 Vec [47], this mapping is inductive in nature. This means that when presented with a new node (accompanied by its attributes) and its connections to other nodes in an unseen graph (absent during model training), we can readily evaluate its embeddings without the need for retraining the model. Figure 4: Illustration and explanation of GraphSAGE. Thus, the embeddings reflect not only node data, but also their relationships with their peers. The resulting node embeddings are then subjected to a conventional unsupervised learning algorithm to determine clusters accordingly. We present the product groups obtained using the k-means algorithm [48]. The k-means algorithm is a data partitioning technique that categorizes data logs into k clusters.