# SpaPool: Soft Partition Assignment Pooling for Graph Neural Networks

Rodrigue Govan, Romane Scherrer, Philippe Fournier-Viger, Nazha Selmaoui-Folcher

► To cite this version:

Rodrigue Govan, Romane Scherrer, Philippe Fournier-Viger, Nazha Selmaoui-Folcher. SpaPool: Soft Partition Assignment Pooling for Graph Neural Networks. International Conference on Big Data Analytics and Knowledge Discovery, Aug 2025, Bangkok, Thailand. pp.332-340, 10.1007/978-3-032-02215-8_27. hal-05250950v2

HAL Id: hal-05250950

https://hal.science/hal-05250950v2

Submitted on 19 Sep 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# SPAPOOL: Soft Partition Assignment Pooling for Graph Neural Networks

Rodrigue Govan<fnref n="1" />[0000-0002-4087-7056], Romane Scherrer<fnref n="1" />[0000-0002-3020-6427],
Philippe Fournier-Viger<fnref n="2" />[0000-0002-7680-9899], and Nazha
Selmaoui-Folcher<fnref n="1" />[0000-0003-1667-3819]

**Abstract.** In deep learning, graph neural networks (GNNs) are powerful tools for processing complex, massive, and unstructured data represented as large graphs. These graphs often feature interdependent entities, making GNNs particularly well-suited for analyzing such data. However, the large number of nodes can present significant computational challenges, making efficient processing difficult. To address this, several pooling methods have been proposed to reduce the size of graphs efficiently. These methods fall into two categories: dense and sparse. Dense pooling methods group nodes into a fixed number of clusters, predetermined by the user. While this ensures a smaller graph size, it may not always be efficient, particularly with heterogeneous datasets. Sparse pooling methods, on the other hand, select an adaptive number of significant nodes based on an importance score, removing non-significant nodes. This adaptive approach allows for a more dynamic reduction of the graph, focusing on the most relevant nodes. However, it can sometimes overlook the local and global structure of the input graph. We introduce SPAPOOL, a novel pooling method that combines the strengths of both dense and sparse techniques. SPAPOOL groups nodes into an adaptive number of clusters, leveraging the benefits of both approaches. It aims to maintain the structural integrity of the graph while reducing its size efficiently. Our experimental results on several datasets demonstrate that SPAPOOL achieves competitive performance compared to existing pooling techniques and excels particularly on small-scale graphs. This makes SPAPOOL a promising method for applications requiring efficient and effective graph processing.

**Keywords:** attributed graphs · neural networks · graph pooling.

## 1 Introduction

Over the past few years, the advent of graph neural networks (GNNs) [17] has seen significant growth. In opposite to standard deep learning methods such as

<footnote n="1">¹ Institute of Exact and Applied Sciences (EA7484), University of New Caledonia
BP R4, F-98851 Nouméa, New Caledonia
rodrigue.govan@gmail.com, nazha.selmaoui@unc.nc</footnote>

<footnote n="2">² Big Data Institute, College of Computer Science and Software Engineering
Shenzhen University, China
philfv@szu.edu.cn</footnote>
recurrent neural networks (RNNs) and convolutional neural networks (CNNs) [5] which require data structured as a table or a grid (e.g. pixels of an image), GNNs offer a wider flexibility to process unstructured data. This flexibility makes GNNs particularly well-suited to various fields, such as biology, chemistry, economy and epidemiology, where instances from a dataset are not always independent. These instances are characterized by attributes that are usually correlated with neighboring attributes, forming an important topological space that must be considered within a network with interdependent entities.

Graphs constitute a suited tool for modeling complex data. However, processing high-dimensional graphs presents major challenges in terms of computational efficiency and preserving relevant structural information. To address these challenges, pooling methods such as DIFFPOOL [19] and TOPKPOOL [2,3] have been proposed, aiming to reduce the size of graphs while preserving most essential information. These pooling methods extract a subset of representative nodes, allowing the reduction of graphs without ignoring their informative structure.

Despite their achievements, these traditional approaches present a number of limitations when applied to heterogeneous graphs, which are characterized by strong variability in terms of size and topology. Most existing pooling methods rely on two distinct approaches: they either group graph nodes into a fixed number of clusters (also called supernodes) or select an adaptive fraction of nodes based on an importance score with the remaining nodes being deleted. In the first approach, node clustering allows the preservation of structural information from the input graph. However, this clustering is based on a number of supernodes specified by the user, which can result in an output graph larger than the input graph, particularly in datasets where the number of nodes per graph is highly heterogeneous. In the second approach, the user must set a fraction $k \in (0, 1]$ prior to the GNN training. This fraction $k$ represents the proportion of graph nodes to preserve for the pooled graph. Therefore, graph nodes are assessed according to an importance score, and $[kN]$ most important nodes are retained ($N$ being the number of nodes in the input graph). The remaining nodes are thus deleted. This approach enables the reduction of each graph to be adapted according to its number of nodes. Nevertheless, by deleting a subset of non-significant nodes, some structural information from the input graph may be lost.

In order to overcome these limitations, this paper proposes SPAPOOL (Soft Partition Assignment Pooling), a new pooling method that combines the advantages of existing pooling approaches. SPAPOOL relies on a node clustering with an adaptive number of nodes determined according to the specific characteristics of each graph.

