# SR-GNN: A Signed Network Embedding Method Guided by Status Theory and a Reciprocity Relationship
## 3 A Directed Signed Network GNN Model
### GNN Model for Directed Signed Networks
#### 3.4.2 Status Score Estimation for Sign Prediction  
Two different fully connected layers are used to estimate the status score of nodes as senders and receivers separately, due to their different behaviors:  
\[S_{sen}(j)=W_{sen}x_{j}^{(K)}+b_{sen} \tag{4}\]  
\[S_{rec}(i)=W_{rec}x_{i}^{(K)}+b_{rec} \tag{5}\]  
Sign prediction can be computed as follows:  
\[\Delta S_{i\gets j}=\sigma(S_{sen}(j)-S_{rec}(i)) \tag{6}\]  
\[\widetilde{Sign}_{(i\gets j)}=\left\{\begin{array}{ll}-1,&\text{if }\Delta S_{i \gets j}>0.5\\ +1,&\text{otherwise}\end{array}\right. \tag{7}\]  
where \(\widetilde{Sign}_{(i\gets j)}\) is the predicted edges sign, and \(\sigma\) is a non-linear activation function that maps the status difference between two nodes to the range of 0 to 1. When \(\Delta S_{i\gets j}>0.5\), it indicates that the status of the sender node \(j\) is higher than that of the receiver node \(I\); thus, \(sign\big{(}\Delta S_{i\gets j}\big{)}=-1\), signifying that \(j\) considers \(i\) to be of lower status. When \(\Delta S_{i\gets j}\leq 0.5\), it implies that the status difference between the two nodes is small, or the status of the sender node \(j\) is lower than that of the receiver node \(i\).  
3.4.3. Model Training and Loss Function  
To train the model, a target function is defined to learn the model parameters, ensuring that the learned node vector representations conform to the semantics of status theory. Here, a binary cross-entropy loss function is adopted as the model's target function. The loss function is defined as follows:  
\[\mathcal{L}_{1}=\frac{1}{|E^{+}|}\underset{\tilde{e}_{i\sim j}\in E^{+}}{\sum} \left(Sign_{\tilde{e}_{i\sim j}}\right)\cdot\Delta S_{i\sim j}+\frac{1}{|E^{-}| }\underset{\tilde{e}_{i\sim j}\in E^{-}}{\sum}\left(Sign_{\tilde{e}_{i\sim j}} \right)\cdot\Delta S_{i\sim j}\]  
\[\mathcal{L}_{2}= \frac{1}{|E^{R+}|}\underset{\tilde{e}_{i\sim j}\in E^{R+}}{\sum} \left(Sign_{\tilde{e}_{i\sim j}}\right)\cdot\frac{\left(\Delta S_{i\sim j}+ \Delta S_{i\sim j}\right)}{2}+ \tag{8}\] \[\frac{1}{|E^{R-}|}\underset{\tilde{e}_{i\sim j}\in E^{R-}}{\sum} \left(Sign_{\tilde{e}_{i\sim j}}\right)\cdot\frac{\left(\Delta S_{i\sim j}+ \Delta S_{i\sim j}\right)}{2}\]  
\[\mathcal{L}=\alpha\mathcal{L}_{1}+\beta\mathcal{L}_{2}+\lambda\|\Theta\|_{2}^ {2}\]  
To meet the status theory, the first term of \(\mathcal{L}_{1}\) aims to minimize the difference of the two nodes' status scores with positive edges; the second term of \(\mathcal{L}_{1}\) maximizes the difference between the two nodes' status scores with negative edges; \(\mathcal{L}_{2}\) makes the distance between nodes connected by reciprocal positive edges shorter, and the distance between nodes connected by reciprocal negative edges longer. \(\alpha\) and \(\beta\) control the weight of the status theory and reciprocity features, respectively, while \(\lambda\) controls the regularization strength to prevent overfitting. \(\Theta=\left\{\left\{\left.W^{k},W^{(k)}_{\tilde{e}_{i\sim j}},W^{(k)}_{\tilde {e}_{i\sim j}}\right\}_{k=1}^{K}W_{sent},W_{rec}\right\}\right.\) represents the trainable parameters of the model.  
3.4.4. The Method of Node Ranking  
Each node in the designed model learns two status scores from receiving and sending. Node sorting requires merging these scores, which can be calculated as follows:  
\[S^{\prime}_{rec}(i)=\underset{j\in N_{l}(i)^{+}}{\sum}\frac{S_{sen}(j)}{N_{o} (j)}-\underset{j\in N_{l}(i)^{-}}{\sum}\frac{S_{sen}(j)}{N_{o}(j)} \tag{9}\]  
The status score of the target node \(i\) is determined by the difference between the sending status scores of all nodes \(j\) that send positive edges to \(i\) and the sending status scores of all nodes that send negative edges to \(i\). The higher the value of \(S^{\prime}_{rec}(i)\), the higher the node's status in the network, enabling node ranking.