# Graph Convolutional Networks Guided by Explicitly Estimated Homophily and Heterophily Degree
## 3 The Proposed Method
### The GCN Module Guided by Explicitly Estimated Homophily and Heterophily Degree  
For any directly connected nodes \(v_{i}\) and \(v_{j}\) in the graph, we use pre-trained estimators to calculate the homophily degree of these two nodes, which is the estimated probability that two nodes belong to the same category:  
\[u_{i,j}^{homo} =\mathbf{s}_{i}^{\top}\mathbf{s}_{j} \tag{7}\] \[z_{i,j}^{homo} =\mathbf{t}_{i}^{\top}\mathbf{t}_{j} \tag{8}\]  
We take a weighted sum of the two estimated homophily degrees:  
\[d_{i,j}^{homo}=\theta\cdot u_{i,j}^{homo}+(1-\theta)\cdot z_{i,j}^{homo} \tag{9}\]  
The hyperparameter \(\theta\) controls the proportion of original node attribute information and localized structure information used in estimation. Meanwhile, we can obtain the estimated heterophily degree between node pairs, which is the estimated probability that two nodes belong to different categories:  
\[d_{i,j}^{hete}=1-d_{i,j}^{homo} \tag{10}\]  
Following the settings in BM-GCN [23], for a graph \(\mathcal{G}\), we add multiple self-loops to it:  
\[\tilde{\mathbf{A}}=\mathbf{A}+\delta\mathbf{I} \tag{11}\]  
where \(\mathbf{I}\in\mathbb{R}^{n\times n}\) is the identity matrix, and \(\delta\) is the self-loop parameter which is used to control the proportion contributed by the node itself when calculating the weights of messages. We use \(\mathcal{N}(v_{i})\) to denote the set of neighbors of node \(v_{i}\) in the graph. We use a softmax operation to normalize the homophily and heterophily degrees between node \(v_{i}\) and all its neighbors to obtain the weights of positive and negative messages:  
\[w_{i,j}^{pos}=\frac{\exp(d_{i,j}^{homo})}{\sum_{v_{p}\in\mathcal{N}(v_{i})} \exp(d_{i,p}^{homo})} \tag{12}\]  
\[w_{i,j}^{neg}=\frac{\exp(d_{i,j}^{hete})}{\sum_{v_{p}\in\mathcal{N}(v_{i})} \exp(d_{i,p}^{hete})} \tag{13}\]  
Then, we use the above weights to guide the message passing in the graph convolutional layer. The \(l\)-th graph convolutional layer in GCN-EHHD can be defined by:  
\[\mathbf{m}_{i}^{(l)}=\alpha\sum_{v_{j}\in\mathcal{N}(v_{i})}w_{i,j}^{pos} \mathbf{W}_{pos}^{(l)}\mathbf{h}_{j}^{(l-1)}-(1-\alpha)\sum_{v_{j}\in\mathcal{ N}(v_{i})}w_{i,j}^{neg}\mathbf{W}_{neg}^{(l)}\mathbf{h}_{j}^{(l-1)} \tag{14}\]\[\mathbf{h}_{i}^{(I)}=\sigma(\mathbf{m}_{i}^{(I)}+\mathbf{W}_{g}^{(I)}\mathbf{h}_{i }^{(I-1)}+\mathbf{b}_{g}^{(I)}) \tag{15}\]  
where \(\mathbf{h}_{i}^{(0)}=\mathbf{x}_{i}\), \(\sigma\) is an activation function, \(\mathbf{W}_{pos}^{(I)}\), \(\mathbf{W}_{neg}^{(I)}\) and \(\mathbf{W}_{g}^{(I)}\) are all learnable weight matrices, and \(\mathbf{b}_{g}^{(I)}\) is the learnable bias vector. The hyperparameter \(\alpha\) controls the proportion of positive and negative messages in the aggregation of signed messages.  
Finally, we can obtain the ultimate prediction of GCN-EHHD by:  
\[\mathbf{r}_{i}=\text{softmax}(\mathbf{m}^{(K)}+\mathbf{W}_{g}^{(K)}\mathbf{h} _{j}^{(K-1)}+\mathbf{b}_{g}^{(K)}) \tag{16}\]  
where \(K\) is the number of the convolutional layers in GCN-EHHD, \(\mathbf{r}_{i}\in\mathbb{R}^{N\times C}\) is the predicted results of GCN-EHHD for node \(v_{i}\), and \(\mathbf{r}_{i}[c]\) is the probability that node \(v_{i}\) belongs to class \(c\).