The article is organized as follows. In the next section, a state of the art on graph neural networks and pooling methods is detailed. The section 3 describes in detail the proposed SPAPOOL method. The section 4 details the applied methodology in order to test SPAPOOL method and to compare it with existing pooling methods. The section 5 presents experimental results obtained from several graph datasets, notably including a comparison with existing methods, but
also with an ablation study that determines the effect of each SPAPool component. Finally, in the last section, a conclusion is drawn and some perspectives are discussed.

## 2 Related Work

Let $G = (V, E, X)$ be an attributed graph such that:

- $V = \{v_1, \dots, v_N\}$ is the set of $N$ nodes;

- $E \subseteq \{(v_i, v_j) \in V^2 \mid \forall i, j \in \{1, \dots, N\} \wedge i \neq j\}$ is the set of $|E|$ edges;

- $X = \{x_i \in \mathbb{R}^F \mid \forall i \in \{1, \dots, N\}\}$ is the attribute matrix where $x_i$ represents the vector of $F$ attributes associated to node $v_i$.

The adjacency matrix $A \in \mathbb{R}^{N \times N}$ is defined such that $A_{i,j} \neq 0$ if and only if $(v_i, v_j) \in E, \forall i, j$.

### 2.1 Graph convolution

To our knowledge, the first formal graph convolutional network (GCN) was proposed at the end of the last decade [7]. This model aimed to apply deep learning directly to graph-structured data, rather than transforming these graphs into tabular data, which could lead to a loss of information about the relationships between entities. Inspired by the first order Laplacian method, the layer-wise propagation rule of a GCN is defined by:

$$H^{(\ell+1)} = \sigma \left( \tilde{D}^{-\frac{1}{2}} \tilde{A} \tilde{D}^{-\frac{1}{2}} H^{(\ell)} W^{(\ell)} \right) \quad (1)$$

where $\tilde{A} = A + I_N$ is the adjacency matrix with self-loops added using the identity matrix $I_N$, $H^{(\ell)}$ is the node embedding matrix at layer $\ell$, and $W^{(\ell)}$ is a trainable weight matrix that applies a linear transformation on the node embedding matrix. Defined in $\{0, 1\}^{N \times N}$, the identity matrix $I_N$ is described as a diagonal matrix where all diagonal elements are 1 and all off-diagonal elements are 0. The diagonal degree matrix $\tilde{D}$ is defined such that $\tilde{D}_{i,i} = \sum_{j=1}^{N} \tilde{A}_{i,j}$. The function $\sigma(\cdot)$ is an activation function such as ReLU($\cdot$) = max(0,·). Initially (i.e., $\ell = 0$), we have $H^{(0)} = X$. Moreover, at layer $\ell > 0$, we are not referring to the node attribute matrix with the matrix $X$ anymore, but rather to the node embedding matrix with the matrix $H$. This distinction is important since the input graph is processed through different layers of a GNN, therefore we do not have attributes describing nodes but embeddings. Over the past few years, numerous GNN models have appeared. Among them, GRAPHSAGE [4] integrates a sampling mechanism in order to generate node embeddings by iteratively aggregating information from adjacent nodes. GRAPHSAGE is defined by:

$$h_i^{(\ell+1)} = \sigma(W^{(\ell)} \cdot \text{AGG}(\{h_j^{(\ell)}, \forall j \in \mathcal{N}(i)\})) \quad (2)$$
where $h_i^{(\ell)}$ represents embeddings of node $v_i$ at layer $\ell$, $\mathcal{N}(i)$ is the set of adjacent nodes to node $v_i$, $W^{(\ell)}$ is a trainable weight matrix, and AGG is an aggregation function such as the average, the sum, and the maximum. Instead of aggregating information from every adjacent nodes simultaneously, GRAPHSAGE aggregates a subset of nodes fixed by the user, reducing the computational complexity and optimizing the modularity for processing high-dimensional graphs. Another GNN model is the “graph attention network” (GAT) [16] that integrates an attention mechanism assigning different weight to adjacent nodes based on a calculated importance score function. The GAT is defined by:

$$h_i^{(\ell+1)} = \sigma \left( \sum_{j \in \mathcal{N}(i)} \alpha_{i,j}^{(\ell)} W^{(\ell)} h_j^{(\ell)} \right) \quad (3)$$

where $\sigma$ is an activation function such as ReLU, and $\alpha_{i,j}^{(\ell)}$ is the attention factor computed using the attention mechanism defined by:

$$\alpha_{i,j}^{(\ell)} = \frac{\exp\left(\sigma\left(w^{\top}\left[W^{(\ell)}h_i^{(\ell)} \parallel W^{(\ell)}h_j^{(\ell)}\right]\right)\right)}{\sum_{j \in \mathcal{N}(i)} \exp\left(\sigma\left(w^{\top}\left[W^{(\ell)}h_i^{(\ell)} \parallel W^{(\ell)}h_j^{(\ell)}\right]\right)\right)} \quad (4)$$

where $w$ is a trainable weight vector, $\parallel$ represents the concatenation operator, and $\sigma$ is an activation function. In this case, the activation function is LeakyReLU(·) = max(0,·) + $\beta \times \min(0,·)$ with $\beta$ a parameter defined by the user that corresponds to the negative slope. Contrary to the GCN that considers all adjacent nodes with the same importance, the GAT emphasizes on the most important adjacent nodes, which can improve performance in the case where some relationships are more important than others [11]. More recently, a model named “graph isomorphism network” (GIN) [18] has been proposed, employing an injective aggregation function in order to capture a richer structural information. The GIN model is defined by:

