# Heterogeneous Graph Structure Learning for Next Point-of-Interest Recommendation
## 4 Heterogeneous Graph Structure Learning Model
### Heterogeneous Graph Contrastive Learning
#### 4.2.1 Construction of Meta-Path-Based Subgraphs  
To obtain a more comprehensive node relation, this paper first constructs a heterogeneous graph \(G=(V,E)\), where the nodes include users, POIs, and POI attributes which the  
Figure 1: Overview of HGSL-POI.  
Figure 2: A specific schematic diagram of heterogeneous graph contrastive learning: (**a**) Meta-path based Contrastive Learning, and (**b**) Interaction-Aware Contrastive Learning.  
POIs have. Edges are constructed according to the following rules: if user \(u\) has visited a POI \(p\), then the user is connected to the POI; if a POI has a specific attribute, then the POI is connected to this attribute. Note that all edges in \(G\) are undirected.  
Based on the heterogeneous graph \(G\), this paper first extracts the interaction graph \(G_{up}\) between users and POIs. \(G_{up}\) includes all users and POIs. If user \(u\) has visited POI \(p\), there is an edge between \(u\) and \(p\). The adjacency matrix of \(G_{up}\) is \(A_{up}\).  
In addition to the interaction graph, we also construct different subgraphs for users and POIs based on different meta-paths in order to capture the potential high-order connections between nodes. The meta-path is widely used in heterogeneous graphs to illustrate how two nodes connect. For example, the meta-path UPU indicates that two users are connected through a POI, which means they have visited the same POI. Maybe these two users have similar interests. The meta-path PCP indicates that two POIs belong to the same category. A user may choose another POI for substitution.  
The meta-path subgraphs are constructed based on the following rules: for a given node \(v\) with node type \(v_{1}\) and a meta-path \(\rho\), we can find all the other nodes connected to node \(v\) through the meta-path \(\rho\). Then, we treat these selected nodes to be connect with node \(v\) and denote this connection as \(e_{\rho}^{v}\). By applying the above process to all the nodes of type \(v_{1}\), we can obtain all the connections \(E=\left\{e_{\rho}^{v}\,\middle|\,v\in V_{1}\right\}\). Then, we can construct meta-path subgraph \(G_{v1}^{\rho}\) utilizing the nodes of node type \(v_{1}\) and the connections \(E\) between them. For example, if two users are connected by _UPU_, they are connected in the meta-path subgraph; otherwise, they are not connected. By applying this procedure to all users, we can obtain the meta-path graph \(G_{U}^{UPU}\) for the user and _UPU_. This method has nothing to do with whether there is a direction between these two nodes or not.  
According to the definition of the meta-path and meta-path-based subgraph, we select two meta-path-based subgraphs \(G_{uu1}\) and \(G_{uu2}\) for users based on meta-paths \(\rho_{u}^{1}\) and \(\rho_{u}^{2}\) and two meta-path-based subgraphs \(G_{pp1}\) and \(G_{pp2}\) for POIs based on meta-paths \(\rho_{p}^{1}\) and \(\rho_{p}^{2}\). The adjacency matrix of each meta-path-based subgraph is \(A_{uu1}\), \(A_{uu2}\), \(A_{pp1}\), and \(A_{pp2}\), respectively. These subgraphs illustrate the potential high-order relations between nodes of the same type, which can be useful even when lacking relevant information. For example, if the users' friend list is unavailable, it is impossible to determine the connections between users. However, subgraphs based on meta-paths can help identify these connections to some extent. Different meta-paths can carry distinct semantic information, and, by constructing different meta-paths and subgraphs, we can gain a more comprehensive understanding of the relations between nodes. These four meta-path subgraphs and \(G_{up}\) constitute the input of heterogeneous graph representation learning.