Abstract:As new deep learning models, graph neural networks are widely used in graph data and promote various applications, such as recommendation systems, social networks, and knowledge graphs. Most existing heterogeneous graph neural models usually predefine multiple metapaths to capture composite relationships in heterogeneous graphs. However, some models usually consider one metapath during the feature aggregation, leading to models only learning neighbor structure but ignoring the global correlation of multiple matapaths. Others omit intermediate nodes and edges along the metapath, which means models cannot learn the semantic information in each metapath. To address those limitations, this study proposes a new model named metapath-based graph Transformer neural network (MaGTNN). Specifically, MaGTNN first samples heterogeneous graph as metapath-based multi-relation graph and then uses the proposed position encoder and edge encoder to capture the semantic information in a metapath. Subsequently, all the matapath-based neighbor information is aggregated to the target node through their similarity, which is calculated by the improved graph Transformer layer. Extensive experiments on three real-world heterogeneous graph datasets for node classification and node clustering show that MaGTNN achieves more accurate prediction results than state-of-the-art baselines.