$$h_i^{(\ell+1)} = \text{MLP} \left( (1 + \epsilon) h_i^{(\ell)} + \sum_{j \in \mathcal{N}(i)} h_j^{(\ell)} \right) \quad (5)$$

where $\epsilon$ is a trainable parameter allowing to control the importance of embeddings from the node itself compared to adjacent node embeddings. This model was designed to be as efficient as the Weisfeiler-Lehman test [6], which enables the distinction of isomorphic graphs from those that are not isomorphic.

All these GNNs have been developed in order to process graph-structured data. They are focused on three main tasks: the node prediction, which aims to predict the label of certain nodes within a unique graph; the edge prediction, which consists of determining the existence of an edge (or a relationship) between nodes from a unique graph, and the graph prediction, which consists of predicting the label of an entire graph based on its attributes. While GNNs have been
developed for numerous tasks such as the graph matching task [9] to compute a similarity score between two graphs, this paper focuses on graph classification task. However, in numerous applications, graph sizes can be very large, making their processing complex, if not impossible. Therefore, it becomes essential to reduce their size while preserving the most relevant information during a GNN training.

## 2.2 Graph pooling

In graph neural networks, implementing a pooling operator is more complex than in CNNs or RNNs as the data are not structured as a grid or a table, but rather as a connected network, with irregular dependencies and heterogeneous relationships between entities. Therefore, defining a local region (or a neighborhood) for the pooling constitutes a real challenge. In the literature, there exist two pooling approaches: the hierarchical pooling which consists of reducing the input graph into a smaller graph, and the global pooling which reduces the input graph into a single node. This paper focuses on hierarchical pooling methods for their ability to maintain the topological graph structure, and we particularly focus on trainable pooling methods as they were specifically designed for GNNs.

In graph neural networks, the pooling process involves three steps:

1. The selection of significant nodes by defining an operator $S$. The operator can be a matrix or a vector. In the case of a matrix, it is usually a sparse assignment matrix since $S$ allows to determine supernodes (i.e., centroids of node groups). This selection step is crucial in the pooling process in order to optimally reduce the input graph;

2. The reduction of the node embedding matrix $H$ by using the operator $S$;

3. The connection step which involves the readjustment of the adjacency matrix $A$ in order to maintain consistency with the node embedding matrix $H$.

Among hierarchical trainable methods, pooling approaches can be divided into dense and sparse techniques. Dense methods aim to group subsets of nodes into a fixed number of supernodes whose cardinality is $O(N)$. These supernodes represent an aggregation of both local and global information. For instance, DIFFPOOL [19] realizes a hierarchical clustering and adjust the node clustering into supernodes during the GNN training. DIFFPOOL defines its matrix $S$ such that:

$$S_{\text{DIFFPOOL}} = \text{Softmax} \left( \text{GCN} \left( A^{(\ell)}, H^{(\ell)} \right) \right) \quad (6)$$

In addition to the operator $S$, DIFFPOOL also includes an auxiliary loss function in order to consider $S$ during the GNN training. Therefore, the auxiliary loss function in DIFFPOOL is defined by:

$$\mathcal{L}_{\text{DIFFPOOL}} = \mathcal{L}_{\text{LP}} + \mathcal{L}_{\text{E}} \quad (7)$$

$$\mathcal{L}_{\text{LP}} = \| A^{(\ell)}, SS^{\top} \|_{F}$$

$$\mathcal{L}_{\text{E}} = \frac{1}{N} \sum_{i=1}^{N} E(S_{i})$$
where $\|\cdot\|_F$ corresponds to the Frobenius norm, and $E(\cdot)$ is the entropy function.

Although DIFFPOOL is efficient to capture global structure from graphs, its computational complexity may lead to an overfitting in the case where the number of supernodes is not well calibrated.

Inspired by the minimum cut, MINCUT [1] is another dense method that groups nodes into supernodes by minimizing the number of inter-cluster connections while maximizing the intra-cluster connections. This method captures structural information while preventing the over-grouping of uncorrelated nodes that can be produced by DIFFPOOL. MINCUT defines its matrix $S$ such that:

$$S_{\text{MINCUT}} = \text{MLP}(H^{(\ell)}) \qquad (8)$$

Similarly to DIFFPOOL, MINCUT also considers an auxiliary loss function. This latter is defined by:

$$\mathcal{L}_{\text{MINCUT}} = -\underbrace{\frac{\text{Tr}(S^{\top}\tilde{A}S)}{\text{Tr}(S^{\top}\tilde{D}S)}}_{\mathcal{L}_c} + \underbrace{\left\| \frac{S^{\top}S}{\|S^{\top}S\|_F} - \frac{I_C}{\sqrt{C}} \right\|_F}_{\mathcal{L}_o} \qquad (9)$$

where $C$ is a user-set parameter representing the number of supernodes in the output graph.

Through this auxiliary loss function, MINCUT aims to group highly connected nodes while ensuring that supernodes are orthogonal and of similar size.

DMON [15] is another dense pooling method based on the information distribution throughout the input graph and its modularity. Despite its operator $S$ defined as in DIFFPOOL (Equation 6), DMON integrates an auxiliary loss function that differs from the one in DIFFPOOL. The auxiliary loss function in DMON is therefore defined by:

