# Learning Embedding for Signed Network in Social Media with Hierarchical Graph Pooling
## 4 Proposed Signed Network Embedding with Hierarchical Graph Pooling
### Local Signed Graph Convolution  
In general, most graph neural networks can be considered message-passing neural networks (MPNNs). The core of MPNNs is the definition of aggregation function and update function between nodes. To begin, the local structural expression of each node is obtained by applying the aggregation function to it and its neighboring nodes. Second, the current node's representation is updated using the update function and the local structural representation. The general expression of the MPNNs can be expressed as follows:  
\[m_{i}^{t+1}=\sum\
olimits_{j\in N_{(i)}}M_{t}\left(h_{j}^{t},e_{ij}\right),h_{ i}^{t+1}=U_{t}\left(h_{i}^{t}+m_{i}^{t+1}\right) \tag{1}\]  
where \(h_{i}^{t}\) denotes the hidden layer representation of node \(i\) at \(t\)-th steps, \(e_{ij}\) is the features of a given link, \(M_{t}\) represents the aggregate function at \(t\)-th steps, \(m_{i}^{t+1}\) means the local structure representation of node \(i\) after aggregating, and \(U_{t}\) stands for the update function. By designing appropriate sampling and aggregation functions, such as weighted aggregation or mean aggregation, the target node accepts the features passed from its own neighborhood nodes and completes an update of its own features through feature fusion of the local structure to obtain a new feature representation. A signed network is a specialized type of network that contains type information on its edges. It not only includes two types of connected edges (positive links and negative links) but also has special sociological properties such as structural balance. In particular, the fact that my enemy's enemy is my friend (a foe node two hops from the central node is a friend) makes it infeasible to define aggregation functions only based on edge type. As a result, we use two different GNN aggregators in this paper to aggregate different information from \(\hat{\mathcal{N}}_{i}^{+}\) and \(\hat{\mathcal{N}}_{i}^{-}\) In the first aggregation layer, given the initial feature \(h_{i}^{(0)}\) of node \(i\), we can generate the balanced embedding \(h_{p}^{\mathcal{B}(1)}\) and unbalanced embedding \(h_{n}^{\mathcal{H}(1)}\):  
\[h_{p}^{\mathcal{B}(1)}=\sigma\Big{(}\sum\
olimits_{j\in\hat{\mathcal{N}}_{i}^ {+}}\bar{F}_{agg}h_{i}^{(0)}h_{j}^{(0)},W^{\mathcal{B}(1)}\Big{)} \tag{2}\]  
\[h_{n}^{\mathcal{H}(1)}=\sigma\Big{(}\sum\
olimits_{j\in\hat{\mathcal{N}}_{i}^ {-}}\bar{F}_{agg}h_{i}^{(0)}h_{j}^{(0)},W^{\mathcal{H}(1)}\Big{)} \tag{3}\]  
where \(\sigma()\) is the nonlinear activation function, \(\bar{F}_{agg}\) is the aggregate operation for aggregating feature information from node pairs, \(W^{\mathcal{B}(1)}\), \(W^{\mathcal{H}(1)}\) refers to the linear transformation matrices responsible for the information aggregated from \(\hat{\mathcal{N}}_{i}^{+}\) and \(\hat{\mathcal{N}}_{i}^{-}\). Due to the fact that the first layer of the model can only portray first-order neighbors, there is no structural balance, and friends or enemies can be obtained by direct aggregation. However, from the second layer of the model, the friend representation of node \(i\) will be acquired by the aggregator from its own friends, its own friends' friends, and its own enemies' enemies based on balance theory. For the deeper aggregation layers (\(l>1\)), it can be recursively defined as:  
\[h_{p}^{\mathcal{B}(l)}=\sigma\Big{(}\sum\
olimits_{j\in\hat{\mathcal{N}}_{i}^ {+}\in\hat{\mathcal{N}}_{i}^{-}}\bar{y}_{ij}^{\mathcal{B}(l)}h_{j}^{\mathcal{ B}(l-1)}w^{\mathcal{B}(l)}+\bar{y}_{ik}^{\mathcal{B}(l)}h_{k}^{\mathcal{U}(l-1)}W^{ \mathcal{B}(l)}\Big{)} \tag{4}\]  
\[h_{n}^{\mathcal{U}(l)}=\sigma\Big{(}\sum\
olimits_{j\in\hat{\mathcal{N}}_{i}^ {+}\in\hat{\mathcal{N}}_{i}^{-}}-\bar{y}_{ij}^{\mathcal{U}(l)}h_{j}^{\mathcal{ U}(l-1)}W^{\mathcal{U}(l)}+\bar{y}_{ik}^{\mathcal{U}(l)}h_{k}^{\mathcal{B}(l-1)}w^{ \mathcal{U}(l)}\Big{)} \tag{5}\]  
where \(w^{\mathcal{B}(l)}\), \(W^{\mathcal{U}(l)}\) is the shared weight matrix.