$$\mathcal{L}_{\text{DMON}} = -\frac{1}{2 \times |E|} \text{Tr}(S^{\top} BS) + \frac{\sqrt{C}}{N} \left\| \sum_{i} S_{i}^{\top} \right\|_{F} - 1 \qquad (10)$$

where $B = A - \frac{dd^T}{2 \times |E|}$ with $d$ the node degree vector, and $C$ the number of supernodes following the pooling layer. While the loss function in DIFFPOOL aims to group nodes with similar attributes while regularizing the node clustering entropy, the auxiliary loss function in DMON aims to maximize the modularity of graphs. Therefore, DMON groups nodes according to their proximity in terms of attribute distributions, which allows to efficiently capture structural relationships in very large graphs. This pooling method stands out from other pooling methods for its robustness in the case of complex and heterogeneous graphs.

We note that for these three dense pooling methods, their auxiliary loss function is respectively added to the classification loss function. In this case, it is the cross-entropy function, defined by:

$$\mathcal{L}_{\text{CE}} = - \sum_{i=1}^{N} y_i \log(\hat{y}_i) \qquad (11)$$
where $y_i$ is the observed class of graph $i$, and $\hat{y}_i$ is the predicted probability of class $y_i$ of graph $i$.

Contrary to dense pooling methods, sparse pooling methods directly select a subset of nodes from the input graph based on criteria such as an importance score, which produces supernodes whose cardinality is $O(1)$. To do so, one has to set a ratio $k \in (0, 1]$ indicating the proportion of nodes to retain. These approaches explicitly reduce the dimension of a graph by removing non significant nodes while preserving its local structure. Among these methods, TopKPool [2,3] stands out: it computes dynamically an importance score during the GNN training, preserving only nodes that have the highest score. TopKPool defines its operator $S$ which is a vector such that :

$$S_{\text{TopKPool}} = \frac{H^{(\ell)} p}{\|p\|_2} \qquad (12)$$

where $p \in \mathbb{R}^F$ is a trainable weight vector.

Nodes and edges that are retained aggregate the information. The advantage of this approach is to simplify the input graph while dynamically adapting the most relevant node selection. However, TopKPool may omit certain crucial information from the global structure of the input graph. SAGPool [8] is another sparse pooling method, which employs a self-attention mechanism to calculate an importance score for each node within the input graph. Therefore, it defines its matrix $S$ such that:

$$S_{\text{SAGPool}} = \text{GCN}(A^{(\ell)}, H^{(\ell)}) \qquad (13)$$

Similarly to the GIN model [18], the self-attention enables the model to focus on most relevant nodes given their context within the graph. The SAGPool method has this ability to be adaptable to different GNN architectures since it can be used with various convolution layers to compute importance scores. While SAGPool focuses on most relevant nodes, another sparse pooling method named ASAPool [14], focuses on the graph structure to conduct the pooling process. This enables the preservation of structural information from the input graph. Moreover, ASAPool employs the GNN training to compute the importance score of each node. This score is not only based on the node attributes, but also on their context within the graph.

Once importance scores are computed, the majority of sparse pooling methods proceed in the same manner to determine which nodes to retain [10], which is by selecting $\lceil kN \rceil$ nodes with the highest computed scores in $S_{\text{SAGPool}}$ and by removing rows (and columns) from the adjacency matrix that are associated to nodes that are not selected.

## 3 SPAPOOL: A Dense but Adaptive Pooling Approach

In this article, we propose SPAPOOL (Soft Partition Assignment Pooling), a graph pooling approach which combines node selection and association techniques to maximize the retained information during the graph reduction step
(Figure 1). With SPAPOOL, we aim to combine the benefits of dense and sparse methods simultaneously. From dense methods, SPAPOOL consists of grouping nodes into clusters (supernodes) in order to maintain local and global structures from the input graph contrary to existing sparse methods. From sparse methods, SPAPOOL consists of evaluating each node in order to select an adaptive ratio of nodes that will represent the supernodes.

<figure><img src="image_2.png" /><figcaption>Fig. 1. Illustration of the proposed graph pooling method (SPAPOOL).</figcaption></figure>

**Select.** To define our operator $S$, we first proceeded with several steps as follows.

Given a layer $\ell$, the attributed graph can be represented by two matrices: the adjacency matrix $A^{(\ell)} \in \mathbb{R}^{N \times N}$ and the node embedding matrix $H^{(\ell)} \in \mathbb{R}^{N \times F}$. Each non-zero cell in the adjacency matrix represents that two nodes in the graph are adjacent. Each vector in row $h_i^{(\ell)}$ in the node embedding matrix denotes embeddings of node $v_i$ in the graph. The layer-wise process of SPAPOOL at layer $\ell$ proceeds as follows:

$$ 
\begin{aligned}
H_{\text{emb}}^{(\ell)} &= \text{GCN}(A^{(\ell)}, H^{(\ell)}) \\
H_{\text{rep}}^{(\ell)}, H_{\text{scores}}^{(\ell)} &= \text{TopKPool}(H_{\text{emb}}^{(\ell)}, k) \quad \text{with } k = 0.5 \\
H_{\text{centroids}}^{(\ell)} &= H_{\text{rep}}^{(\ell)} H_{\text{scores}} \\
S &= \text{Softmax} \left( \frac{H_{\text{emb}}^{(\ell)}}{\|H_{\text{emb}}^{(\ell)}\|_2}, \left( \frac{H_{\text{centroids}}^{(\ell)}}{\|H_{\text{centroids}}^{(\ell)}\|_2} \right)^{\top} \right) \quad (14)
\end{aligned}
$$

At the end, the operator $S$ defined in SPAPOOL (Equation 14) is a Softmax function applied on the cosine similarity between the representative nodes and the node embeddings obtained from the GCN layer.
**Reduce.** In the reduction step, we readjust the attribute matrix as in existing pooling methods [1,13] which is defined by:

$$H^{(\ell+1)} = S^{\top} H^{(\ell)} \qquad (15)$$

**Connect.** Finally, as in the reduction step, we set the connection step on adjacency matrix as in existing pooling methods [1,13,19] which is defined by:

$$A^{(\ell+1)} = S^{\top} A^{(\ell)} S \qquad (16)$$

**Auxiliary loss.** As SPAPool is based on a dense approach (i.e., grouping nodes into supernodes), we considered an auxiliary loss function that we added into the classification loss function, i.e., the cross-entropy function (Equation 11). Because we group nodes into supernodes, it can become difficult for our pooling method to avoid local minima issues. Therefore, in the classification loss function, we added the same auxiliary losses used in DIFFPOOL [19] that we recall as:

$$\mathcal{L}_{LP} = \|A^{(\ell)}, SS^{\top}\|_{F} \quad \text{and} \quad \mathcal{L}_{E} = \frac{1}{N} \sum_{i=1}^{N} H(S_{i})$$

where $\|\cdot\|_{F}$ denotes the Frobenius norm and $H(\cdot)$ is the entropy function.

# 4 Methodology

In this methodology section, we are detailing the applied process in order to test SPAPool and compare it with existing pooling methods. This methodology notably includes the creation of a GNN model where the pooling layer is solely modified to conduct different tests. Then, we will present datasets used to experiment SPAPool and existing pooling methods.

## 4.1 Graph Neural Network

In this section, we define the graph neural network to compare SPAPool with other pooling approaches from the literature. To do so, we designed a unique graph neural network model in order to evaluate the impact of the pooling layer solely. The GNN is composed of two MLP blocks and two GCN blocks as illustrated in the Figure 2. Only one layer concern the pooling layer which allows us to switch SPAPool with existing pooling methods.

## 4.2 Datasets

For each dataset (Table 1), it has been randomly divided into a training, validation and test sets representing 80%, 10%, and 10% of the dataset, respectively. All models were trained, evaluated, and tested over the same sets in order to obtain
<figure><img src="image_3.png" /><figcaption>Fig. 2. Graph Neural Network model used in the experiments.</figcaption></figure>

consistent and reproducible results. The training hyper-parameters that were used are the following: a batch size of 64 graphs, a learning rate of $\eta = 5 \times 10^{-4}$, a pooling ratio of $k = 0.5$, an optimization via the stochastic gradient descent (SGD), and a maximum number of 500 epochs with an early stopping set at 100 epochs. The loss function used for the classification task is the cross-entropy function (Equation 11). All experiments were conducted using Python 3.8 with PyTorch 1.13.1 and PyTorch-Geometric 2.6.1 libraries.

<table><caption>Table 1. Summary of datasets [12] used in our graph classification experiments.</caption><thead><tr><th>Dataset</th><th>Graphs</th><th>Nodes (avg)</th><th>Edges (avg)</th><th>Attributes</th><th>Classes</th></tr></thead><tbody><tr><td>PROTEINS</td><td>1,113</td><td>39.06±45.76</td><td>72.82±84.6</td><td>4</td><td>2</td></tr><tr><td>ENZYMES</td><td>600</td><td>32.63±15.28</td><td>62.14±25.5</td><td>21</td><td>6</td></tr><tr><td>DD</td><td>1,178</td><td>284.32±272</td><td>715.66±693.91</td><td>89</td><td>2</td></tr><tr><td>Mutagenicity</td><td>4,337</td><td>30.32±20.12</td><td>30.77±16.82</td><td>14</td><td>2</td></tr><tr><td>github_stargazers</td><td>12,725</td><td>113.79±164</td><td>234.64±427.23</td><td>1</td><td>2</td></tr><tr><td>reddit_threads</td><td>203,088</td><td>23.93±16.55</td><td>24.85±19.14</td><td>1</td><td>2</td></tr><tr><td>OHSU</td><td>79</td><td>82.01±43.44</td><td>199.66±165.08</td><td>190</td><td>2</td></tr><tr><td>twitch_egos</td><td>127,094</td><td>29.67±11.1</td><td>86.59±70.37</td><td>1</td><td>2</td></tr><tr><td>COLLAB</td><td>5,000</td><td>74.49±62.3</td><td>2457.22±6438.92</td><td>1</td><td>3</td></tr><tr><td>IMDB-BINARY</td><td>1,000</td><td>19.77±10.06</td><td>96.53±105.6</td><td>1</td><td>2</td></tr></tbody></table>

These datasets were chosen for their variety in terms of number of graphs, nodes, attributes and classes.

## 5 Results

In this section, we present the results obtained from tested datasets (Table 1) as well as an ablation study of SPAPOOL components. An ablation study consists of assessing the contribution of each component within the proposed method in the prediction performance. This type of study is commonly used, particularly for a GNN pooling in which the pooling method is characterized by a sequence of graph processing [2,3,14].
## 5.1 Performance Comparison

To experiment SPAPool on the datasets (Table 1) mentioned in the previous section, we trained a GNN model (Figure 2) ten times, with ten different random split (train, validation, test) in order to obtain different accuracy results. All experiments were conducted on a high-performance computing in which we limited each training on one NVIDIA Tesla V100 GPU with 32GB of dedicated memory. The Table 2 reports the average and standard deviation of the graph classification accuracy on the test set.

<table><caption>**Table 2.** Accuracies on the graph classification experiments.</caption><thead><tr><th>Dataset</th><th>TOPKPOOL</th><th>ASAPool</th><th>SAGPool</th><th>SPAPool</th></tr></thead><tbody><tr><td>PROTEINS</td><td>68.21±11.31</td><td><strong>71.51</strong>±8.88</td><td>70.62±9.52</td><td>71.24±7.53</td></tr><tr><td>ENZYMES</td><td>62.50±4.84</td><td>65.62±3.76</td><td>55.36±5.93</td><td><strong>68.29</strong>±5.31</td></tr><tr><td>DD</td><td>74.57±5.27</td><td>76.01±3.88</td><td><strong>77.03</strong>±4.03</td><td>72.46±0.45</td></tr><tr><td>Mutagenicity</td><td>75.04±3.23</td><td>76.10±1.83</td><td>75.36±3.91</td><td><strong>76.58</strong>±1.91</td></tr><tr><td>github_stargazers</td><td>65.32±1.63</td><td><strong>67.8</strong>±1.28</td><td>67.26±2.07</td><td>64.83±3.58</td></tr><tr><td>reddit_threads</td><td>75.82±1.63</td><td><strong>77.09</strong>±0.53</td><td>76.67±1.03</td><td>76.09±0.8</td></tr><tr><td>OHSU</td><td>61.25±17.18</td><td>55±18.71</td><td><strong>62.5</strong>±14.79</td><td>53.75±20.19</td></tr><tr><td>twitch_egos</td><td>66.98±2.75</td><td>69.68±0.8</td><td><strong>70.03</strong>±0.41</td><td>68.56±1.45</td></tr><tr><td>COLLAB</td><td>66.26±3.5</td><td>67.07±3.5</td><td><strong>68.39</strong>±2.92</td><td>54.53±2.13</td></tr><tr><td>IMDB-BINARY</td><td>64.1±4.99</td><td>68.7±3.29</td><td><strong>69.1</strong>±4.55</td><td>55.9±3.56</td></tr></tbody></table>

Although our SPAPool method outperformed existing methods in 2 out of the 10 datasets tested, we still achieved equivalent results with minimal variability across ten training sessions. The only strong variability observed in all tested pooling methods was with OHSU dataset, which is the smallest dataset (Table 1) in our tests with only 79 graphs in the dataset.

If we look more closely at the results, as SPAPool is based on the TOPKPOOL method to score graph nodes, our pooling method outperformed in 5 out of the 10 tested datasets. More specifically, SPAPool obtained better results than TOPKPOOL in datasets where graphs are smaller (i.e., around 30 nodes per graph in average). This difference is notably due to the fact that TOPKPOOL removed non-significant nodes during the pooling process, while SPAPool grouped nodes into supernodes. This grouping indeed preserved the information of the grouped nodes, while TOPKPOOL removed that information. In datasets where there is a very small number of nodes per graph, those nodes become essential for understanding the graph. Therefore, using a sparse pooling method that removes nodes such as TOPKPOOL may be less effective than using a dense method that groups nodes.

In the next subsections, we provide an ablation study of the different components of SPAPool. The ablation study consists of examining the contribution of each component within the proposed method to prediction performance. In this case, we assessed the contribution of the node selection component (i.e., TOP-
KPOOL), the node aggregation (i.e., the cosine similarity), and the loss function used.

## 5.2 Effect of node selection

Following the graph classification performance, we assessed the importance of the node selection method in SPAPOOL by comparing TOPKPOOL and SAGPOOL. SAGPOOL employs a GCN layer (Equation 1) on the node embedding matrix prior to the significant node identification while TOPKPOOL multiplies the node embedding matrix by a normalized weight vector.

<table><caption>**Table 3.** Graph classification accuracies according to node selection methods.</caption><thead><tr><th>Dataset</th><th>TOPKPOOL</th><th>SAGPOOL</th></tr></thead><tbody><tr><td>PROTEINS</td><td><b>71.24</b><sub>±7.53</sub></td><td>68.21<sub>±12.24</sub></td></tr><tr><td>ENZYMES</td><td><b>68.29</b><sub>±5.31</sub></td><td>66.25<sub>±4.96</sub></td></tr><tr><td>Mutagenicity</td><td>76.58<sub>±1.91</sub></td><td><b>77.72</b><sub>±1.91</sub></td></tr><tr><td>OHSU</td><td><b>53.75</b><sub>±20.19</sub></td><td>51.25<sub>±18.92</sub></td></tr><tr><td>IMDB-BINARY</td><td><b>55.9</b><sub>±3.56</sub></td><td>55.7<sub>±3.61</sub></td></tr></tbody></table>

As shown in Table 3, the use of TOPKPOOL appeared to optimize performance compared to SAGPOOL, as the latter decreased accuracies in the tested datasets.

## 5.3 Effect of node aggregation

In our ablation study, we further assessed the importance of the node aggregation method by comparing the retained method (cosine similarity), the scalar product, and the attention mechanism.

In our tests, the scalar product is defined as:

$$A_{H}^{(\ell)} = \mathrm{Softmax} \left( H^{(\ell)} H_{\mathrm{rep}}^{(\ell)^{\top}} \right)$$

At layer $\ell$, the attention mechanism is defined as:

$$H_{q}^{(\ell)} = \mathrm{MLP} \left( H^{(\ell)} \right)$$

$$H_{k}^{(\ell)} = \mathrm{MLP} \left( H_{\mathrm{rep}}^{(\ell)} \right)$$

$$A_{H}^{(\ell)} = \mathrm{Softmax} \left( \frac{1}{\sqrt{\alpha}} H_{q}^{(\ell)} H_{k}^{(\ell)^{\top}} \right)$$

where we set $\alpha = 16$, $H_q^{(\ell)} \in \mathbb{R}^{N \times \alpha}$, and $H_k^{(\ell)} \in \mathbb{R}^{N \times \alpha}$.

In most of the experimented datasets (Table 4), the cosine similarity outperformed both the scalar product and the attention mechanism. Moreover, the cosine similarity resulted in lower variability compared to the two other aggregation methods.
<table><caption>**Table 4.** Graph classification accuracies according to the node aggregation method.</caption><thead><tr><th>Dataset</th><th>COSINE</th><th>SCALAR</th><th>ATTENTION</th></tr></thead><tbody><tr><td>PROTEINS</td><td><b>71.24</b><sup>±7.53</sup></td><td>71.07<sup>±9.78</sup></td><td>66.16<sup>±12.26</sup></td></tr><tr><td>ENZYMES</td><td>68.29<sup>±5.31</sup></td><td><b>69.64</b><sup>±6.99</sup></td><td>69.09<sup>±5.98</sup></td></tr><tr><td>Mutagenicity</td><td>76.58<sup>±1.91</sup></td><td>77.35<sup>±1.89</sup></td><td><b>77.6</b><sup>±2.2</sup></td></tr><tr><td>OHSU</td><td><b>53.75</b><sup>±20.19</sup></td><td>47.50<sup>±20.77</sup></td><td>43.75<sup>±21.1</sup></td></tr><tr><td>IMDB-BINARY</td><td><b>55.9</b><sup>±3.56</sup></td><td>55.70<sup>±4.15</sup></td><td>54.10<sup>±3.33</sup></td></tr></tbody></table>

## 5.4 Effect of the auxiliary loss function

Finally, in our ablation study, we assessed the auxiliary loss function. While SPA-POOL employs the auxiliary loss function from DIFFPOOL (Equation 7), we also tested auxiliary loss functions from DMON (Equation 10) and MINCUT (Equation 9). As MINCUT is a dense pooling method, the constant $C$ in $\mathcal{L}_{MINCUT}$ is the number of supernodes defined by the user to obtain in the pooling output graph. As SPAPOOL is an adaptive pooling method, we modified $\mathcal{L}_o$ from Equation 9 as:

$$ \mathcal{L}_o = \frac{1}{N} \sum_{i=1}^{N} \left\| \frac{S_i^\top S_i}{\|S_i^\top S_i\|} - \frac{I_{k_i}}{\sqrt{k_i}} \right\| \quad (17) $$

where $k_i$ is the number of supernodes in the graph $i$. The same modification was applied regarding the auxiliary loss function in DMON (Equation 10).

<table><caption>**Table 5.** Graph classification accuracies according to the auxiliary loss function.</caption><thead><tr><th>Dataset</th><th>LC<sub>DIFFPOOL</sub></th><th>LC<sub>DMON</sub></th><th>LC<sub>MINCUT</sub></th></tr></thead><tbody><tr><td>PROTEINS</td><td><b>71.24</b><sup>±7.53</sup></td><td>66.07<sup>±12.32</sup></td><td>68.75<sup>±10.68</sup></td></tr><tr><td>ENZYMES</td><td>68.29<sup>±5.31</sup></td><td>68.81<sup>±5.93</sup></td><td><b>70.82</b><sup>±5.39</sup></td></tr><tr><td>Mutagenicity</td><td>76.58<sup>±1.91</sup></td><td><b>78.34</b><sup>±2.1</sup></td><td>76.8<sup>±1.79</sup></td></tr><tr><td>OHSU</td><td>53.75<sup>±20.19</sup></td><td><b>53.75</b><sup>±17.72</sup></td><td>52.5<sup>±18.37</sup></td></tr><tr><td>IMDB-BINARY</td><td>55.9<sup>±3.56</sup></td><td>54.5<sup>±3.38</sup></td><td><b>55.9</b><sup>±3.21</sup></td></tr></tbody></table>

In our SPAPOOL ablation study, the effect of the auxiliary loss function remains the least unanimous, as none of the tested auxiliary loss functions clearly outperformed the others in our datasets (Table 5). We experimented with SPAPOOL on several datasets that differ in terms of the number of graphs and the number of attributes. Determining a generic auxiliary loss function for any type of graph dataset remains a challenging task in graph neural networks.

## 6 Conclusion

While most pooling methods in GNNs are either dense and fixed or sparse and adaptive, this paper proposed a novel method named SPAPOOL, a dense yet adaptive pooling approach that leverages the benefits of both dense and sparse
methods. To do so, we detailed the process and experimented our pooling method
on 10 different datasets, and we compared it with existing methods. Although
SPAPOOL did not outperform existing methods in all datasets, it still managed
to obtain comparable results, which indicates a great potential for our method
to optimize the process. Additionally, our method obtained satisfying results in
datasets where graphs are small (i.e., an average of 30 nodes per graph) as it
grouped nodes into supernodes to preserve information, as well as the local and
global graph structure.

Next steps of our work will include adjustment in order to obtain satisfy-
ing results in large graphs, but also in attributed graphs with a large number
of attributes. Future works also include an explainability and an interpretabil-
ity components that will enable the understanding of which features from the
attributes are considered as important according to the trained GNN.

**Acknowledgments.** This work was funded by the French National Research Agency as part of the SPIraL program (grant number ANR-19-CE35-0006-02).

**Disclosure of Interests.** The authors declare that no competing interests exist.

References

1. Bianchi, F.M., Grattarola, D., Alippi, C.: Spectral clustering with graph neural networks for graph pooling. In: Proceedings of the 37th International Conference on Machine Learning. pp. 874–883. PMLR (2020)

2. Gao, H., Ji, S.: Graph u-nets. In: Proceedings of the 36th International Conference on Machine Learning. vol. 97, pp. 2083–2092. PMLR (2019)

3. Gao, H., Ji, S.: Graph u-nets. IEEE Transactions on Pattern Analysis and Machine Intelligence pp. 4948–4960 (2021). https://doi.org/10.1109/tpami.2021.3081010

4. Hamilton, W.L., Ying, R., Leskovec, J.: Inductive representation learning on large graphs. In: Proceedings of the 31st International Conference on Neural Information Processing Systems. pp. 1025–1035. NIPS (2017)

5. Hoffmann, J., Navarro, O., Kastner, F., Janßen, B., Hubner, M.: A survey on cnn and rnn implementations. In: Proceedings of the 7th International Conference on Performance, Safety and Robustness in Complex Systems and Applications. PESARO (2017)

6. Huang, N.T., Villar, S.: A short tutorial on the weisfeiler-lehman test and its variants. In: IEEE International Conference on Acoustics, Speech and Signal Processing. pp. 8533–8537. ICASSP (2021). https://doi.org/10.1109/ICASSP39728. 2021.9413523

7. Kipf, T.N., Welling, M.: Semi-supervised classification with graph convolutional networks. In: International Conference on Learning Representations. ICLR (2017)

8. Lee, J., Lee, I., Kang, J.: Self-attention graph pooling. In: Proceedings of the 36th International Conference on Machine Learning. pp. 3734–3743. PMLR (2019)

9. Li, Y., Gu, C., Dullien, T., Vinyals, O., Kohli, P.: Graph matching networks for learning the similarity of graph structured objects. In: Proceedings of the 36th International Conference on Machine Learning. pp. 3835–3845. PMLR (2019)
10. Liu, C., Zhan, Y., Li, C., Du, B., Wu, J., Hu, W., Liu, T., Tao, D.: Graph pooling for graph neural networks: Progress, challenges, and opportunities. arXiv preprint arXiv:2204.07321 (2022). https://doi.org/10.48550/arXiv.2204.07321

11. Luo, Y., Shi, L., Wu, X.M.: Classic GNNs are strong baselines: Reassessing GNNs for node classification. In: Proceedings of the 38th International Conference on Neural Information Processing Systems. NIPS (2024)

12. Morris, C., Kriege, N.M., Bause, F., Kersting, K., Mutzel, P., Neumann, M.: Tu-dataset: A collection of benchmark datasets for learning with graphs. In: ICML 2020 Workshop on Graph Representation Learning and Beyond (GRL+ 2020) (2020), www.graphlearning.io

13. Noutahi, E., Beaini, D., Horwood, J., Giguère, S., Tossou, P.: Towards in-terpretable sparse graph representation learning with laplacian pooling. arXiv preprint arXiv:1905.11577 (2019). https://doi.org/10.48550/arXiv.1905.11577

14. Ranjan, E., Sanyal, S., Talukdar, P.: Asap: Adaptive structure aware pooling for learning hierarchical graph representations. In: Proceedings of the 34th AAAI Con-ference on Artificial Intelligence. pp. 5470–5477. AAAI (2020). https://doi.org/10.1609/aaai.v34i04.5997

15. Tsitsulin, A., Palowitch, J., Perozzi, B., Müller, E.: Graph clustering with graph neural networks. Journal of Machine Learning Research 24 (127), 1–21 (2023)

16. Veličković, P., Cucurull, G., Casanova, A., Romero, A., Liò, P., Bengio, Y.: Graph attention networks. In: International Conference on Learning Representations (2018)

17. Wu, Z., Pan, S., Chen, F., Long, G., Zhang, C., Yu, P.S.: A comprehensive survey on graph neural networks. IEEE Transactions on Neural Networks and Learning Systems 32 (1), 4–24 (2021). https://doi.org/10.1109/tnnls.2020.2978386

18. Xu, K., Hu, W., Leskovec, J., Jegelka, S.: How powerful are graph neural networks? In: International Conference on Learning Representations. ICLR (2019)

19. Ying, Z., You, J., Morris, C., Ren, X., Hamilton, W., Leskovec, J.: Hierarchical graph representation learning with differentiable pooling. In: Proceedings of the 32nd International Conference on Neural Information Processing Systems. NIPS (2018)