Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
License: arXiv.org perpetual non-exclusive license
arXiv:2310.03617v2 [cs.SI] 24 Feb 2024

RouteKG: A knowledge graph-based framework for route prediction on road networks

Yihong Tang Zhan Zhao Weipeng Deng Shuyu Lei Yuebing Liang Zhenliang Ma Department of Urban Planning and Design, The University of Hong Kong, Hong Kong SAR, China Urban Systems Institute, The University of Hong Kong, Hong Kong SAR, China Musketeers Foundation Institute of Data Science, The University of Hong Kong, Hong Kong SAR, China Senseable City Lab, Department of Urban Studies and Planning, Massachusetts Institute of Technology, Cambridge MA, United States Department of Civil and Architectural Engineering, KTH Royal Institute of Technology, Stockholm, Sweden
Abstract

Short-term route prediction on road networks allows us to anticipate the future trajectories of road users, enabling a plethora of intelligent transportation applications such as dynamic traffic control or personalized route recommendation. Despite recent advances in this area, existing methods focus primarily on learning sequential transition patterns, neglecting the inherent spatial structural relations in road networks that can affect human routing decisions. To fill this gap, this paper introduces RouteKG, a novel Knowledge Graph-based framework for route prediction. Specifically, we construct a Knowledge Graph on the road network, thereby learning and leveraging spatial relations, especially moving directions, which are crucial for human navigation. Moreover, an n𝑛nitalic_n-ary tree-based algorithm is introduced to efficiently generate top-K𝐾Kitalic_K routes in a batch mode, enhancing scalability and computational efficiency. To further optimize the prediction performance, a rank refinement module is incorporated to fine-tune the candidate route rankings. The model performance is evaluated using two real-world vehicle trajectory datasets from two Chinese cities, Chengdu and Shanghai, under various practical scenarios. The results demonstrate a significant improvement in accuracy over baseline methods.We further validate our model through a case study that utilizes the pre-trained model as a simulator for real-time traffic flow estimation at the link level. The proposed RouteKG promises wide-ranging applications in vehicle navigation, traffic management, and other intelligent transportation tasks.

keywords:
Route prediction, Knowledge graph, Road network representation, Trajectory data mining, Geospatial AI

1 Introduction

In intelligent transportation systems (ITS), with the increasing prevalence of mobile sensors (e.g., GPS devices) and vehicular communication technologies, the ability to predict road users’ future routes is not merely a convenience but a necessity to support a range of applications such as vehicle navigation (Ziebart et al. 2008), traffic management (Li et al. 2020) and location-based recommendation (Kong et al. 2017, Tang et al. 2022). There are generally two types of route prediction tasks. On the one hand, for transport planning applications, it is often required to predict the complete route (as a sequence of road links) from the origin to destination. This is typically referred to as route choice modeling in the literature (Prato 2009), where the destination information has to be given. On the other hand, for real-time ITS applications, the destination information may not be available, and it is usually adequate to predict the near-future route trajectory of a moving agent based on the observed trajectory so far. This study focuses on the latter, which we call the short-term route prediction problem.

Numerous methods have been proposed in the literature to tackle this problem. Recent works typically use Recurrent Neural Networks (RNNs) (Rumelhart et al. 1986), especially Long Short-Term Memory (LSTM) (Hochreiter & Schmidhuber 1997) and Gated Recurrent Unit (GRU) (Cho et al. 2014), to capture sequential dependencies in trajectory data (Alahi et al. 2016, Mo et al. 2023). Most existing models focus primarily on learning sequential patterns for route prediction, often overlooking the inherent spatial structure in road networks that can affect human routing decisions. To address this issue, some studies have started to leverage Graph Neural Networks (GNNs) to encode road networks for improved prediction of vehicle trajectories (Liang & Zhao 2021) and traffic conditions (Zhao et al. 2019, Li et al. 2017). However, these methods still treat road networks merely as generic graphs, oversimplifying their structure and disregarding crucial geographical attributes and spatial factors.

As a type of spatial network, road networks consist of a set of spatial entities (e.g., intersections, links, etc.) organized in a way to facilitate traffic flows in a mostly 2-dimensional space. The relationships between these entities can be described by a set of spatial factors such as direction, distance, and connectivity. For example, one of the important spatial factors to consider in routing problems is the direction of travel (i.e., goal direction). It has been widely recognized in the navigation and cognitive psychology literature that humans utilize directional cues to navigate their environment (Etienne & Jeffery 2004, Chrastil & Warren 2015). Existing short-term route prediction models, however, often ignore the directional factor or incorporate it as a side feature, thus possibly leading to sub-optimal model performance. These limitations highlight the need for a more spatially explicit model to learn and incorporate these spatial relations throughout road networks.

There are other challenges for short-term route prediction on road networks. Firstly, most existing methods focus on generating a single predicted route (Rathore et al. 2019, Yan et al. 2022). However, due to the inherent uncertainties, providing multiple route predictions can have more practical implications. For instance, traffic managers can optimize real-time traffic flow by considering multiple potential routes of moving vehicles, and transportation system users can benefit from having a wider variety of routing options. Secondly, as road networks grow in size, scalability becomes a challenge for GNN-based methods (Hamilton et al. 2017), as they require substantial computational and memory resources, limiting their applicability to large-scale networks. Lastly, the prediction performance is heavily dependent on the availability of information about the destination (or goal). Generally, potential performance enhancements can be achieved by incorporating goal information into route prediction models. The availability of goal information can vary, including (1) no information, (2) goal direction only, and (3) complete goal information. These varying degrees of goal information availability can impact the route prediction to different extents, but no existing studies have carried out a comprehensive evaluation across all these scenarios.

With the aforementioned challenges, we propose a novel model, “RouteKG”, which leverages the potential of Knowledge Graphs (KGs) (Wang et al. 2014) to encode road networks for short-term route prediction. Unlike existing models that rely on sequence-to-sequence (seq2seq) structures (Sutskever et al. 2014), our approach interprets route prediction as a Knowledge Graph Completion (KGC) task (Chen et al. 2020). Specifically, we propose a Knowledge Graph Module that can predict the future links (tail entities) a user might traverse based on current links (head entities) and moving directions (relations) without solely relying on sequential structures. The module explicitly incorporates the goal moving direction (estimated or actual) into the future route prediction process, better aligning with the intrinsic nature of human navigation. In addition, we employ a Route Generation Module to efficiently generate top-K𝐾Kitalic_K route candidates, and a Rank Refinement Module that can model the dependencies between different links within each predicted route to rerank the route candidates for their consistency, resulting in the final top-K𝐾Kitalic_K predictions. Our proposed KG-based framework can effectively model the spatial relations, thus outperforming existing baselines by a large margin, and could benefiting a range of other transportation or routing tasks. To summarize, this paper contributes to the literature as follows:

  • We introduce RouteKG, a novel KG-based modeling framework for short-term route prediction. In this approach, we adapt the KG to represent road networks and reformulate the route prediction problem as a KGC task. Therefore, we can leverage the road network and route representations learned from the KG to enhance prediction accuracy and interpretability.

  • We propose an n𝑛nitalic_n-ary tree-based route generation algorithm that enables efficient batch generation of future routes based on predicted probabilities derived from the KG. Additionally, we employ a rank refinement module that effectively prioritizes routes for their consistency by modeling dependencies between their road links, resulting in more accurate, trustworthy, and reliable top-K𝐾Kitalic_K route predictions.

  • Through extensive experiments on two real-world vehicle trajectory datasets from Chengdu and Shanghai, the results demonstrate the superior prediction performance of RouteKG over state-of-the-art baseline models across various scenarios of goal information availability, with low response latency. Furthermore, a case study using the trained RouteKG as a simulator to estimate real-time traffic flows at the link level demonstrates our method’s effectiveness in diverse application scenarios.

2 Literature Review

2.1 Trajectory Prediction

2.1.1 Motion Prediction

Motion prediction, which anticipates an agent’s future trajectory from past movements, is central to autonomous driving systems (Yurtsever et al. 2020, Lefèvre et al. 2014). Its importance has amplified with advancements in autonomous driving and robot navigation, improving safety and efficiency by mitigating collision risks and boosting performance (Rudenko et al. 2020). However, the dynamic and uncertain nature of agents’ movements presents unique challenges (Paravarzar & Mohammad 2020). Motion prediction methods can generally be divided into two broad categories: classic and deep learning-based, each with unique advantages and limitations.

Classic methods leverage mathematical models grounded in physics and geometry to focus on the deterministic aspects of an agent’s motion, offering simplicity, interpretability, and efficiency (Helbing & Molnar 1995). Yet, these methods struggle to capture the stochastic behavior of agents in complex environments (Huang et al. 2022).

On the other hand, deep learning-based motion prediction methods leverage neural networks’ power to model the complexities of agent behavior (Alahi et al. 2016). These methods aim to learn the intricate, often non-linear, relationships between different influencing factors from large-scale data. Approaches such as RNNs and Generative Adversarial Networks (GANs) are commonly used (Gupta et al. 2018, Sadeghian et al. 2019, Gu et al. 2021). Recent efforts employ diffusion process (Ho et al. 2020) simulate the process of human motion variation from indeterminate to determinate (Gu et al. 2022). The advantage of deep learning methods is their ability to capture the underlying patterns and subtleties that traditional mathematical models might miss. However, they require extensive computational resources and large amounts of training data, and often lack the interpretability of classic methods (Rudenko et al. 2020).

2.1.2 Route Prediction

Route prediction, distinct from motion prediction, forecasts the future trajectories of agents that typically operate within road network constraints, necessitating different problem formulations and solutions. Similar to motion prediction, models designed for short-term route prediction can also be broadly classified into traditional approaches and deep learning-based methods.

Traditional methods utilize shortest path-based methods such as the Dijkstra’s algorithm (Dijkstra 1959), Bellman-Ford, and A* (Hart et al. 1968) for route prediction tasks. However, these dynamic programming-based methods require destination information to generate potential routes for trajectory prediction. As the destination information is often unavailable for short-term route prediction, other works have employed Kalman Filters (Abbas et al. 2020) or Hidden Markov Models (HMMs) (Simmons et al. 2006, Ye et al. 2016) to predict users’ destinations and routes. Nevertheless, these methods struggle to model long-term temporal dependencies due to relatively simple model structures.

In comparison, deep learning-based methods have outperformed traditional methods in prediction tasks, exhibiting superior ability in modeling spatial-temporal dependencies. The RNN-based encoder-decoder trajectory representation learning framework (Fu & Lee 2020) can adapt to tasks such as trajectory similarity measurement, travel time prediction, and destination prediction. Other studies have utilized Graph Convolutional Networks (GCN) and attention mechanisms to refine trajectory representation for prediction purposes (Shao et al. 2021). Some studies have proposed models for tasks ranging from predicting the next link using historical trajectories (Liu et al. 2022) to enhancing route prediction through pre-training and contrastive learning (Yan et al. 2022). Furthermore, some models are designed for road network-constrained trajectory recovery, capable of recovering fine-grained points from low-sampling records (Ren et al. 2021, Chen, Zhang, Sun & Zheng 2022).

Despite significant progress in short-term route prediction on road networks, many existing methods view it as a sequence-to-sequence task, leveraging sequential models like RNNs or Transformers for prediction. These methods often overlook the crucial role of spatial relations within the road network, an essential aspect of routing tasks.

2.2 Knowledge Graph

2.2.1 Knowledge Graph Completion

The rapidly expanding interest in KGs has fueled the advancement in tasks like recommender systems, question answering, and semantic search, given their ability to provide structured and machine-interpretable knowledge about real-world entities and their relations (Noy et al. 2019, Sheth et al. 2019, Paulheim 2017). Despite their immense potential, a critical problem is the inherent incompleteness of information, making KGC an important and burgeoning research area. KGC refers to inferring missing or incomplete information in a KG by predicting new relationships between entities based on existing information (Chen et al. 2020).

Earlier studies on KGC typically employed statistical relational learning (SRL) methods, such as Markov Logic Networks (MLN) (Richardson & Domingos 2006) and Probabilistic Soft Logic (PSL) (Bach et al. 2017). These methods demonstrate effectiveness in capturing complex dependencies but need to improve scalability due to the need to specify all possible rules manually. More scalable machine learning approaches, especially those involving embeddings, have been proposed to overcome these limitations in recent years. TransE is a seminal model in this line, which models relations as translations in the entity embedding space (Bordes et al. 2013). Follow-up models such as TransH (Wang et al. 2014), TransR (Lin et al. 2015), and TransD (Ji et al. 2015) were subsequently proposed to handle complex relational data by introducing hyperplanes, relation-specific spaces, or dynamic mapping matrices respectively. Meanwhile, tensor factorization-based models like RESCAL (Nickel et al. 2011), DistMult (Yang et al. 2014), and ComplEx (Trouillon et al. 2016) have been developed, aiming to capture the complex correlations between entities and relations. These models generally perform well but can be computationally intensive. More recently, models based on GNNs have shown promising results for KGC. Models such as R-GCN (Schlichtkrull et al. 2018) and CompGCN (Vashishth et al. 2019) have achieved competitive results by modeling KGs as multi-relational graphs and learning from both the graph structure and node attributes.

To summarize, KGC is a process that leverages machine learning to infer and predict missing knowledge automatically. It leverages the rich structure of KGs, employing effective entity and relation representations for improved prediction.

2.2.2 Mobility Knowledge Graph

KGs have been increasingly utilized to address complex urban mobility problems. Mobility KGs have witnessed considerable growth and advancements in recent years, particularly with integrating multi-source transportation data, creating KGs derived from GPS trajectory data, and utilizing structured knowledge bases to augment urban mobility data analysis.

Tan et al. (2021) devised a KG for urban traffic systems to uncover the implicit relationships amongst traffic entities and thereby unearth valuable traffic knowledge. Similarly, Zhuang et al. (2017) constructed an urban movement KG using GPS trajectory data and affirmed the practicality of their model by predicting the level of user attention directed towards various city locations. Zhao et al. (2020) put forth a generalized framework for multi-source spatiotemporal data analysis, underpinned by KG embedding, intending to discern the network structure and semantic relationships embedded within multi-source spatiotemporal data. Several studies have focused on building KGs grounded on geographical information and human mobilities for various applications, such as predicting subsequent locations (i.e., Point of Interest recommendation) (Liu et al. 2021, Rao et al. 2022, Wang et al. 2021), modeling event streams (Wang et al. 2020), learning user similarity (Zhang et al. 2023), forecasting destinations (Li et al. 2022, Chi et al. 2022), and performing epidemic contact tracing (Chen, Zhang, Qian & Li 2022).

Despite their methodological divergence, these approaches rely on different data sources to construct mobility KGs, often resulting in superior outcomes but potentially sacrificing some generalizability. Notably, current work has yet to address the design of KGs for route prediction or road network representation learning while retaining generalizability.

3 Preliminaries

In this section, we introduce definitions and the problem formulation in Section 3.1. All the notations used in this paper are listed in the A.

3.1 Problem Formulation

Definition 1 (Road Network 𝐆𝐆\mathbf{G}bold_G).

The road network can be modeled as a Multi-Directed Graph (MultiDiGraph) 𝐆=(𝐕,𝐄)𝐆𝐕𝐄\mathbf{G}=(\mathbf{V},\mathbf{E})bold_G = ( bold_V , bold_E ), where 𝐕𝐕\mathbf{V}bold_V is a set of vertices (or nodes) representing unique intersections or endpoints in the road network, and 𝐄𝐄\mathbf{E}bold_E is a set of directed edges, each representing a link. Each vertex v𝐕𝑣𝐕v\in\mathbf{V}italic_v ∈ bold_V is associated with a geographical coordinate (latv,lonv)𝑙𝑎subscript𝑡𝑣𝑙𝑜subscript𝑛𝑣(lat_{v},lon_{v})( italic_l italic_a italic_t start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT , italic_l italic_o italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT ). Each edge e𝐄𝑒𝐄e\in\mathbf{E}italic_e ∈ bold_E carries certain attributes, such as length, road type, etc. Multiple edges may connect the same pair of vertices, accounting for multiple links connecting the same intersections (e.g., parallel roads). An edge eksuperscript𝑒𝑘e^{k}italic_e start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT is denoted as ek=(vks,vke,m)superscript𝑒𝑘subscriptsuperscript𝑣𝑠𝑘subscriptsuperscript𝑣𝑒𝑘𝑚e^{k}=(v^{s}_{k},v^{e}_{k},m)italic_e start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT = ( italic_v start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_v start_POSTSUPERSCRIPT italic_e end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_m ), where m𝑚mitalic_m distinguishes edges connecting the same pair of nodes.

Definition 2 (Route x𝑥xitalic_x).

A map-matched route x𝑥xitalic_x of length m𝑚mitalic_m is a sequence of links, x={e1,e2,,em},x𝒳formulae-sequence𝑥superscript𝑒1superscript𝑒2normal-…superscript𝑒𝑚𝑥𝒳x=\left\{e^{1},e^{2},...,e^{m}\right\},x\in\mathcal{X}italic_x = { italic_e start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT , italic_e start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT , … , italic_e start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT } , italic_x ∈ caligraphic_X. For every consecutive pair of links (ei,ei+1)superscript𝑒𝑖superscript𝑒𝑖1(e^{i},e^{i+1})( italic_e start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT , italic_e start_POSTSUPERSCRIPT italic_i + 1 end_POSTSUPERSCRIPT ), there exists a node v𝑣vitalic_v in the graph 𝐆𝐆\mathbf{G}bold_G that connects the two edges. The set of all map-matched routes is denoted as 𝒳𝒳\mathcal{X}caligraphic_X. The i𝑖iitalic_i-th route can be partitioned into an observed route xio={eij}j=1Γsubscriptsuperscript𝑥𝑜𝑖subscriptsuperscriptsubscriptsuperscript𝑒𝑗𝑖normal-Γ𝑗1x^{o}_{i}=\{e^{j}_{i}\}^{\Gamma}_{j=1}italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = { italic_e start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT } start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT with length Γnormal-Γ\Gammaroman_Γ and a future route xif={eij}j=Γ+1Γ+Γsubscriptsuperscript𝑥𝑓𝑖superscriptsubscriptsubscriptsuperscript𝑒𝑗𝑖𝑗normal-Γ1normal-Γsuperscriptnormal-Γnormal-′x^{f}_{i}=\{e^{j}_{i}\}_{j=\Gamma+1}^{\Gamma+\Gamma^{\prime}}italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = { italic_e start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT } start_POSTSUBSCRIPT italic_j = roman_Γ + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT with length Γsuperscriptnormal-Γnormal-′\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, where 𝒳o={xio}i=1|𝒳|superscript𝒳𝑜superscriptsubscriptsuperscriptsubscript𝑥𝑖𝑜𝑖1𝒳\mathcal{X}^{o}=\{x_{i}^{o}\}_{i=1}^{|\mathcal{X}|}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT = { italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT and 𝒳f={xif}i=1|𝒳|superscript𝒳𝑓superscriptsubscriptsuperscriptsubscript𝑥𝑖𝑓𝑖1𝒳\mathcal{X}^{f}=\{x_{i}^{f}\}_{i=1}^{|\mathcal{X}|}caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT = { italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT.

Given above definitions, the short-term route prediction (or route prediction for short) problem can be broadly defined as the task of predicting the future route based on observed routes. However, as discussed in Section 1, the availability of goal information plays a pivotal role in routing tasks. In some scenarios, no goal information is available. In other cases, we may know the rough direction of the destination, or its exact location. The degree of goal information inclusion can greatly influence the specific formulation of route prediction Dendorfer et al. (2020). Remarkably, no existing work has undertaken an exhaustive evaluation encompassing all these distinct scenarios. Consequently, in this study, we categorize the route prediction problem into three subproblems:

Problem 1 (Route Prediction \mathcal{F}caligraphic_F).

Generally, the route prediction problem aims to learn a function \mathcal{F}caligraphic_F that maps observed routes to future routes. We identify three distinct subproblems that arise based on the availability of the goal information:

Subproblem 1 (Route prediction with unknown goal 1subscript1\mathcal{F}_{1}caligraphic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT) The goal information is completely absent from the input. The mapping function 1subscript1\mathcal{F}_{1}caligraphic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT is designed to predict the future routes solely based on the observed routes, disregarding any goal information:

[{xio}i=1|𝒳|;𝐆]1(;Θ1){xif}i=1|𝒳|,superscriptsubscript1subscriptΘ1superscriptsubscriptsubscriptsuperscript𝑥𝑜𝑖𝑖1𝒳𝐆superscriptsubscriptsubscriptsuperscript𝑥𝑓𝑖𝑖1𝒳\left[\left\{x^{o}_{i}\right\}_{i=1}^{|\mathcal{X}|};\mathbf{G}\right]% \stackrel{{\scriptstyle\mathcal{F}_{1}(\cdot;\Theta_{1})}}{{\longrightarrow}}% \{x^{f}_{i}\}_{i=1}^{|\mathcal{X}|},[ { italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT ; bold_G ] start_RELOP SUPERSCRIPTOP start_ARG ⟶ end_ARG start_ARG caligraphic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ( ⋅ ; roman_Θ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) end_ARG end_RELOP { italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT , (1)

Subproblem 2 (Route prediction with goal direction only 2subscript2\mathcal{F}_{2}caligraphic_F start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT) The goal direction ridsubscriptsuperscript𝑟𝑑𝑖r^{d}_{i}italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is known in addition to the observed routes. The mapping function 2subscript2\mathcal{F}_{2}caligraphic_F start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT leverages the goal direction to predict the future routes more accurately:

[{xio;rid}i=1|𝒳|;𝐆]2(;Θ2){xif}i=1|𝒳|,superscriptsubscript2subscriptΘ2superscriptsubscriptsubscriptsuperscript𝑥𝑜𝑖subscriptsuperscript𝑟𝑑𝑖𝑖1𝒳𝐆superscriptsubscriptsubscriptsuperscript𝑥𝑓𝑖𝑖1𝒳\left[\left\{x^{o}_{i};r^{d}_{i}\right\}_{i=1}^{|\mathcal{X}|};\mathbf{G}% \right]\stackrel{{\scriptstyle\mathcal{F}_{2}(\cdot;\Theta_{2})}}{{% \longrightarrow}}\{x^{f}_{i}\}_{i=1}^{|\mathcal{X}|},[ { italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ; italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT ; bold_G ] start_RELOP SUPERSCRIPTOP start_ARG ⟶ end_ARG start_ARG caligraphic_F start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( ⋅ ; roman_Θ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ) end_ARG end_RELOP { italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT , (2)

Subproblem 3 (Route prediction with complete goal information 3subscript3\mathcal{F}_{3}caligraphic_F start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT) Complete goal information is given in the input. The mapping function 3subscript3\mathcal{F}_{3}caligraphic_F start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT leverages both the goal direction ridsubscriptsuperscript𝑟𝑑𝑖r^{d}_{i}italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and exact goal link eiΓ+Γsubscriptsuperscript𝑒normal-Γsuperscriptnormal-Γnormal-′𝑖e^{\Gamma+\Gamma^{\prime}}_{i}italic_e start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to generate more accurate predictions of the future routes:

[{xio;rid;eiΓ+Γ}i=1|𝒳|;𝐆]3(;Θ3){xif}i=1|𝒳|,superscriptsubscript3subscriptΘ3superscriptsubscriptsubscriptsuperscript𝑥𝑜𝑖subscriptsuperscript𝑟𝑑𝑖subscriptsuperscript𝑒ΓsuperscriptΓ𝑖𝑖1𝒳𝐆superscriptsubscriptsubscriptsuperscript𝑥𝑓𝑖𝑖1𝒳\left[\left\{x^{o}_{i};r^{d}_{i};e^{\Gamma+\Gamma^{\prime}}_{i}\right\}_{i=1}^% {|\mathcal{X}|};\mathbf{G}\right]\stackrel{{\scriptstyle\mathcal{F}_{3}(\cdot;% \Theta_{3})}}{{\longrightarrow}}\{x^{f}_{i}\}_{i=1}^{|\mathcal{X}|},[ { italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ; italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ; italic_e start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT ; bold_G ] start_RELOP SUPERSCRIPTOP start_ARG ⟶ end_ARG start_ARG caligraphic_F start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT ( ⋅ ; roman_Θ start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT ) end_ARG end_RELOP { italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT , (3)

where xiosuperscriptsubscript𝑥𝑖𝑜x_{i}^{o}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT is the i𝑖iitalic_i-th observed route, and Θ1,Θ2,Θ3subscriptnormal-Θ1subscriptnormal-Θ2subscriptnormal-Θ3\Theta_{1},\Theta_{2},\Theta_{3}roman_Θ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , roman_Θ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , roman_Θ start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT are the parameter sets of the mapping functions 1,2,3subscript1subscript2subscript3\mathcal{F}_{1},\mathcal{F}_{2},\mathcal{F}_{3}caligraphic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , caligraphic_F start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , caligraphic_F start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT.

In the context of routing applications, it is crucial to account for various destination-specific requirements. By addressing the routing prediction problem through the three identified subproblems, our study offers valuable empirical evidence regarding the impact of different degrees of goal information availability in real-world scenarios.

3.2 Knowledge Graph

A KG is a heterogeneous structured data representation containing entities (nodes) and their interrelations (edges). The edges carry precise semantic information about the relation type or associated attributes. Formally, the graph is often represented by triplets: 𝒢={(h,r,t) | h,t,r}𝒢conditional-set𝑟𝑡 formulae-sequence 𝑡𝑟\mathcal{G}=\left\{(h,r,t)\text{ }|\text{ }h,t\in\mathcal{E},r\in\mathcal{R}\right\}caligraphic_G = { ( italic_h , italic_r , italic_t ) | italic_h , italic_t ∈ caligraphic_E , italic_r ∈ caligraphic_R }, where hhitalic_h represents the head entity, r𝑟ritalic_r the relation, and t𝑡titalic_t the tail entity. \mathcal{E}caligraphic_E is the set of entities, and \mathcal{R}caligraphic_R the set of relations. These triplets concisely encode factual information for efficient knowledge discovery, inference, and integration. The graph not merely serves as a repository of existing knowledge but also facilitates the inference of missing information. This process, known as Knowledge Graph Completion (KGC), finds a tail entity t^^𝑡\hat{t}over^ start_ARG italic_t end_ARG given a head entity and a relation, denoted as (h,r,t^)𝑟^𝑡(h,r,\hat{t})( italic_h , italic_r , over^ start_ARG italic_t end_ARG ), or its reverse, denoted as (h^,r,t)^𝑟𝑡(\hat{h},r,t)( over^ start_ARG italic_h end_ARG , italic_r , italic_t ), thereby completing a partial triplet.

To enhance KGC and provide quantitative measures of relations, KG embedding maps entities and relations to a low-dimensional space, preserving the relational structure. The embedding process can be formalized as two mapping functions :δ:subscriptsuperscriptsubscript𝛿\mathcal{M}_{\mathcal{E}}:\mathcal{E}\rightarrow\mathbb{R}^{\delta_{\mathcal{E% }}}caligraphic_M start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT : caligraphic_E → blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and :δ:subscriptsuperscriptsubscript𝛿\mathcal{M}_{\mathcal{R}}:\mathcal{R}\rightarrow\mathbb{R}^{\delta_{\mathcal{R% }}}caligraphic_M start_POSTSUBSCRIPT caligraphic_R end_POSTSUBSCRIPT : caligraphic_R → blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_R end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, where δsubscript𝛿{\delta_{\mathcal{E}}}italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT and δsubscript𝛿{\delta_{\mathcal{R}}}italic_δ start_POSTSUBSCRIPT caligraphic_R end_POSTSUBSCRIPT are the dimensions of the entity embedding space and relation embedding space. A scoring function ϕ:δ×δ×δ:italic-ϕsuperscriptsubscript𝛿superscriptsubscript𝛿superscriptsubscript𝛿\phi:\mathbb{R}^{\delta_{\mathcal{E}}}\times\mathbb{R}^{\delta_{\mathcal{R}}}% \times\mathbb{R}^{\delta_{\mathcal{E}}}\rightarrow\mathbb{R}italic_ϕ : blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT × blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_R end_POSTSUBSCRIPT end_POSTSUPERSCRIPT × blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT → blackboard_R computes the plausibility of a relation r𝑟ritalic_r between entities hhitalic_h and t𝑡titalic_t in the embedded space. The function is defined such that ϕ((h),(r),(t))italic-ϕsubscriptsubscript𝑟subscript𝑡\phi(\mathcal{M}_{\mathcal{E}}(h),\mathcal{M}_{\mathcal{R}}(r),\mathcal{M}_{% \mathcal{E}}(t))italic_ϕ ( caligraphic_M start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT ( italic_h ) , caligraphic_M start_POSTSUBSCRIPT caligraphic_R end_POSTSUBSCRIPT ( italic_r ) , caligraphic_M start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT ( italic_t ) ) returns a real number representing the score of the triplet (h,r,t)𝑟𝑡(h,r,t)( italic_h , italic_r , italic_t ). KGC infers missing relations or entities by identifying triplets with high scores under the scoring function. This embedding mechanism, coupled with a scoring function, computes and extends the encoded relations within the KG, providing a robust knowledge discovery and integration tool.

4 Methodology

4.1 RouteKG Framework Overview

This section introduces RouteKG, the proposed solution to the route prediction problem. As depicted in Figure 1, the model comprises four modules, namely Data Preprocessing Module dsubscript𝑑\mathcal{M}_{d}caligraphic_M start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT, Knowledge Graph Module kgsubscript𝑘𝑔\mathcal{M}_{kg}caligraphic_M start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT, Route Generation Module gsubscript𝑔\mathcal{M}_{g}caligraphic_M start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT, and Rank Refinement Module rsubscript𝑟\mathcal{M}_{r}caligraphic_M start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT, each serving a specific purpose and collectively working towards an effective solution.

Refer to caption
Figure 1: The flowchart of RouteKG.

We start by processing the raw GPS trajectories 𝒯𝒯\mathcal{T}caligraphic_T and the raw road network data G𝐺Gitalic_G with the Data Preprocessing Module. This module generates the direction label matrix 𝐃𝐃\mathbf{D}bold_D, the node adjacency edges (NAE) matrix 𝐀𝐀\mathbf{A}bold_A, and map-matched routes 𝒳𝒳\mathcal{X}caligraphic_X. We then divide 𝒳𝒳\mathcal{X}caligraphic_X into the observed routes 𝒳osuperscript𝒳𝑜\mathcal{X}^{o}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT and future routes 𝒳fsuperscript𝒳𝑓\mathcal{X}^{f}caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT. We represent the road network as a MultiDiGraph 𝐆𝐆\mathbf{G}bold_G and express the preprocessing step as (𝒳o,𝒳f,𝒳,𝐃,𝐀)=d(𝒯,𝐆)superscript𝒳𝑜superscript𝒳𝑓𝒳𝐃𝐀subscript𝑑𝒯𝐆\left(\mathcal{X}^{o},\mathcal{X}^{f},\mathcal{X},\mathbf{D},\mathbf{A}\right)% =\mathcal{M}_{d}\left(\mathcal{T},\mathbf{G}\right)( caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT , caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT , caligraphic_X , bold_D , bold_A ) = caligraphic_M start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ( caligraphic_T , bold_G ).

Next, the Knowledge Graph Module is the core component of the proposed model, it takes the observed routes 𝒳osuperscript𝒳𝑜\mathcal{X}^{o}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT and road network 𝐆𝐆\mathbf{G}bold_G to predict future routes. It constructs a knowledge graph on the road network 𝐆𝐆\mathbf{G}bold_G, learns spatial relations \mathcal{R}caligraphic_R, and predicts future routes, converting 𝒳osuperscript𝒳𝑜\mathcal{X}^{o}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT to future route probabilities Pr(𝒳f~)Pr~superscript𝒳𝑓\mathrm{Pr}(\widetilde{\mathcal{X}^{f}})roman_Pr ( over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG ) via (Pr(𝒳f~),)=kg(𝒳o,𝐆,𝐃;Θkg)Pr~superscript𝒳𝑓subscript𝑘𝑔superscript𝒳𝑜𝐆𝐃subscriptΘ𝑘𝑔\left(\mathrm{Pr}(\widetilde{\mathcal{X}^{f}}),\mathcal{R}\right)=\mathcal{M}_% {kg}\left(\mathcal{X}^{o},\mathbf{G},\mathbf{D};\Theta_{kg}\right)( roman_Pr ( over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG ) , caligraphic_R ) = caligraphic_M start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT ( caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT , bold_G , bold_D ; roman_Θ start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT ), where ΘkgsubscriptΘ𝑘𝑔\Theta_{kg}roman_Θ start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT are the module’s parameters, and \mathcal{R}caligraphic_R represents the learned spatial relations.

With the future route probabilities Pr(𝒳f~)Pr~superscript𝒳𝑓\mathrm{Pr}(\widetilde{\mathcal{X}^{f}})roman_Pr ( over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG ) in hand, the Route Generation Module employs an n𝑛nitalic_n-ary tree algorithm to generate potential future routes, yielding the top-K𝐾Kitalic_K preliminary route predictions. This step is captured by {𝒳kf~}k=1K=g(Pr(𝒳f~),𝐆,𝐀)superscriptsubscript~subscriptsuperscript𝒳𝑓𝑘𝑘1𝐾subscript𝑔Pr~superscript𝒳𝑓𝐆𝐀\left\{\widetilde{\mathcal{X}^{f}_{k}}\right\}_{k=1}^{K}=\mathcal{M}_{g}\left(% \mathrm{Pr}(\widetilde{\mathcal{X}^{f}}),\mathbf{G},\mathbf{A}\right){ over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT = caligraphic_M start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT ( roman_Pr ( over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG ) , bold_G , bold_A ), where 𝒳kf~~subscriptsuperscript𝒳𝑓𝑘\widetilde{\mathcal{X}^{f}_{k}}over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG denotes the k𝑘kitalic_k-th generated future route.

When predicting future routes, predicted road links at different time-step are not independent but related. Thus, a Rank Refinement Module is utilized to collectively learn and assess the predicted route. It takes the initial top-K𝐾Kitalic_K predictions, {𝒳kf~}k=1Ksuperscriptsubscript~subscriptsuperscript𝒳𝑓𝑘𝑘1𝐾\left\{\widetilde{\mathcal{X}^{f}_{k}}\right\}_{k=1}^{K}{ over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT, and refines them using the spatial relations, \mathcal{R}caligraphic_R. This refinement is achieved by the mapping {𝒳kf^}k=1K=r({𝒳kf~}k=1K,;Θr)superscriptsubscript^subscriptsuperscript𝒳𝑓𝑘𝑘1𝐾subscript𝑟superscriptsubscript~subscriptsuperscript𝒳𝑓𝑘𝑘1𝐾subscriptΘ𝑟\left\{\widehat{\mathcal{X}^{f}_{k}}\right\}_{k=1}^{K}=\mathcal{M}_{r}\left(% \left\{\widetilde{\mathcal{X}^{f}_{k}}\right\}_{k=1}^{K},\mathcal{R};\Theta_{r% }\right){ over^ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT = caligraphic_M start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT ( { over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT , caligraphic_R ; roman_Θ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT ), where ΘrsubscriptΘ𝑟\Theta_{r}roman_Θ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT are the module’s parameters. This stage ensures that the final route predictions are accurate by considering the sequence of routes and spatial relations.

The motivations and details of the four modules will be explained in the following subsections.

4.2 Data Preprocessing Module

To facilitate the KG-related process and route prediction, we first need to perform specific calculations on the road network. This subsection details the method for producing the necessary data for the model components, which aims to compute routes 𝒳𝒳\mathcal{X}caligraphic_X, route directions 𝒳dsubscript𝒳𝑑\mathcal{X}_{d}caligraphic_X start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT, link-to-link direction matrix 𝐃|𝐄|×|𝐄|𝐃superscript𝐄𝐄\mathbf{D}\in\mathbb{R}^{|\mathbf{E}|\times|\mathbf{E}|}bold_D ∈ blackboard_R start_POSTSUPERSCRIPT | bold_E | × | bold_E | end_POSTSUPERSCRIPT, and node adjacency edges matrix 𝐀|𝐕|×NA𝐀superscript𝐕subscript𝑁𝐴\mathbf{A}\in\mathbb{R}^{|\mathbf{V}|\times N_{A}}bold_A ∈ blackboard_R start_POSTSUPERSCRIPT | bold_V | × italic_N start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, where the NAsubscript𝑁𝐴N_{A}italic_N start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT is the maximum number of the adjacent edges of all nodes in the 𝐆𝐆\mathbf{G}bold_G.

Refer to caption
Figure 2: An illustration of discretized directions with examples of inter- and intra-edge directions.

Routes 𝒳𝒳\mathcal{X}caligraphic_X are obtained by map-matching GPS trajectories 𝒯𝒯\mathcal{T}caligraphic_T to the road network 𝐆𝐆\mathbf{G}bold_G (Yang & Gidofalvi 2018). These routes are then divided into observed routes 𝒳osuperscript𝒳𝑜\mathcal{X}^{o}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT and future routes 𝒳fsuperscript𝒳𝑓\mathcal{X}^{f}caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT. Considering the importance of direction information in navigation (Chrastil & Warren 2015), we discretize continuous directions into Ndsubscript𝑁𝑑N_{d}italic_N start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT classes to form 𝒳dsubscript𝒳𝑑\mathcal{X}_{d}caligraphic_X start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT and 𝐃𝐃\mathbf{D}bold_D. Figure 2 provides an example based on Nd=8subscript𝑁𝑑8N_{d}=8italic_N start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT = 8. It has been shown that 8 directions are adequate in uniquely mapping most link-to-link movements and can enhance route prediction performance (Liang & Zhao 2021). This discretization allows for the convenient computation and assignment of inter- and intra-edge direction labels. It is worth noting that the two-way roads are given only one direction label for simplicity.

To preserve the road network structure information, we construct the node adjacency edges (NAE) matrix, denoted as 𝐀𝐀\mathbf{A}bold_A, can be derived directly from the road network 𝐆𝐆\mathbf{G}bold_G. To build 𝐀𝐀\mathbf{A}bold_A, we pad the edges adjacent to each node to an uniform length, thereby creating a matrix of dimensions |𝐕|×NAsuperscript𝐕subscript𝑁𝐴\mathbb{R}^{|\mathbf{V}|\times N_{A}}blackboard_R start_POSTSUPERSCRIPT | bold_V | × italic_N start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT end_POSTSUPERSCRIPT. In this context, |𝐕|𝐕|\mathbf{V}|| bold_V | indicates the total number of nodes in the road network, while NAsubscript𝑁𝐴N_{A}italic_N start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT represents the maximum number of adjacent edges to any node. This padding approach enables batch training combined with smart masking techniques.

4.3 Knowledge Graph Module

After data preprocessing, we designed a Knowledge Graph Module that adapts the KG to the road network, which learns the complex spatial relationships between road links and therefore more accurately estimate the probability of each link as part of the future route xfsuperscript𝑥𝑓x^{f}italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT, given an observed route xosuperscript𝑥𝑜x^{o}italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT. Formally, given a road network 𝐆𝐆\mathbf{G}bold_G and an observed route xo𝒳osuperscript𝑥𝑜superscript𝒳𝑜x^{o}\in\mathcal{X}^{o}italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT ∈ caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT, the module outputs ΓsuperscriptΓ\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT probability distributions Pr(𝒳f~)={Pr(xf,γ~)}γ=1ΓPr~superscript𝒳𝑓superscriptsubscriptPr~superscript𝑥𝑓𝛾𝛾1superscriptΓ\mathrm{Pr}(\widetilde{\mathcal{X}^{f}})=\left\{\mathrm{Pr}\left(\widetilde{x^% {f,\gamma}}\right)\right\}_{\gamma=1}^{\Gamma^{\prime}}roman_Pr ( over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG ) = { roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT end_ARG ) } start_POSTSUBSCRIPT italic_γ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT. Each distribution indicates the probability of a link being part of future routes, with the γ𝛾\gammaitalic_γ-th distribution indicating the likelihood of each road link being the γ𝛾\gammaitalic_γ-th link in those future routes, where γ=1,2,,Γ𝛾12superscriptΓ\gamma=1,2,\dots,\Gamma^{\prime}italic_γ = 1 , 2 , … , roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT.

Intuitively, a driver’s route choice is based on their intended goal. Therefore, using KGC for route prediction aligns with the logic behind drivers’ route selections. However, most existing KGs are designed for search engines (Xiong et al. 2017) and text-based Question Answering (Huang et al. 2019), making them unsuitable for direct application to road networks. Therefore, we need to construct a KG tailored to the characteristics of road networks, redefine the KGC problem in this context, and use learned spatial relations for more accurate route prediction. These tasks are encompassed in three submodules we’ve designed: Knowledge Graph Construction, Knowledge Graph Representation Learning, and Future Route Prediction through KGC. We will detail these in the following subsections.

4.3.1 Knowledge Graph Construction

To design a KG 𝒢𝒢\mathcal{G}caligraphic_G tailored for road networks and route prediction, we first need to select the crucial spatial and structural features in road networks. The desired KG should preserve the spatial relations amongst the identified entities while maintaining its applicability and generalizability across fine-grained scenarios on the road networks. In alignment with this objective, the selection focuses solely on those entities and relations that pervade all road networks and routing contexts. A detailed explanation of the entity and relation selection processes is provided below.

Entity selection

When constructing the KG 𝒢𝒢\mathcal{G}caligraphic_G for road networks and routes, the initial key step is to identify entities \mathcal{E}caligraphic_E. In the context of a road network, the predominant entity is the link. Every link e𝑒eitalic_e is characterized by their unique identifiers and associated attributes such as length or connectivity. Selecting links as the sole entities reflects their intrinsic importance within the road network. It ensures the broad generalizability of the resulting KG across various routing contexts and scenarios, contributing to the applicability of the proposed approach.

Relation selection

As discussed earlier, route prediction is reformulated as a KGC problem. Consequently, base on the selected entities (i.e., links), the relations \mathcal{R}caligraphic_R chosen for the road network should reflect and preserve the following features: (1) the spatial and structural properties of the road network, and (2) the consistency and preference patterns observed in drivers’ route selections. Given this, we identify four relations to construct the KG: connectivity, consistency, distance, and direction. Each relation offers unique insights into the relation between links within the road network. Connectivity describes the topological structure of links in the road network. A “ConnectBy” relation csubscript𝑐\mathcal{R}_{c}caligraphic_R start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT is established between two links if they are directly connected via a shared node. The “ConsistentWith” relation ssubscript𝑠\mathcal{R}_{s}caligraphic_R start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT is derived from observed routes, capturing the co-occurrence of two links within the same routes. A higher co-occurrence rate indicates a stronger “ConsistentWith” relation, providing an empirical basis for capturing real-world routing patterns. The spatial distance between two links forms another key “DistanceTo” relation asubscript𝑎\mathcal{R}_{a}caligraphic_R start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT. It is crucial in many scenarios where the physical proximity of links impacts route selection and planning. Lastly, the direction forms the most critical “DirectionTo” relation dsubscript𝑑\mathcal{R}_{d}caligraphic_R start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT from a navigational standpoint. It provides essential directional information between links, greatly enhancing the graph’s utility for various routing tasks.

The four major spatial relation types are summarized in Table 1. By comprehensively capturing these four types of relations over the identified entities, the KG possesses a rich and nuanced representation of the road network, which could facilitate various advanced routing tasks.

Table 1: Major spatial relation types and corresponding notations and data sources of the constructed KG. A major relation type may contain multiple relations. For example, the relation type “DirectionTo” contains Ndsubscript𝑁𝑑N_{d}italic_N start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT directions, indicating a total of Ndsubscript𝑁𝑑N_{d}italic_N start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT direction relations.
Relation Notation Data Source
ConnectBy csuperscript𝑐\mathcal{R}^{c}caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT Road Network 𝐆𝐆\mathbf{G}bold_G
ConsistentWith ssuperscript𝑠\mathcal{R}^{s}caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT Road Network 𝐆𝐆\mathbf{G}bold_G, Observed routes 𝒳osuperscript𝒳𝑜\mathcal{X}^{o}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT
DistanceTo asuperscript𝑎\mathcal{R}^{a}caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT Road Network 𝐆𝐆\mathbf{G}bold_G
DirectionTo dsuperscript𝑑\mathcal{R}^{d}caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT Road Network 𝐆𝐆\mathbf{G}bold_G

4.3.2 Knowledge Graph Representation Learning

Spatial relations between entities (i.e. links) on a road network should be route-agnostic. This means that these relations should be independent of specific routes and instead solely reflect the spatial attributes of the road network itself. These relations also need to be encoded efficiently to support training and inference. One common approach is to employ KG embedding techniques, which aims to find embedding functions subscript\mathcal{M}_{\mathcal{E}}caligraphic_M start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT, subscript\mathcal{M}_{\mathcal{R}}caligraphic_M start_POSTSUBSCRIPT caligraphic_R end_POSTSUBSCRIPT that maps each entity and each relation in to an feature vector. The embedding function ()subscript\mathcal{M}_{\mathcal{E}}(\cdot)caligraphic_M start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT ( ⋅ ) and ()subscript\mathcal{M}_{\mathcal{E}}(\cdot)caligraphic_M start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT ( ⋅ ) should preserve the inherent property of 𝒢𝒢\mathcal{G}caligraphic_G. However, road networks exhibit complex relations, as illustrated in Figure 3, involving many-to-many relations. To address this complexity, we modify and adapt the translation distance model TransH (Bordes et al. 2013) to 𝒢𝒢\mathcal{G}caligraphic_G in our study. This enables us to effectively learn the vector representations of both entities and relations in the knowledge graph 𝒢𝒢\mathcal{G}caligraphic_G.

Refer to caption
Figure 3: An illustration of spatial relations, all of which are many-to-many.

To enable KG representation learning, we first need to construct the sets of positive triplets ΔΔ\Deltaroman_Δ and negative triplets ΔsuperscriptΔ\Delta^{\prime}roman_Δ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT for each relation type. To facilitate batch representation learning and ensure comprehensive learning of all entities and relations, we employ a Random Sampling-based method for KG representation learning. The subsequent paragraphs will offer detailed description of the positive and negative triplet sets’ construction processes for each relation type in 𝒢𝒢\mathcal{G}caligraphic_G.

ConnectBy csuperscript𝑐\mathcal{R}^{c}caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT

For csuperscript𝑐\mathcal{R}^{c}caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT, positive triplets ΔcsubscriptΔsuperscript𝑐\Delta_{\mathcal{R}^{c}}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT are sampled from adjacent edges in spatial graph 𝐆𝐆\mathbf{G}bold_G, linked by “ConnectBy”. Negative triplets ΔcsubscriptsuperscriptΔsuperscript𝑐\Delta^{\prime}_{\mathcal{R}^{c}}roman_Δ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, conversely, are sampled from non-adjacent edges.

ConsistentWith ssuperscript𝑠\mathcal{R}^{s}caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT

The ‘ConsistentWith’ relation ssuperscript𝑠\mathcal{R}^{s}caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT, identifies co-occurring links in the same routes, indicating inter-links transition patterns. To construct ΔssubscriptΔsuperscript𝑠\Delta_{\mathcal{R}^{s}}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT and ΔssubscriptsuperscriptΔsuperscript𝑠\Delta^{\prime}_{\mathcal{R}^{s}}roman_Δ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, we utilize the spatial graph 𝐆𝐆\mathbf{G}bold_G and observed routes 𝒳osuperscript𝒳𝑜\mathcal{X}^{o}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT. The positive set ΔssubscriptΔsuperscript𝑠\Delta_{\mathcal{R}^{s}}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT consists of edges appearing together in observed routes, while the negative set ΔssubscriptsuperscriptΔsuperscript𝑠\Delta^{\prime}_{\mathcal{R}^{s}}roman_Δ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT is formed by randomly sampling edges from 𝐆𝐆\mathbf{G}bold_G.

DistanceTo asuperscript𝑎\mathcal{R}^{a}caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT

For the ‘DistanceTo’ relation asuperscript𝑎\mathcal{R}^{a}caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT, sampling is done from observed routes 𝒳osuperscript𝒳𝑜\mathcal{X}^{o}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT, better aligning the “DistanceTo” relation with route prediction and reducing the possible asuperscript𝑎\mathcal{R}^{a}caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT relations. The resulting sets are ΔasubscriptΔsuperscript𝑎\Delta_{\mathcal{R}^{a}}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT end_POSTSUBSCRIPT and ΔasubscriptsuperscriptΔsuperscript𝑎\Delta^{\prime}_{\mathcal{R}^{a}}roman_Δ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT end_POSTSUBSCRIPT for positive and negative triplets, respectively.

DirectionTo dsuperscript𝑑\mathcal{R}^{d}caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT

We need the inter-link direction matrix 𝐃𝐃\mathbf{D}bold_D to construct positive and negative triplet sets ΔdsubscriptΔsuperscript𝑑\Delta_{\mathcal{R}^{d}}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT and ΔdsubscriptsuperscriptΔsuperscript𝑑\Delta^{\prime}_{\mathcal{R}^{d}}roman_Δ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT. For sampled edges ei,ej𝐄superscript𝑒𝑖superscript𝑒𝑗𝐄e^{i},e^{j}\in\mathbf{E}italic_e start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT , italic_e start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT ∈ bold_E, their relative direction rdsuperscript𝑟𝑑r^{d}italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT is given by rd=𝐃eiejsuperscript𝑟𝑑subscript𝐃superscript𝑒𝑖superscript𝑒𝑗r^{d}=\mathbf{D}_{e^{i}e^{j}}italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT = bold_D start_POSTSUBSCRIPT italic_e start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT italic_e start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, forming the positive set. The negative set is similarly formed from edge pairs that contradict the directional relation in 𝐃𝐃\mathbf{D}bold_D.

We denote the positive triplet sets for all relations as ΔsubscriptΔsuperscript\Delta_{\mathcal{R}^{\cdot}}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT and the negative sets as ΔsuperscriptsubscriptΔsuperscript\Delta_{\mathcal{R}^{\cdot}}^{\prime}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT. Consider an identified type of relation superscript\mathcal{R}^{\cdot}caligraphic_R start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT, and we incorporate two trainable weight matrices. One matrix functions as the relation embedding matrix, represented as 𝐖||×δsubscript𝐖superscriptsuperscriptsuperscriptsubscript𝛿superscript\mathbf{W}_{\mathcal{R}^{\cdot}}\in\mathbb{R}^{|\mathcal{R}^{\cdot}|\times% \delta_{\mathcal{R}^{\cdot}}}bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT | caligraphic_R start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT | × italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, while the other corresponds to the relation hyperplane, denoted as 𝐏subscript𝐏superscript\mathbf{P}_{\mathcal{R}^{\cdot}}bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, both maintaining congruent dimensions. Given the sets of positive triplets ΔsubscriptΔ\Delta_{\cdot}roman_Δ start_POSTSUBSCRIPT ⋅ end_POSTSUBSCRIPT and negative triplets ΔsuperscriptsubscriptΔ\Delta_{\cdot}^{\prime}roman_Δ start_POSTSUBSCRIPT ⋅ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, where \cdot can represent any of the relations on the KG, the representation learning process involves the following steps. For any triplet (h,r,t)Δ𝑟𝑡subscriptΔ(h,r,t)\in\Delta_{\cdot}( italic_h , italic_r , italic_t ) ∈ roman_Δ start_POSTSUBSCRIPT ⋅ end_POSTSUBSCRIPT and (h,r,t)Δsuperscriptsuperscript𝑟superscript𝑡subscriptsuperscriptΔ(h^{\prime},r^{\prime},t^{\prime})\in\Delta^{\prime}_{\cdot}( italic_h start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT , italic_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT , italic_t start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) ∈ roman_Δ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT ⋅ end_POSTSUBSCRIPT, we use 𝐡𝐡\mathbf{h}bold_h, 𝐫𝐫\mathbf{r}bold_r, 𝐭𝐭\mathbf{t}bold_t, 𝐡superscript𝐡\mathbf{h}^{\prime}bold_h start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, 𝐫superscript𝐫\mathbf{r}^{\prime}bold_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, and 𝐭superscript𝐭\mathbf{t}^{\prime}bold_t start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT denoted their embeddings and use 𝐩rsuperscript𝐩𝑟\mathbf{p}^{r}bold_p start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT and 𝐩rsuperscript𝐩superscript𝑟\mathbf{p}^{r^{\prime}}bold_p start_POSTSUPERSCRIPT italic_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT to denote the hyperplane of relation r𝑟ritalic_r and rsuperscript𝑟r^{\prime}italic_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT with (𝐩r)superscriptsuperscript𝐩𝑟top\left(\mathbf{p}^{r}\right)^{\top}( bold_p start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT and (𝐩r)superscriptsuperscript𝐩superscript𝑟top\left(\mathbf{p}^{r^{\prime}}\right)^{\top}( bold_p start_POSTSUPERSCRIPT italic_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT as their transposes. Then we carry out the process defined by Eq. (4) for all relations present on the KG. The loss function for the KG 𝒢𝒢\mathcal{G}caligraphic_G’s representation learning is:

rep=Δ,Δ{(Δ,Δ)}(h,r,t)Δ(h,r,t)Δ[\displaystyle\mathcal{L}_{rep}=\sum_{\Delta,\Delta^{\prime}\in\left\{(\Delta_{% \mathcal{R}^{\cdot}},\Delta_{\mathcal{R}^{\cdot}}^{\prime})\right\}}\sum_{(h,r% ,t)\in\Delta}\sum_{(h^{\prime},r^{\prime},t^{\prime})\in\Delta^{\prime}}\Biggl% {[}caligraphic_L start_POSTSUBSCRIPT italic_r italic_e italic_p end_POSTSUBSCRIPT = ∑ start_POSTSUBSCRIPT roman_Δ , roman_Δ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∈ { ( roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT , roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) } end_POSTSUBSCRIPT ∑ start_POSTSUBSCRIPT ( italic_h , italic_r , italic_t ) ∈ roman_Δ end_POSTSUBSCRIPT ∑ start_POSTSUBSCRIPT ( italic_h start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT , italic_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT , italic_t start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) ∈ roman_Δ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT [  (𝐡(𝐩r)𝐡𝐩r)+𝐫(𝐭(𝐩r)𝐭𝐩r) 1+ψsubscriptnorm 𝐡superscriptsuperscript𝐩𝑟topsuperscript𝐡𝐩𝑟𝐫𝐭superscriptsuperscript𝐩𝑟topsuperscript𝐭𝐩𝑟 subscript1limit-from𝜓\displaystyle\left\|\text{ }\left(\mathbf{h}-\left(\mathbf{p}^{r}\right)^{\top% }\mathbf{h}\mathbf{p}^{r}\right)+\mathbf{r}-\left(\mathbf{t}-\left(\mathbf{p}^% {r}\right)^{\top}\mathbf{t}\mathbf{p}^{r}\right)\text{ }\right\|_{\ell_{1}}+\psi-∥ ( bold_h - ( bold_p start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT bold_hp start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT ) + bold_r - ( bold_t - ( bold_p start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT bold_tp start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT ) ∥ start_POSTSUBSCRIPT roman_ℓ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT end_POSTSUBSCRIPT + italic_ψ - (4)
 (𝐡(𝐩r)𝐡𝐩r)+𝐫(𝐭(𝐩r)𝐭𝐩r) 1 ]+,\displaystyle\left\|\text{ }\left(\mathbf{h}^{\prime}-\left(\mathbf{p}^{r^{% \prime}}\right)^{\top}\mathbf{h}^{\prime}\mathbf{p}^{r^{\prime}}\right)+% \mathbf{r}^{\prime}-\left(\mathbf{t}^{\prime}-\left(\mathbf{p}^{r^{\prime}}% \right)^{\top}\mathbf{t}^{\prime}\mathbf{p}^{r^{\prime}}\right)\text{ }\right% \|_{\ell_{1}}\text{ }\Biggr{]}_{+},∥ ( bold_h start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT - ( bold_p start_POSTSUPERSCRIPT italic_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT bold_h start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT bold_p start_POSTSUPERSCRIPT italic_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT ) + bold_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT - ( bold_t start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT - ( bold_p start_POSTSUPERSCRIPT italic_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT bold_t start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT bold_p start_POSTSUPERSCRIPT italic_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT ) ∥ start_POSTSUBSCRIPT roman_ℓ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT end_POSTSUBSCRIPT ] start_POSTSUBSCRIPT + end_POSTSUBSCRIPT ,

Eq. (4) defines the margin loss repsubscript𝑟𝑒𝑝\mathcal{L}_{rep}caligraphic_L start_POSTSUBSCRIPT italic_r italic_e italic_p end_POSTSUBSCRIPT, which calculates the difference in scores between positive and negative triplets. The margin ψ𝜓\psiitalic_ψ ensures a separation between the scores of positive and negative triplets. Before each batch training starts, we impose a constraint to ensure that 𝐩rsuperscript𝐩𝑟\textbf{p}^{r}p start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT and 𝐩rsuperscript𝐩superscript𝑟\textbf{p}^{r^{\prime}}p start_POSTSUPERSCRIPT italic_r start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT are unit normal vectors by projecting them to the unit 2subscript2\ell_{2}roman_ℓ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT-ball: r,𝐩r2=1formulae-sequencefor-all𝑟subscriptnormsuperscript𝐩𝑟21\forall r\in\mathcal{R},\left\|\mathbf{p}^{r}\right\|_{2}=1∀ italic_r ∈ caligraphic_R , ∥ bold_p start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT ∥ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = 1.

4.3.3 Future Route Prediction through Knowledge Graph Completion

Our study approaches the task of future route prediction by framing it as a KGC problem. As shown in Figure 4, given the last link eiΓsuperscriptsubscript𝑒𝑖Γe_{i}^{\Gamma}italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT (i.e., head entity) of the i𝑖iitalic_i-th observed route xiosubscriptsuperscript𝑥𝑜𝑖x^{o}_{i}italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and the (estimated or actual) direction of movement (i.e., relation), our objective is to infer the future route xif^^subscriptsuperscript𝑥𝑓𝑖\widehat{x^{f}_{i}}over^ start_ARG italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG (i.e., tail entity) that the vehicle will traverse. In our case, the actual direction ridsubscriptsuperscript𝑟𝑑𝑖r^{d}_{i}italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT of a vehicle’s movement is the direction from the current link to the last link of the future route. Utilizing KGC, we introduce an innovative objective to predict the immediate future routes of road users. This addition not only utilizes the learned KG embeddings to enhance route prediction accuracy but also enriches the KG representation with deeper semantics, thereby creating a synergistic effect between KG embedding and route prediction.

Refer to caption
Figure 4: An illustration of knowledge graph completion for future route prediction.

For illustration, we consider the i𝑖iitalic_i-th observed route xio𝒳osubscriptsuperscript𝑥𝑜𝑖superscript𝒳𝑜x^{o}_{i}\in\mathcal{X}^{o}italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT and the corresponding direction xio,d𝒳o,dsubscriptsuperscript𝑥𝑜𝑑𝑖superscript𝒳𝑜𝑑x^{o,d}_{i}\in\mathcal{X}^{o,d}italic_x start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ caligraphic_X start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT, drawn from the set of observed routes 𝒳osuperscript𝒳𝑜\mathcal{X}^{o}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT and directions 𝒳o,dsuperscript𝒳𝑜𝑑\mathcal{X}^{o,d}caligraphic_X start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT, respectively. Here, xio={eij}j=1Γsubscriptsuperscript𝑥𝑜𝑖subscriptsuperscriptsubscriptsuperscript𝑒𝑗𝑖Γ𝑗1x^{o}_{i}=\{e^{j}_{i}\}^{\Gamma}_{j=1}italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = { italic_e start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT } start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT and xio,d={eid,j}j=Γ+1Γ+Γsubscriptsuperscript𝑥𝑜𝑑𝑖superscriptsubscriptsubscriptsuperscript𝑒𝑑𝑗𝑖𝑗Γ1ΓsuperscriptΓx^{o,d}_{i}=\{e^{d,j}_{i}\}_{j=\Gamma+1}^{\Gamma+\Gamma^{\prime}}italic_x start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = { italic_e start_POSTSUPERSCRIPT italic_d , italic_j end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT } start_POSTSUBSCRIPT italic_j = roman_Γ + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT. Initially, we extract the embeddings of all elements of xosuperscript𝑥𝑜x^{o}italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT and xo,dsuperscript𝑥𝑜𝑑x^{o,d}italic_x start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT by multiplying their respective one-hot vectors with the corresponding trainable embedding matrices: 𝐖||×δsubscript𝐖superscriptsubscript𝛿\mathbf{W}_{\mathcal{E}}\in\mathbb{R}^{|\mathcal{E}|\times\delta_{\mathcal{E}}}bold_W start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT | caligraphic_E | × italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and 𝐖d|d|×δdsubscript𝐖superscript𝑑superscriptsuperscript𝑑subscript𝛿superscript𝑑\mathbf{W}_{\mathcal{R}^{d}}\in\mathbb{R}^{|\mathcal{R}^{d}|\times\delta_{% \mathcal{R}^{d}}}bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT | caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT | × italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_POSTSUPERSCRIPT. The resulting embeddings for xiosubscriptsuperscript𝑥𝑜𝑖x^{o}_{i}italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and xio,dsubscriptsuperscript𝑥𝑜𝑑𝑖x^{o,d}_{i}italic_x start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT are denoted as 𝐱io={𝐞ij}j=1Γ\mathbf{x}^{o}_{i}=\{\mathbf{e}^{j}_{i}\|\}_{j=1}^{\Gamma}bold_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = { bold_e start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ } start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT and 𝐱io,d={𝐞id,j}j=Γ+1Γ+Γ\mathbf{x}^{o,d}_{i}=\{\mathbf{e}^{d,j}_{i}\|\}_{j=\Gamma+1}^{\Gamma+\Gamma^{% \prime}}bold_x start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = { bold_e start_POSTSUPERSCRIPT italic_d , italic_j end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ } start_POSTSUBSCRIPT italic_j = roman_Γ + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT, with 𝐞iδsuperscriptsubscript𝐞𝑖superscriptsubscript𝛿\mathbf{e}_{i}^{\cdot}\in\mathbb{R}^{\delta_{\mathcal{E}}}bold_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, 𝐞id,δdsubscriptsuperscript𝐞𝑑𝑖superscriptsubscript𝛿superscript𝑑\mathbf{e}^{d,\cdot}_{i}\in\mathbb{R}^{\delta_{\mathcal{R}^{d}}}bold_e start_POSTSUPERSCRIPT italic_d , ⋅ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_POSTSUPERSCRIPT. To predict the direction of the vehicle’s future routes, we utilize a Multi-layer Perceptron (MLP) (Popescu et al. 2009) to encode 𝐱iosubscriptsuperscript𝐱𝑜𝑖\mathbf{x}^{o}_{i}bold_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and 𝐱io,dsubscriptsuperscript𝐱𝑜𝑑𝑖\mathbf{x}^{o,d}_{i}bold_x start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT:

rid^=argmax(MLPd(𝐱io  𝐱io,d)),^subscriptsuperscript𝑟𝑑𝑖argmaxsubscriptMLP𝑑conditionalsubscriptsuperscript𝐱𝑜𝑖  subscriptsuperscript𝐱𝑜𝑑𝑖\widehat{r^{d}_{i}}=\operatorname*{argmax}\left(\textsc{MLP}_{d}\left(\mathbf{% x}^{o}_{i}\text{ }\|\text{ }\mathbf{x}^{o,d}_{i}\right)\right),over^ start_ARG italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG = roman_argmax ( MLP start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ( bold_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ bold_x start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ) , (5)

where rid^^subscriptsuperscript𝑟𝑑𝑖\widehat{r^{d}_{i}}over^ start_ARG italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG represents the estimated direction of the i𝑖iitalic_i-th future route, and we employ the cross-entropy loss to optimize the parameters of the MLPdsubscriptMLP𝑑\mathrm{MLP}_{d}roman_MLP start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT:

d=logSoftmax(MLPd(xio  𝐱io,d))[rid]subscript𝑑SoftmaxsubscriptMLP𝑑conditionalsubscriptsuperscript𝑥𝑜𝑖  subscriptsuperscript𝐱𝑜𝑑𝑖delimited-[]subscriptsuperscript𝑟𝑑𝑖\mathcal{L}_{d}=-\log\mathrm{Softmax}\left(\mathrm{MLP}_{d}\left({x}^{o}_{i}% \text{ }\|\text{ }\mathbf{x}^{o,d}_{i}\right)\right)\left[r^{d}_{i}\right]caligraphic_L start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT = - roman_log roman_Softmax ( roman_MLP start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ( italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ bold_x start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ) [ italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ] (6)

It should be noted that the estimation of the vehicle’s future route direction is only necessary when the goal is unspecified (i.e., subproblem 1). Conversely, when the goal direction or the actual goal is provided, one can directly utilize the given goal direction (i.e., subproblems 2 and 3).

To employ KGC to predict future routes, the last link eiΓsuperscriptsubscript𝑒𝑖Γe_{i}^{\Gamma}italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT is converted into the corresponding entity embedding by multiplying the one-hot vector of eiΓsuperscriptsubscript𝑒𝑖Γe_{i}^{\Gamma}italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT with 𝐖subscript𝐖\mathbf{W}_{\mathcal{E}}bold_W start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT, yielding 𝐞iΓδsuperscriptsubscript𝐞𝑖Γsuperscriptsubscript𝛿\mathbf{e}_{i}^{\Gamma}\in\mathbb{R}^{\delta_{\mathcal{E}}}bold_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT. Then, 𝐫idδdsubscriptsuperscript𝐫𝑑𝑖superscriptsubscript𝛿superscript𝑑\mathbf{r}^{d}_{i}\in\mathbb{R}^{\delta_{\mathcal{R}^{d}}}bold_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and 𝐩idδdsubscriptsuperscript𝐩𝑑𝑖superscriptsubscript𝛿superscript𝑑\mathbf{p}^{d}_{i}\in\mathbb{R}^{\delta_{\mathcal{R}^{d}}}bold_p start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_POSTSUPERSCRIPT are obtained through a similar operation with 𝐖dsubscript𝐖superscript𝑑\mathbf{W}_{\mathcal{R}^{d}}bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT and 𝐏dsubscript𝐏superscript𝑑\mathbf{P}_{\mathcal{R}^{d}}bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, respectively. Note that in this stage, RouteKG only needs the current position of a vehicle (i.e., the last link of the observed route), which is fundamentally different from existing seq2seq methods. Given 𝐩idsubscriptsuperscript𝐩𝑑𝑖\mathbf{p}^{d}_{i}bold_p start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, we first project the 𝐞iΓδsuperscriptsubscript𝐞𝑖Γsuperscriptsubscript𝛿\mathbf{e}_{i}^{\Gamma}\in\mathbb{R}^{\delta_{\mathcal{E}}}bold_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and all links embeddings 𝐞||×δ𝐞superscriptsubscript𝛿\mathbf{e}\in\mathbb{R}^{|\mathcal{E}|\times\delta_{\mathcal{E}}}bold_e ∈ blackboard_R start_POSTSUPERSCRIPT | caligraphic_E | × italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT to the hyperplane 𝐩idsubscriptsuperscript𝐩𝑑𝑖\mathbf{p}^{d}_{i}bold_p start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to obtain the projected head embedding 𝐞i,Γsuperscriptsubscript𝐞𝑖perpendicular-toΓ\mathbf{e}_{i,\perp}^{\Gamma}bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT and all candidate tail embedding 𝐞subscript𝐞perpendicular-to\mathbf{e}_{\perp}bold_e start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT on the hyperplane:

𝐞i,Γsuperscriptsubscript𝐞𝑖perpendicular-toΓ\displaystyle\mathbf{e}_{i,\perp}^{\Gamma}bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT =𝐞iΓ(𝐩id)𝐞iΓ𝐩id,absentsubscriptsuperscript𝐞Γ𝑖superscriptsubscriptsuperscript𝐩𝑑𝑖topsubscriptsuperscript𝐞Γ𝑖subscriptsuperscript𝐩𝑑𝑖\displaystyle=\mathbf{e}^{\Gamma}_{i}-{\left(\mathbf{p}^{d}_{i}\right)}^{\top}% \mathbf{e}^{\Gamma}_{i}{\mathbf{p}^{d}_{i}},= bold_e start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - ( bold_p start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT bold_e start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT bold_p start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , (7)
𝐞subscript𝐞perpendicular-to\displaystyle\mathbf{e}_{\perp}bold_e start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT =𝐞(𝐩id)𝐞 𝐩id,absent𝐞superscriptsubscriptsuperscript𝐩𝑑𝑖top𝐞 subscriptsuperscript𝐩𝑑𝑖\displaystyle=\mathbf{e}-{\left(\mathbf{p}^{d}_{i}\right)}^{\top}\mathbf{e}% \text{ }{\mathbf{p}^{d}_{i}},= bold_e - ( bold_p start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT bold_e bold_p start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ,

where 𝐞i,Γδsuperscriptsubscript𝐞𝑖perpendicular-toΓsuperscriptsubscript𝛿\mathbf{e}_{i,\perp}^{\Gamma}\in\mathbb{R}^{\delta_{\mathcal{E}}}bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and 𝐞||×δsubscript𝐞perpendicular-tosuperscriptsubscript𝛿\mathbf{e}_{\perp}\in\mathbb{R}^{|\mathcal{E}|\times\delta_{\mathcal{E}}}bold_e start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT | caligraphic_E | × italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT.

Upon acquiring the projected head embedding 𝐞i,Γsuperscriptsubscript𝐞𝑖perpendicular-toΓ\mathbf{e}_{i,\perp}^{\Gamma}bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT, we add the relation to the projected head embedding to query the tail entity. Given the projected head embedding 𝐞i,Γsuperscriptsubscript𝐞𝑖perpendicular-toΓ\mathbf{e}_{i,\perp}^{\Gamma}bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT, the direction relation embedding 𝐫idsubscriptsuperscript𝐫𝑑𝑖\mathbf{r}^{d}_{i}bold_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, and the distance relation embedding 𝐫ia,γsubscriptsuperscript𝐫𝑎𝛾𝑖\mathbf{r}^{a,\gamma}_{i}bold_r start_POSTSUPERSCRIPT italic_a , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, we could query the tail entity based on the following equation:

Pr(xif,γ~)=Softmax(𝐞[(𝐞i,Γ+𝐫id)𝐫ia,γ]),Pr~subscriptsuperscript𝑥𝑓𝛾𝑖Softmaxsubscript𝐞perpendicular-tosuperscriptdelimited-[]direct-productsuperscriptsubscript𝐞𝑖perpendicular-toΓsubscriptsuperscript𝐫𝑑𝑖subscriptsuperscript𝐫𝑎𝛾𝑖top\mathrm{Pr}\left(\widetilde{x^{f,\gamma}_{i}}\right)=\mathrm{Softmax}\left(% \mathbf{e}_{\perp}\cdot\left[\left(\mathbf{e}_{i,\perp}^{\Gamma}+\mathbf{r}^{d% }_{i}\right)\odot\mathbf{r}^{a,\gamma}_{i}\right]^{\top}\right),roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ) = roman_Softmax ( bold_e start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT ⋅ [ ( bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT + bold_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ⊙ bold_r start_POSTSUPERSCRIPT italic_a , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ] start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT ) , (8)

where Pr(xif,γ~)||Pr~subscriptsuperscript𝑥𝑓𝛾𝑖superscript\mathrm{Pr}\left(\widetilde{x^{f,\gamma}_{i}}\right)\in\mathbb{R}^{|\mathcal{E% }|}roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ) ∈ blackboard_R start_POSTSUPERSCRIPT | caligraphic_E | end_POSTSUPERSCRIPT is the predicted probability distribution which indicates the likelihood of each link being the γ𝛾\gammaitalic_γ-th link of the i𝑖iitalic_i-th future route. We can set γ𝛾\gammaitalic_γ from 1 to ΓsuperscriptΓ\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT and recursively use Eq. (6) to obtain ΓsuperscriptΓ\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT probability distributions {Pr(xif,γ~)}γ=1ΓsuperscriptsubscriptPr~subscriptsuperscript𝑥𝑓𝛾𝑖𝛾1superscriptΓ\left\{\mathrm{Pr}(\widetilde{x^{f,\gamma}_{i}})\right\}_{\gamma=1}^{\Gamma^{% \prime}}{ roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ) } start_POSTSUBSCRIPT italic_γ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT representing the estimated future route probabilities, which is the final output of the module.

For route prediction with complete goal information (i.e., subproblem 3), we make a subtle change to Eq. (8) by simply add the projected the tail entity (i.e., goal) embedding 𝐞i,Γ+Γsuperscriptsubscript𝐞𝑖perpendicular-toΓsuperscriptΓ\mathbf{e}_{i,\perp}^{\Gamma+\Gamma^{\prime}}bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT to the head embedding 𝐞i,Γsuperscriptsubscript𝐞𝑖perpendicular-toΓ\mathbf{e}_{i,\perp}^{\Gamma}bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT. The tail entity quering process could be updated as:

Pr(xif,γ~)=Softmax(𝐞[(𝐞i,Γ+𝐞i,Γ+Γ+𝐫id)𝐫ia,γ]),Pr~subscriptsuperscript𝑥𝑓𝛾𝑖Softmaxsubscript𝐞perpendicular-tosuperscriptdelimited-[]direct-productsuperscriptsubscript𝐞𝑖perpendicular-toΓsuperscriptsubscript𝐞𝑖perpendicular-toΓsuperscriptΓsubscriptsuperscript𝐫𝑑𝑖subscriptsuperscript𝐫𝑎𝛾𝑖top\mathrm{Pr}\left(\widetilde{x^{f,\gamma}_{i}}\right)=\mathrm{Softmax}\left(% \mathbf{e}_{\perp}\cdot\left[\left(\mathbf{e}_{i,\perp}^{\Gamma}+\mathbf{e}_{i% ,\perp}^{\Gamma+\Gamma^{\prime}}+\mathbf{r}^{d}_{i}\right)\odot\mathbf{r}^{a,% \gamma}_{i}\right]^{\top}\right),roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ) = roman_Softmax ( bold_e start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT ⋅ [ ( bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT + bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT + bold_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ⊙ bold_r start_POSTSUPERSCRIPT italic_a , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ] start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT ) , (9)

To optimize the KG embeddings, the loss of the future route prediction is defined as:

pred=i=1|𝒳|γ=1ΓlogPr(xif,γ~)[xif,γ],subscript𝑝𝑟𝑒𝑑superscriptsubscript𝑖1𝒳superscriptsubscript𝛾1superscriptΓPr~subscriptsuperscript𝑥𝑓𝛾𝑖delimited-[]superscriptsubscript𝑥𝑖𝑓𝛾\mathcal{L}_{pred}=-\sum_{i=1}^{|\mathcal{X}|}\sum_{\gamma=1}^{\Gamma^{\prime}% }\log\mathrm{Pr}\left(\widetilde{x^{f,\gamma}_{i}}\right)\left[x_{i}^{f,\gamma% }\right],caligraphic_L start_POSTSUBSCRIPT italic_p italic_r italic_e italic_d end_POSTSUBSCRIPT = - ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT ∑ start_POSTSUBSCRIPT italic_γ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT roman_log roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ) [ italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT ] , (10)

where xif,γsuperscriptsubscript𝑥𝑖𝑓𝛾x_{i}^{f,\gamma}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT is the actual γ𝛾\gammaitalic_γ-th link of the i𝑖iitalic_i-th future route, and []delimited-[][\cdot][ ⋅ ] is the indexing operation that retrieves and maximizes the log-probability of the actual link. Note that xif,γsuperscriptsubscript𝑥𝑖𝑓𝛾x_{i}^{f,\gamma}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT and eiΓ+γsuperscriptsubscript𝑒𝑖Γ𝛾e_{i}^{\Gamma+\gamma}italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + italic_γ end_POSTSUPERSCRIPT indicate the same link in the i𝑖iitalic_i-th future route.

Refer to caption
Figure 5: A demonstration of the Spanning Route algorithm.

4.4 Route Generation Module

Given predicted future route probabilities Pr(𝒳f~)Pr~superscript𝒳𝑓\mathrm{Pr}(\widetilde{\mathcal{X}^{f}})roman_Pr ( over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG ), the Route Generation Module generates multiple possible future routes from these probabilities. An n𝑛nitalic_n-ary tree-based algorithm, Spanning Route, is proposed to generate these future routes based on the predicted probabilities. This algorithm is visualized in Figure 5 through a simplified case where n=2𝑛2n=2italic_n = 2 and only Γ=3Γ3\Gamma=3roman_Γ = 3 predicted future links are illustrated. For each tree node, we designate four attributes: name, parent, end_node, and pred. The name corresponds to the identification of the leaf, while the parent points to the predecessor of the current leaf. The attribute end_node signifies the terminal node of the current predicted link, and pred embodies the present predictions.

Input :  ΓsuperscriptΓ\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT probability distributions {Pr(xif,γ~)}γ=1ΓsuperscriptsubscriptPr~subscriptsuperscript𝑥𝑓𝛾𝑖𝛾1superscriptΓ\left\{\mathrm{Pr}(\widetilde{x^{f,\gamma}_{i}})\right\}_{\gamma=1}^{\Gamma^{% \prime}}{ roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ) } start_POSTSUBSCRIPT italic_γ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT;
road network 𝐆=(𝐕,𝐄)𝐆𝐕𝐄\mathbf{G}=(\mathbf{V},\mathbf{E})bold_G = ( bold_V , bold_E );
NAE matrix 𝐀𝐀\mathbf{A}bold_A;
the tree’s degree n𝑛nitalic_n.
Output :  Top-K𝐾Kitalic_K predicted future routes {xi,kf~}k=1Ksuperscriptsubscript~superscriptsubscript𝑥𝑖𝑘𝑓𝑘1𝐾\left\{\widetilde{x_{i,k}^{f}}\right\}_{k=1}^{K}{ over~ start_ARG italic_x start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT.
1 root \leftarrow CreateNewNode(name = “root”, parent = NIL, end_node = vi,Γssuperscriptsubscript𝑣𝑖Γ𝑠v_{i,\Gamma}^{s}italic_v start_POSTSUBSCRIPT italic_i , roman_Γ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT, pred = NIL)
2 for γ=1,,Γ𝛾1normal-…superscriptnormal-Γnormal-′\gamma=1,\dots,\Gamma^{\prime}italic_γ = 1 , … , roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT do
3       leaves \leftarrow GetLeaves(root)
4       for leaf \in leaves do
5             𝒩end_nodeesuperscriptsubscript𝒩𝑒𝑛𝑑_𝑛𝑜𝑑𝑒𝑒\mathcal{N}_{end\_node}^{e}caligraphic_N start_POSTSUBSCRIPT italic_e italic_n italic_d _ italic_n italic_o italic_d italic_e end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_e end_POSTSUPERSCRIPT = 𝐀[leaf.end_node,:]\mathbf{A}[leaf.end\_node,:]bold_A [ italic_l italic_e italic_a italic_f . italic_e italic_n italic_d _ italic_n italic_o italic_d italic_e , : ]
6             {ei,kΓ+γ}k=1nsuperscriptsubscriptsuperscriptsubscript𝑒𝑖𝑘Γ𝛾𝑘1𝑛\left\{e_{i,k}^{\Gamma+\gamma}\right\}_{k=1}^{n}{ italic_e start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + italic_γ end_POSTSUPERSCRIPT } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT = GetTopK(Pr(xif,γ~)[𝒩end_nodee]Pr~subscriptsuperscript𝑥𝑓𝛾𝑖delimited-[]superscriptsubscript𝒩𝑒𝑛𝑑_𝑛𝑜𝑑𝑒𝑒\mathrm{Pr}(\widetilde{x^{f,\gamma}_{i}})[\mathcal{N}_{end\_node}^{e}]roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ) [ caligraphic_N start_POSTSUBSCRIPT italic_e italic_n italic_d _ italic_n italic_o italic_d italic_e end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_e end_POSTSUPERSCRIPT ], K=n𝐾𝑛K=nitalic_K = italic_n)
7             for k=1,,n𝑘1normal-…𝑛k=1,\dots,nitalic_k = 1 , … , italic_n do
8                   node = CreateNewNode(name = “k𝑘kitalic_k”, parent = leaf, end_node = ei,kΓ+γ[1]superscriptsubscript𝑒𝑖𝑘Γ𝛾delimited-[]1e_{i,k}^{\Gamma+\gamma}[1]italic_e start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + italic_γ end_POSTSUPERSCRIPT [ 1 ], pred = ei,kΓ+γsuperscriptsubscript𝑒𝑖𝑘Γ𝛾e_{i,k}^{\Gamma+\gamma}italic_e start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + italic_γ end_POSTSUPERSCRIPT)
9             end for
10            
11       end for
12      
13 end for
14leaves \leftarrow GetLeaves(root)
15 for k=1,,K𝑘1normal-…𝐾k=1,\dots,Kitalic_k = 1 , … , italic_K do
16       pathksubscriptpath𝑘\text{path}_{k}path start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = Traverse(root, leaves[k𝑘kitalic_k])
17       xi,kf~~superscriptsubscript𝑥𝑖𝑘𝑓\widetilde{x_{i,k}^{f}}over~ start_ARG italic_x start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG = {pathk[i].pred}i=1Γsuperscriptsubscriptsubscriptpath𝑘[i].pred𝑖1superscriptΓ\left\{\text{path}_{k}\text{[i].pred}\right\}_{i=1}^{\Gamma^{\prime}}{ path start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT [i].pred } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT
18      
19 end for
Algorithm 1 Spanning Route.

To formally introduce the Spanning Route algorithm, we provide the pseudo-code for generating the multiple future routes based on the predicted probabilities in Algorithm 1. Specifically, the algorithm encompasses four primary functions. The CreateNewNode function instantiates a new node in the tree given its attributes, while the GetLeaves function takes the root node as input and outputs all leaves of the tree. The GetTopK function retrieves the top-k𝑘kitalic_k predictions given a predicted probability and k𝑘kitalic_k, and the Traverse function applies a tree-based Depth-First Search (DFS) traversal algorithm—specifically a Pre-Order traversal (Tarjan 1972)—to acquire the path from the root to a specified leaf. This last function is instrumental in merging the predicted links into cohesive predicted routes. We note that certain detailed masking and indexing operations have been omitted in the presented pseudo code for clarity. For more details, please refer to the minibatch version of the Spanning Route algorithm 3 detailed in the appendix (B).

4.5 Rank Refinement Module

The top-K𝐾Kitalic_K future routes candidates 𝒳f~={𝒳kf~}k=1K={{xi,kf~}k=1K}i=1|𝒳f|~superscript𝒳𝑓superscriptsubscript~subscriptsuperscript𝒳𝑓𝑘𝑘1𝐾superscriptsubscriptsuperscriptsubscript~superscriptsubscript𝑥𝑖𝑘𝑓𝑘1𝐾𝑖1superscript𝒳𝑓\widetilde{\mathcal{X}^{f}}=\left\{\widetilde{\mathcal{X}^{f}_{k}}\right\}_{k=% 1}^{K}=\left\{\left\{\widetilde{x_{i,k}^{f}}\right\}_{k=1}^{K}\right\}_{i=1}^{% |\mathcal{X}^{f}|}over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG = { over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT = { { over~ start_ARG italic_x start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT | end_POSTSUPERSCRIPT offer an initial selection of possible future routes. However, the dependencies among different links within these routes are solely based on the connectivity of the road network. Given that the consistency and other spatial relations of links within a route also affect people’s choices of routes, a more refined approach is needed for accurate future route prediction. To achieve this, we leverage learned spatial relations \mathcal{R}caligraphic_R to model the dependencies between different links and rerank the candidate routes based on the learned dependencies. This process can be denoted as {𝒳kf^}k=1K=r({𝒳kf~}k=1K,;Θr)superscriptsubscript^subscriptsuperscript𝒳𝑓𝑘𝑘1𝐾subscript𝑟superscriptsubscript~subscriptsuperscript𝒳𝑓𝑘𝑘1𝐾subscriptΘ𝑟\left\{\widehat{\mathcal{X}^{f}_{k}}\right\}_{k=1}^{K}=\mathcal{M}_{r}\left(% \left\{\widetilde{\mathcal{X}^{f}_{k}}\right\}_{k=1}^{K},\mathcal{R};\Theta_{r% }\right){ over^ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT = caligraphic_M start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT ( { over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT , caligraphic_R ; roman_Θ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT ) .

Consider the future routes xif~K×Γ~superscriptsubscript𝑥𝑖𝑓superscript𝐾superscriptΓ\widetilde{x_{i}^{f}}\in\mathbb{R}^{K\times\Gamma^{\prime}}over~ start_ARG italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG ∈ blackboard_R start_POSTSUPERSCRIPT italic_K × roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT. Initially, these routes are encoded by leveraging the embedding matrices 𝐖subscript𝐖\mathbf{W}_{\mathcal{E}}bold_W start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT and 𝐖dsubscript𝐖superscript𝑑\mathbf{W}_{\mathcal{R}^{d}}bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, thereby resulting in the route embedding 𝐱if~K×Γ×δ~subscriptsuperscript𝐱𝑓𝑖superscript𝐾superscriptΓsubscript𝛿\widetilde{\mathbf{x}^{f}_{i}}\in\mathbb{R}^{K\times\Gamma^{\prime}\times% \delta_{\mathcal{E}}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ∈ blackboard_R start_POSTSUPERSCRIPT italic_K × roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT × italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and route direction embedding 𝐱if,d~K×Γ×δd~subscriptsuperscript𝐱𝑓𝑑𝑖superscript𝐾superscriptΓsubscript𝛿superscript𝑑\widetilde{\mathbf{x}^{f,d}_{i}}\in\mathbb{R}^{K\times\Gamma^{\prime}\times% \delta_{\mathcal{R}^{d}}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ∈ blackboard_R start_POSTSUPERSCRIPT italic_K × roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT × italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_POSTSUPERSCRIPT. In the subsequent reranking phase, we prioritize the routes with higher consistency and connectivity, utilizing the spatial relations \mathcal{R}caligraphic_R learned from the Knowledge Graph Module. Specifically, the obtained route embeddings are projected onto the “ConnectBy” and “ConsistentWith” hyperplanes as follows:

𝐱i,cf~~subscriptsuperscript𝐱𝑓𝑖superscriptperpendicular-to𝑐\displaystyle\widetilde{\mathbf{x}^{f}_{i,\perp^{c}}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , ⟂ start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_ARG =𝐱if~(𝐩c)𝐱if~𝐩cabsent~subscriptsuperscript𝐱𝑓𝑖superscriptsuperscript𝐩𝑐top~subscriptsuperscript𝐱𝑓𝑖superscript𝐩𝑐\displaystyle=\widetilde{\mathbf{x}^{f}_{i}}-\left(\mathbf{p}^{c}\right)^{\top% }\widetilde{\mathbf{x}^{f}_{i}}\mathbf{p}^{c}= over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG - ( bold_p start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG bold_p start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT (11)
𝐱i,sf~~subscriptsuperscript𝐱𝑓𝑖superscriptperpendicular-to𝑠\displaystyle\widetilde{\mathbf{x}^{f}_{i,\perp^{s}}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , ⟂ start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_ARG =𝐱if~(𝐩s)𝐱if~𝐩s,absent~subscriptsuperscript𝐱𝑓𝑖superscriptsuperscript𝐩𝑠top~subscriptsuperscript𝐱𝑓𝑖superscript𝐩𝑠\displaystyle=\widetilde{\mathbf{x}^{f}_{i}}-\left(\mathbf{p}^{s}\right)^{\top% }\widetilde{\mathbf{x}^{f}_{i}}\mathbf{p}^{s},= over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG - ( bold_p start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG bold_p start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT ,

where 𝐱i,cf~K×Γ×δ~subscriptsuperscript𝐱𝑓𝑖superscriptperpendicular-to𝑐superscript𝐾superscriptΓsubscript𝛿\widetilde{\mathbf{x}^{f}_{i,\perp^{c}}}\in\mathbb{R}^{K\times\Gamma^{\prime}% \times\delta_{\mathcal{E}}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , ⟂ start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_ARG ∈ blackboard_R start_POSTSUPERSCRIPT italic_K × roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT × italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and 𝐱i,sf~K×Γ×δ~subscriptsuperscript𝐱𝑓𝑖superscriptperpendicular-to𝑠superscript𝐾superscriptΓsubscript𝛿\widetilde{\mathbf{x}^{f}_{i,\perp^{s}}}\in\mathbb{R}^{K\times\Gamma^{\prime}% \times\delta_{\mathcal{E}}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , ⟂ start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_ARG ∈ blackboard_R start_POSTSUPERSCRIPT italic_K × roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT × italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT represent the projected route embeddings.

To quantify the internal consistency and connectivity of the generated routes, related margins for each route are calculated:

𝐫i,marginf,csubscriptsuperscript𝐫𝑓𝑐𝑖𝑚𝑎𝑟𝑔𝑖𝑛\displaystyle\mathbf{r}^{f,c}_{i,margin}bold_r start_POSTSUPERSCRIPT italic_f , italic_c end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , italic_m italic_a italic_r italic_g italic_i italic_n end_POSTSUBSCRIPT =1Γ1j=1Γ1𝐱i,cf~[:,j,:]𝐱i,cf~[:,j+1,:]absent1superscriptΓ1superscriptsubscript𝑗1superscriptΓ1~subscriptsuperscript𝐱𝑓𝑖superscriptperpendicular-to𝑐:𝑗:~subscriptsuperscript𝐱𝑓𝑖superscriptperpendicular-to𝑐:𝑗1:\displaystyle=\frac{1}{\Gamma^{\prime}-1}\sum_{j=1}^{\Gamma^{\prime}-1}% \widetilde{\mathbf{x}^{f}_{i,\perp^{c}}}\left[:,j,:\right]-\widetilde{\mathbf{% x}^{f}_{i,\perp^{c}}}\left[:,j+1,:\right]= divide start_ARG 1 end_ARG start_ARG roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT - 1 end_ARG ∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , ⟂ start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_ARG [ : , italic_j , : ] - over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , ⟂ start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_ARG [ : , italic_j + 1 , : ] (12)
𝐫i,marginf,ssubscriptsuperscript𝐫𝑓𝑠𝑖𝑚𝑎𝑟𝑔𝑖𝑛\displaystyle\mathbf{r}^{f,s}_{i,margin}bold_r start_POSTSUPERSCRIPT italic_f , italic_s end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , italic_m italic_a italic_r italic_g italic_i italic_n end_POSTSUBSCRIPT =1Γ1j=1Γ1𝐱i,sf~[:,j,:]𝐱i,sf~[:,j+1,:],absent1superscriptΓ1superscriptsubscript𝑗1superscriptΓ1~subscriptsuperscript𝐱𝑓𝑖superscriptperpendicular-to𝑠:𝑗:~subscriptsuperscript𝐱𝑓𝑖superscriptperpendicular-to𝑠:𝑗1:\displaystyle=\frac{1}{\Gamma^{\prime}-1}\sum_{j=1}^{\Gamma^{\prime}-1}% \widetilde{\mathbf{x}^{f}_{i,\perp^{s}}}\left[:,j,:\right]-\widetilde{\mathbf{% x}^{f}_{i,\perp^{s}}}\left[:,j+1,:\right],= divide start_ARG 1 end_ARG start_ARG roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT - 1 end_ARG ∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , ⟂ start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_ARG [ : , italic_j , : ] - over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , ⟂ start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_ARG [ : , italic_j + 1 , : ] ,

where 𝐫i,marginf,cK×δsubscriptsuperscript𝐫𝑓𝑐𝑖𝑚𝑎𝑟𝑔𝑖𝑛superscript𝐾subscript𝛿\mathbf{r}^{f,c}_{i,margin}\in\mathbb{R}^{K\times\delta_{\mathcal{E}}}bold_r start_POSTSUPERSCRIPT italic_f , italic_c end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , italic_m italic_a italic_r italic_g italic_i italic_n end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_K × italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT is the connectivity margin and 𝐫i,marginf,sK×δsubscriptsuperscript𝐫𝑓𝑠𝑖𝑚𝑎𝑟𝑔𝑖𝑛superscript𝐾subscript𝛿\mathbf{r}^{f,s}_{i,margin}\in\mathbb{R}^{K\times\delta_{\mathcal{E}}}bold_r start_POSTSUPERSCRIPT italic_f , italic_s end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , italic_m italic_a italic_r italic_g italic_i italic_n end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_K × italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT the consistency margin. Following this, the derived 𝐫marginf,csubscriptsuperscript𝐫𝑓𝑐𝑚𝑎𝑟𝑔𝑖𝑛\mathbf{r}^{f,c}_{margin}bold_r start_POSTSUPERSCRIPT italic_f , italic_c end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_m italic_a italic_r italic_g italic_i italic_n end_POSTSUBSCRIPT and 𝐫marginf,ssubscriptsuperscript𝐫𝑓𝑠𝑚𝑎𝑟𝑔𝑖𝑛\mathbf{r}^{f,s}_{margin}bold_r start_POSTSUPERSCRIPT italic_f , italic_s end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_m italic_a italic_r italic_g italic_i italic_n end_POSTSUBSCRIPT are flattened and, together with the flattened route embedding 𝐱if~KΓδ~subscriptsuperscript𝐱𝑓𝑖superscript𝐾superscriptΓsubscript𝛿\widetilde{\mathbf{x}^{f}_{i}}\in\mathbb{R}^{K\cdot\Gamma^{\prime}\cdot\delta_% {\mathcal{E}}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ∈ blackboard_R start_POSTSUPERSCRIPT italic_K ⋅ roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ⋅ italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and route direction embedding 𝐱if,d~KΓδ~subscriptsuperscript𝐱𝑓𝑑𝑖superscript𝐾superscriptΓsubscript𝛿\widetilde{\mathbf{x}^{f,d}_{i}}\in\mathbb{R}^{K\cdot\Gamma^{\prime}\cdot% \delta_{\mathcal{E}}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ∈ blackboard_R start_POSTSUPERSCRIPT italic_K ⋅ roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ⋅ italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, used to compute the new rank:

Pr(R~)=Softmax(MLPr(𝐫marginc  𝐫margins  MLPf(𝐱if~  𝐱if,d~))),Pr~𝑅SoftmaxsubscriptMLP𝑟subscriptsuperscript𝐫𝑐𝑚𝑎𝑟𝑔𝑖𝑛 norm subscriptsuperscript𝐫𝑠𝑚𝑎𝑟𝑔𝑖𝑛  subscriptMLP𝑓conditional~subscriptsuperscript𝐱𝑓𝑖  ~subscriptsuperscript𝐱𝑓𝑑𝑖\mathrm{Pr}\left(\widetilde{R}\right)=\mathrm{Softmax}\left(\mathrm{MLP}_{r}% \left(\mathbf{r}^{c}_{margin}\text{ }\|\text{ }\mathbf{r}^{s}_{margin}\text{ }% \|\text{ }\mathrm{MLP}_{f}\left(\widetilde{\mathbf{x}^{f}_{i}}\text{ }\|\text{% }\widetilde{\mathbf{x}^{f,d}_{i}}\right)\right)\right),roman_Pr ( over~ start_ARG italic_R end_ARG ) = roman_Softmax ( roman_MLP start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT ( bold_r start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_m italic_a italic_r italic_g italic_i italic_n end_POSTSUBSCRIPT ∥ bold_r start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_m italic_a italic_r italic_g italic_i italic_n end_POSTSUBSCRIPT ∥ roman_MLP start_POSTSUBSCRIPT italic_f end_POSTSUBSCRIPT ( over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ∥ over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ) ) ) , (13)

where Pr(R~)KPr~𝑅superscript𝐾\mathrm{Pr}(\widetilde{R})\in\mathbb{R}^{K}roman_Pr ( over~ start_ARG italic_R end_ARG ) ∈ blackboard_R start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT denotes the probability distribution over the K𝐾Kitalic_K predicted future routes being the actual future routes. Based on this probability, we can determine the new predicted rank, resulting in reranked future route predictions denoted as {xi,kf^}k=1Ksuperscriptsubscript^subscriptsuperscript𝑥𝑓𝑖𝑘𝑘1𝐾\left\{\widehat{x^{f}_{i,k}}\right\}_{k=1}^{K}{ over^ start_ARG italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT. We also adopt the cross-entropy loss for the Rank Refinement Module:

rank=logPr(R~)[xif],subscript𝑟𝑎𝑛𝑘Pr~𝑅delimited-[]subscriptsuperscript𝑥𝑓𝑖\mathcal{L}_{rank}=-\log\mathrm{Pr}\left(\widetilde{R}\right)\left[x^{f}_{i}% \right],caligraphic_L start_POSTSUBSCRIPT italic_r italic_a italic_n italic_k end_POSTSUBSCRIPT = - roman_log roman_Pr ( over~ start_ARG italic_R end_ARG ) [ italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ] , (14)

Note that samples from the set of multiple predicted future routes are excluded if they do not contain a ground truth future route. While our KG facilitates an effective overall selection (i.e., top-K𝐾Kitalic_K) of future routes, it is crucial to notice that an enhancement in the top-K𝐾Kitalic_K predictions does not necessarily translate to a superior top-1111 prediction. Therefore, we directly refine the top-1111 prediction using the initial predictions in our implementation. This is done by employing a MLP to encode the initial prediction embeddings 𝐱ifsubscriptsuperscript𝐱𝑓𝑖\mathbf{x}^{f}_{i}bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and 𝐱if,dsubscriptsuperscript𝐱𝑓𝑑𝑖\mathbf{x}^{f,d}_{i}bold_x start_POSTSUPERSCRIPT italic_f , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, along with the last observed link 𝐞iΓsubscriptsuperscript𝐞Γ𝑖\mathbf{e}^{\Gamma}_{i}bold_e start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and 𝐞id,Γsubscriptsuperscript𝐞𝑑Γ𝑖\mathbf{e}^{d,\Gamma}_{i}bold_e start_POSTSUPERSCRIPT italic_d , roman_Γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, and estimated goal direction 𝐫idsubscriptsuperscript𝐫𝑑𝑖\mathbf{r}^{d}_{i}bold_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT:

xif~=MLPk(𝐞iΓ  𝐞id,Γ  𝐫id  MLPx(𝐱if  𝐱if,d)),\widetilde{x^{f}_{i}}=\mathrm{MLP}_{k}\left(\mathbf{e}^{\Gamma}_{i}\text{ }\|% \text{ }\mathbf{e}^{d,\Gamma}_{i}\text{ }\|\text{ }\mathbf{r}^{d}_{i}\text{ }% \|\text{ }\mathrm{MLP}_{x}\left(\mathbf{x}^{f}_{i}\text{ }\|\text{ }\mathbf{x}% ^{f,d}_{i}\right)\right),over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG = roman_MLP start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ( bold_e start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ bold_e start_POSTSUPERSCRIPT italic_d , roman_Γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ bold_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ roman_MLP start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT ( bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ bold_x start_POSTSUPERSCRIPT italic_f , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ) , (15)

where xif~Γ×||~subscriptsuperscript𝑥𝑓𝑖superscriptsuperscriptΓ\widetilde{x^{f}_{i}}\in\mathbb{R}^{\Gamma^{\prime}\times|\mathcal{E}|}over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ∈ blackboard_R start_POSTSUPERSCRIPT roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT × | caligraphic_E | end_POSTSUPERSCRIPT, is also optimized by minimizing the corresponding cross entropy loss. Subsequently, the top-1111 prediction is generated using the Route Generation Module for the n=1𝑛1n=1italic_n = 1 case. The generated future route can be inserted into the first position, replacing the original K𝐾Kitalic_K-th prediction, to obtain the refined top-K𝐾Kitalic_K future route predictions {xi,kf^}k=1Ksuperscriptsubscript^subscriptsuperscript𝑥𝑓𝑖𝑘𝑘1𝐾\left\{\widehat{x^{f}_{i,k}}\right\}_{k=1}^{K}{ over^ start_ARG italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT.

4.6 Multi-Objectives Optimization

The objective of RouteKG is to leverage the learned spatial relations to efficiently make future route predictions, which is done by optimizing multiple objectives. Specifically, the overall loss function could be written as:

=wreprep+wdd+wpredpred+wrankrank,subscript𝑤𝑟𝑒𝑝subscript𝑟𝑒𝑝subscript𝑤𝑑subscript𝑑subscript𝑤𝑝𝑟𝑒𝑑subscript𝑝𝑟𝑒𝑑subscript𝑤𝑟𝑎𝑛𝑘subscript𝑟𝑎𝑛𝑘\mathcal{L}=w_{rep}\cdot\mathcal{L}_{rep}+w_{d}\cdot\mathcal{L}_{d}+w_{pred}% \cdot\mathcal{L}_{pred}+w_{rank}\cdot\mathcal{L}_{rank},caligraphic_L = italic_w start_POSTSUBSCRIPT italic_r italic_e italic_p end_POSTSUBSCRIPT ⋅ caligraphic_L start_POSTSUBSCRIPT italic_r italic_e italic_p end_POSTSUBSCRIPT + italic_w start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ⋅ caligraphic_L start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT + italic_w start_POSTSUBSCRIPT italic_p italic_r italic_e italic_d end_POSTSUBSCRIPT ⋅ caligraphic_L start_POSTSUBSCRIPT italic_p italic_r italic_e italic_d end_POSTSUBSCRIPT + italic_w start_POSTSUBSCRIPT italic_r italic_a italic_n italic_k end_POSTSUBSCRIPT ⋅ caligraphic_L start_POSTSUBSCRIPT italic_r italic_a italic_n italic_k end_POSTSUBSCRIPT , (16)

where wsubscript𝑤w_{\cdot}italic_w start_POSTSUBSCRIPT ⋅ end_POSTSUBSCRIPT are weights for different loss.

The complete learning procedure of RouteKG are detailed in Algorithm 2.

Input :  A batch of observed routes 𝒳o×Γsubscriptsuperscript𝒳𝑜superscriptΓ\mathcal{X}^{o}_{\mathcal{B}}\in\mathbb{R}^{\mathcal{B}\times\Gamma}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT caligraphic_B end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT caligraphic_B × roman_Γ end_POSTSUPERSCRIPT;
Road network 𝐆𝐆\mathbf{G}bold_G;
Inter-road direction matrix 𝐃𝐃\mathbf{D}bold_D;
NAE matrix 𝐀𝐀\mathbf{A}bold_A;
1 Randomly initialize Θkg={𝐖,𝐖c,𝐖s,𝐖a,𝐖d,𝐏c,𝐏s,𝐏a,𝐏d,MLPd}subscriptΘ𝑘𝑔subscript𝐖subscript𝐖superscript𝑐subscript𝐖superscript𝑠subscript𝐖superscript𝑎subscript𝐖superscript𝑑subscript𝐏superscript𝑐subscript𝐏superscript𝑠subscript𝐏superscript𝑎subscript𝐏superscript𝑑subscriptMLP𝑑\Theta_{kg}=\left\{\mathbf{W}_{\mathcal{E}},\mathbf{W}_{\mathcal{R}^{c}},% \mathbf{W}_{\mathcal{R}^{s}},\mathbf{W}_{\mathcal{R}^{a}},\mathbf{W}_{\mathcal% {R}^{d}},\mathbf{P}_{\mathcal{R}^{c}},\mathbf{P}_{\mathcal{R}^{s}},\mathbf{P}_% {\mathcal{R}^{a}},\mathbf{P}_{\mathcal{R}^{d}},\mathrm{MLP}_{d}\right\}roman_Θ start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT = { bold_W start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT , bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT , bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT , bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT end_POSTSUBSCRIPT , bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT , bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT , bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT , bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT end_POSTSUBSCRIPT , bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT , roman_MLP start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT } and Θr={MLPr,MLPf,MLPk,MLPx}subscriptΘ𝑟subscriptMLP𝑟subscriptMLP𝑓subscriptMLP𝑘subscriptMLP𝑥\Theta_{r}=\left\{\mathrm{MLP}_{r},\mathrm{MLP}_{f},\mathrm{MLP}_{k},\mathrm{% MLP}_{x}\right\}roman_Θ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT = { roman_MLP start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT , roman_MLP start_POSTSUBSCRIPT italic_f end_POSTSUBSCRIPT , roman_MLP start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , roman_MLP start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT }.
2 for m=1,,max_iterations𝑚1normal-…𝑚𝑎𝑥normal-_𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛𝑠m=1,\dots,max\_iterationsitalic_m = 1 , … , italic_m italic_a italic_x _ italic_i italic_t italic_e italic_r italic_a italic_t italic_i italic_o italic_n italic_s do
3       // Early stopping here.
4       Normalize embeddings of hyperplanes 𝐏2=1subscriptnormsubscript𝐏superscript21\left\|\mathbf{P}_{\mathcal{R}^{\cdot}}\right\|_{2}=1∥ bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT ∥ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = 1.
5       // Forward Propagation.
6       Pr(𝒳f~),kg(𝒳o,𝐆,𝐃;Θkg)Pr~superscript𝒳𝑓subscript𝑘𝑔superscript𝒳𝑜𝐆𝐃subscriptΘ𝑘𝑔\mathrm{Pr}(\widetilde{\mathcal{X}^{f}}),\mathcal{R}\leftarrow\mathcal{M}_{kg}% \left(\mathcal{X}^{o},\mathbf{G},\mathbf{D};\Theta_{kg}\right)roman_Pr ( over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG ) , caligraphic_R ← caligraphic_M start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT ( caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT , bold_G , bold_D ; roman_Θ start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT )
7       {𝒳kf~}k=1Kg(Pr(𝒳f~),𝐆,𝐀)superscriptsubscript~subscriptsuperscript𝒳𝑓𝑘𝑘1𝐾subscript𝑔Pr~superscript𝒳𝑓𝐆𝐀\left\{\widetilde{\mathcal{X}^{f}_{k}}\right\}_{k=1}^{K}\leftarrow\mathcal{M}_% {g}\left(\mathrm{Pr}(\widetilde{\mathcal{X}^{f}}),\mathbf{G},\mathbf{A}\right){ over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT ← caligraphic_M start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT ( roman_Pr ( over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG ) , bold_G , bold_A )
8       {𝒳kf^}k=1Kr({𝒳kf~}k=1K,;Θr)superscriptsubscript^subscriptsuperscript𝒳𝑓𝑘𝑘1𝐾subscript𝑟superscriptsubscript~subscriptsuperscript𝒳𝑓𝑘𝑘1𝐾subscriptΘ𝑟\left\{\widehat{\mathcal{X}^{f}_{k}}\right\}_{k=1}^{K}\leftarrow\mathcal{M}_{r% }\left(\left\{\widetilde{\mathcal{X}^{f}_{k}}\right\}_{k=1}^{K},\mathcal{R};% \Theta_{r}\right){ over^ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT ← caligraphic_M start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT ( { over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT , caligraphic_R ; roman_Θ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT )
9       // Back Propagation.
10       ΘkgΘkgΘkg{rep+d+pred}subscriptΘ𝑘𝑔subscriptΘ𝑘𝑔subscriptsubscriptΘ𝑘𝑔subscript𝑟𝑒𝑝subscript𝑑subscript𝑝𝑟𝑒𝑑\Theta_{kg}\leftarrow\Theta_{kg}-\nabla_{\Theta_{kg}}\left\{\mathcal{L}_{rep}+% \mathcal{L}_{d}+\mathcal{L}_{pred}\right\}roman_Θ start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT ← roman_Θ start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT - ∇ start_POSTSUBSCRIPT roman_Θ start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT end_POSTSUBSCRIPT { caligraphic_L start_POSTSUBSCRIPT italic_r italic_e italic_p end_POSTSUBSCRIPT + caligraphic_L start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT + caligraphic_L start_POSTSUBSCRIPT italic_p italic_r italic_e italic_d end_POSTSUBSCRIPT }
11       ΘrΘrΘr{rank}subscriptΘ𝑟subscriptΘ𝑟subscriptsubscriptΘ𝑟subscript𝑟𝑎𝑛𝑘\Theta_{r}\leftarrow\Theta_{r}-\nabla_{\Theta_{r}}\left\{\mathcal{L}_{rank}\right\}roman_Θ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT ← roman_Θ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT - ∇ start_POSTSUBSCRIPT roman_Θ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT end_POSTSUBSCRIPT { caligraphic_L start_POSTSUBSCRIPT italic_r italic_a italic_n italic_k end_POSTSUBSCRIPT }
12      
13 end for
Algorithm 2 RouteKG algorithm.

5 Experiments

5.1 Data

We conduct experiments on taxi trajectory data obtained from two cities in China: Chengdu and Shanghai. The Chengdu dataset was acquired from the Didi Chuxing GAIA Initiative111https://gaia.didichuxing.com. It contains the records of 143,888 drivers, covering a month of data from November 1, 2016, to November 30, 2016, with an average sampling rate of 2 4 seconds. The selected region in Chengdu spans from 30.65°N to 30.73°N in latitude and 104.04°E to 104.13°E in longitude, with the region’s road network comprising 2,832 nodes and 6,506 edges. The Chengdu data record incorporates driver ID, order ID, timestamp, longitude, and latitude. This study used the first seven days of Chengdu’s data.

The Shanghai dataset consists of trajectory records from 10,609 taxis from April 16, 2015, to April 21, 2015, with an average sampling rate of approximately 10 seconds per record. We concentrated on a specific region in Shanghai, adhering to the parameters outlined by (Zhao & Liang 2023). The chosen region’s road network incorporates 320 nodes and 714 links. Each data entry includes the taxi ID, date, time, longitude, latitude, and an occupied flag indicator.

For data preprocessing, we initially employed a fast map-matching algorithm (Yang & Gidofalvi 2018) to convert GPS traces into routes on the respective road network. We then cleaned the data, eliminating routes that contained loops and those with too few links (i.e., less than ten links). Subsequently, the refined Chengdu dataset contained 93,125 routes, while the Shanghai dataset comprised 24,468 routes. The road networks of Chengdu and Shanghai are visually represented in Figure 6, and the key network statistics are summarized in Table 2.

Refer to caption
Figure 6: The selected road networks in Chengdu and Shanghai.
Table 2: Summary statistics of road networks in Chengdu and Shanghai, where ID & OD refer to in-degree and out-degree, respectively.
Nodes Edges MID / MOD Max ID/OD Min ID/OD Density
Chengdu 2832 6506 2.297 4 0 8.11e-4
Shanghai 320 714 2.231 4 1 6.99e-3

5.2 Baseline Methods

In this study, we compare our approach with several established baselines to evaluate performance. These baselines include:

  • Markov: The Markov model is a well-known sequential prediction method extensively used in the field. It bases its route forecasting on observed transition patterns between road links.

  • Dijkstra (Dijkstra 1959): Dijkstra’s algorithm is a prominent method for finding the shortest paths between nodes in a graph, where the path length is assumed to be the sum of link length to reflect realistic geographic distance. This baseline can only work when the exact goal location is given.

  • RNN (Rumelhart et al. 1986): The RNN is an artificial neural network that recognizes patterns in sequential data. It accomplishes this by utilizing internal memory to process arbitrary sequences of inputs, making it effective for predicting future routes.

  • GRU (Cho et al. 2014): The GRU is a type of RNNs that utilizes gating mechanisms to capture long-term dependencies in the data, thereby improving the model’s predictive capabilities. This is especially beneficial for applications in trajectory prediction, where long-term dependencies play a crucial role.

  • LSTM (Hochreiter & Schmidhuber 1997): The LSTM is another variant of RNNs that addresses the problem of learning long-term dependencies in data. It does this by implementing a special architecture consisting of a series of memory cells, which effectively control the flow of information, making LSTMs advantageous for predicting future routes.

  • NetTraj (Liang & Zhao 2021): NetTraj is an advanced network-based trajectory prediction model specifically designed for predicting future movements in road networks. It leverages the inherent structure of road networks and utilizes historical trajectory data for accurate predictions. By integrating the Graph Attention Network (GAT) with LSTM, NetTraj offers a robust framework for making future trajectory predictions.

  • RCM-BC (Zhao & Liang 2023): The Route Choice Model-Behavioral Cloning (RCM-BC) is a behavioral cloning approach designed for route choice modeling in sequential decision-making scenarios. It employs supervised learning to create a policy that maps states to actions based on observed behavior to predict future routes. This baseline also requires the knowledge of the exact goal location to work.

Table 3: Performance comparison of different methods.
Main Results Chengdu Shanghai
NoGoal Link-level Route-level Link-level Route-level
R@1 R@5 R@10 R@1 R@5 R@10 M@1 M@5 M@10 R@1 R@5 R@10 R@1 R@5 R@10 M@1 M@5 M@10
Markov 0.696 0.698 0.699 0.466 0.468 0.468 0.466 0.466 0.467 0.633 0.634 0.635 0.448 0.448 0.449 0.448 0.448 0.448
RNN 0.812 0.878 0.914 0.665 0.840 0.888 0.665 0.733 0.739 0.709 0.789 0.837 0.542 0.719 0.783 0.542 0.605 0.613
GRU 0.799 0.864 0.902 0.650 0.825 0.872 0.650 0.718 0.724 0.709 0.790 0.839 0.544 0.718 0.785 0.544 0.605 0.614
LSTM 0.803 0.868 0.905 0.656 0.828 0.877 0.656 0.723 0.729 0.700 0.779 0.831 0.537 0.706 0.775 0.537 0.596 0.605
NetTraj 0.809 0.874 0.909 0.662 0.836 0.882 0.662 0.730 0.735 0.709 0.788 0.836 0.547 0.717 0.781 0.547 0.606 0.615
RouteKG 0.841 0.940 0.968 0.696 0.885 0.931 0.696 0.762 0.768 0.724 0.865 0.909 0.563 0.762 0.831 0.563 0.624 0.634
GoalD Link-level Route-level Link-level Route-level
R@1 R@5 R@10 R@1 R@5 R@10 M@1 M@5 M@10 R@1 R@5 R@10 R@1 R@5 R@10 M@1 M@5 M@10
RNN 0.853 0.911 0.939 0.718 0.881 0.918 0.718 0.783 0.787 0.777 0.850 0.893 0.621 0.788 0.849 0.621 0.683 0.691
GRU 0.843 0.902 0.931 0.708 0.868 0.908 0.708 0.772 0.776 0.780 0.852 0.890 0.625 0.791 0.844 0.625 0.687 0.693
LSTM 0.852 0.912 0.936 0.727 0.882 0.914 0.727 0.788 0.792 0.794 0.859 0.893 0.650 0.801 0.848 0.650 0.706 0.712
NetTraj 0.868 0.923 0.949 0.741 0.896 0.929 0.741 0.802 0.806 0.803 0.871 0.906 0.656 0.816 0.865 0.656 0.715 0.722
RouteKG 0.916 0.978 0.988 0.815 0.953 0.974 0.815 0.866 0.869 0.843 0.946 0.963 0.723 0.894 0.918 0.723 0.780 0.784
Goal Link-level Route-level Link-level Route-level
R@1 R@5 R@10 R@1 R@5 R@10 M@1 M@5 M@10 R@1 R@5 R@10 R@1 R@5 R@10 M@1 M@5 M@10
Dijkstra 0.737 0.715 0.724 0.703
RNN 0.866 0.916 0.941 0.755 0.892 0.924 0.755 0.808 0.812 0.862 0.902 0.926 0.761 0.861 0.892 0.761 0.799 0.803
GRU 0.858 0.912 0.939 0.736 0.883 0.919 0.736 0.794 0.798 0.859 0.900 0.921 0.755 0.861 0.887 0.755 0.796 0.799
LSTM 0.872 0.912 0.938 0.782 0.888 0.920 0.782 0.823 0.826 0.878 0.908 0.929 0.804 0.877 0.904 0.804 0.830 0.833
NetTraj 0.876 0.918 0.941 0.782 0.894 0.923 0.782 0.825 0.829 0.883 0.919 0.938 0.790 0.884 0.910 0.790 0.826 0.829
RCM-BC 0.784 0.933 0.956 0.669 0.880 0.918 0.669 0.754 0.760 0.827 0.936 0.954 0.748 0.908 0.934 0.748 0.817 0.820
RouteKG 0.974 0.991 0.995 0.958 0.983 0.988 0.958 0.967 0.968 0.945 0.979 0.984 0.915 0.959 0.969 0.915 0.932 0.933

5.3 Main Results

5.3.1 Experimental Settings

To comprehensively assess model performance, we design experiments based on the three subproblems as defined in Section 3.1: (1) route prediction with unknown goal 1subscript1\mathcal{F}_{1}caligraphic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, (2) route prediction with goal direction only 2subscript2\mathcal{F}_{2}caligraphic_F start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT, and (3) route prediction with complete goal information 3subscript3\mathcal{F}_{3}caligraphic_F start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT. We refer to these three subproblems as NoGoal, GoalD, and Goal. They reflect varying degrees of information availability regarding the road user’s intended destination, and represent a broad range of real-world application scenarios. For instance, a system might not know the user’s exact destination due to privacy concerns but could have access to more general information, such as the goal direction.

Most of the baseline models are designed for the NoGoal scenario, but two of them (Dikstra and RCM-BC) are for the Goal scenario only. Unlike these baselines, RouteKG requires the goal direction information. Therefore, specific model implementations are needed to incorporate the available goal information into different models under different scenarios. Under the NoGoal scenario, the goal direction is unknown, but we can still estimate it based on the observed route. Consequently, the estimated goal direction is used in RouteKG under NoGoal. Under GoalD, the actual goal direction is used instead of the estimated one in RouteKG. For other deep learning baseline models (except for RCM-BC), we concatenate the embedding of goal directions with the respective model’s inputs. Similarly, under the Goal scenario, the same concatenation strategy can be used for the baseline models, enriching them with complete goal information. In RouteKG, we add the embedding of the goal location directly to the embedding of the last link in the observed route.

In our main experiments, the input observed route length is set as Γ=10Γ10\Gamma=10roman_Γ = 10 and output future route length as Γ=5superscriptΓ5\Gamma^{\prime}=5roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = 5. For model evaluation, the datasets are partitioned into training, validation, and test subsets in a 6:2:2 ratio. Different models are evaluated under the NoGoal, GoalD, and Goal scenarios, using both the “link-level” and “route-level” metrics. Link-level assessment has practical implications, particularly for tasks related to traffic flows, while route-level evaluation offers valuable information for routing applications. Specifically, we utilize Recall and Mean Reciprocal Rank (MRR), two prevalent metrics. Recall measures the ratio of relevant items retrieved from all relevant items, indicating the system’s capacity to fetch desired information. MRR, on the other hand, evaluates the rank position of the correct answer, computing the average reciprocal rank of the highest-ranked correct answer across queries. A higher MRR signifies superior performance. These metrics provide insights into model effectiveness and ranking quality and are useful tools for assessing and enhancing system performance.

We consider the top-k𝑘kitalic_k predictions for the i𝑖iitalic_i-th observed route {xi,kf^}k=1Ksuperscriptsubscript^subscriptsuperscript𝑥𝑓𝑖𝑘𝑘1𝐾\left\{\widehat{x^{f}_{i,k}}\right\}_{k=1}^{K}{ over^ start_ARG italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT={{ei,kj^}j=Γ+1Γ+Γ}k=1Ksuperscriptsubscriptsuperscriptsubscript^superscriptsubscript𝑒𝑖𝑘𝑗𝑗Γ1ΓsuperscriptΓ𝑘1𝐾\left\{\left\{\widehat{e_{i,k}^{j}}\right\}_{j=\Gamma+1}^{\Gamma+\Gamma^{% \prime}}\right\}_{k=1}^{K}{ { over^ start_ARG italic_e start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT end_ARG } start_POSTSUBSCRIPT italic_j = roman_Γ + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT and the actual i𝑖iitalic_i-th future route xif={eij}j=Γ+1Γ+Γsuperscriptsubscript𝑥𝑖𝑓superscriptsubscriptsuperscriptsubscript𝑒𝑖𝑗𝑗Γ1ΓsuperscriptΓx_{i}^{f}=\left\{e_{i}^{j}\right\}_{j=\Gamma+1}^{\Gamma+\Gamma^{\prime}}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT = { italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT } start_POSTSUBSCRIPT italic_j = roman_Γ + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT to define our evaluation metrics. The link-level recall R@K is defined as

R@K=1|𝒳|i=1|𝒳|maxk=1K[1Γj=Γ+1Γ+Γ𝕀(ei,kj^=eij)].𝑅@𝐾1𝒳superscriptsubscript𝑖1𝒳superscriptsubscript𝑘1𝐾1superscriptΓsuperscriptsubscript𝑗Γ1ΓsuperscriptΓ𝕀^superscriptsubscript𝑒𝑖𝑘𝑗superscriptsubscript𝑒𝑖𝑗R@K=\frac{1}{|\mathcal{X}|}\sum_{i=1}^{|\mathcal{X}|}\max_{k=1}^{K}\left[\frac% {1}{\Gamma^{\prime}}\sum_{j=\Gamma+1}^{\Gamma+\Gamma^{\prime}}\mathbb{I}\left(% \widehat{e_{i,k}^{j}}=e_{i}^{j}\right)\right].italic_R @ italic_K = divide start_ARG 1 end_ARG start_ARG | caligraphic_X | end_ARG ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT roman_max start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT [ divide start_ARG 1 end_ARG start_ARG roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_ARG ∑ start_POSTSUBSCRIPT italic_j = roman_Γ + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT blackboard_I ( over^ start_ARG italic_e start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT end_ARG = italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT ) ] . (17)

where 𝕀()𝕀\mathbb{I}(\cdot)blackboard_I ( ⋅ ) is the indicator function: 𝕀(a=b)={1if a=b0otherwise𝕀𝑎𝑏cases1if 𝑎𝑏0otherwise\mathbb{I}(a=b)=\begin{cases}1&\text{if }a=b\\ 0&\text{otherwise}\end{cases}blackboard_I ( italic_a = italic_b ) = { start_ROW start_CELL 1 end_CELL start_CELL if italic_a = italic_b end_CELL end_ROW start_ROW start_CELL 0 end_CELL start_CELL otherwise end_CELL end_ROW.

Similarly, the route-level recall R@K is defined as

R@K=1|𝒳|i=1|𝒳|maxk=1K[𝕀(j=Γ+1Γ+Γ𝕀(ei,kj^=eij),Γ)].𝑅@𝐾1𝒳superscriptsubscript𝑖1𝒳superscriptsubscript𝑘1𝐾𝕀superscriptsubscript𝑗Γ1ΓsuperscriptΓ𝕀^superscriptsubscript𝑒𝑖𝑘𝑗superscriptsubscript𝑒𝑖𝑗superscriptΓR@K=\frac{1}{|\mathcal{X}|}\sum_{i=1}^{|\mathcal{X}|}\max_{k=1}^{K}\left[% \mathbb{I}\left(\sum_{j=\Gamma+1}^{\Gamma+\Gamma^{\prime}}\mathbb{I}\left(% \widehat{e_{i,k}^{j}}=e_{i}^{j}\right),\Gamma^{\prime}\right)\right].italic_R @ italic_K = divide start_ARG 1 end_ARG start_ARG | caligraphic_X | end_ARG ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT roman_max start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT [ blackboard_I ( ∑ start_POSTSUBSCRIPT italic_j = roman_Γ + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT blackboard_I ( over^ start_ARG italic_e start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT end_ARG = italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT ) , roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) ] . (18)

We also compute the route-level MRR of the top-k𝑘kitalic_k predictions, M@K, as follows:

M@K=1|𝒳|i=1|𝒳|k=1K1k[𝕀(j=Γ+1Γ+Γ𝕀(ei,kj^=eij),Γ)].𝑀@𝐾1𝒳superscriptsubscript𝑖1𝒳superscriptsubscript𝑘1𝐾1𝑘delimited-[]𝕀superscriptsubscript𝑗Γ1ΓsuperscriptΓ𝕀^superscriptsubscript𝑒𝑖𝑘𝑗superscriptsubscript𝑒𝑖𝑗superscriptΓM@K=\frac{1}{|\mathcal{X}|}\sum_{i=1}^{|\mathcal{X}|}\sum_{k=1}^{K}\frac{1}{k}% \left[\mathbb{I}\left(\sum_{j=\Gamma+1}^{\Gamma+\Gamma^{\prime}}\mathbb{I}% \left(\widehat{e_{i,k}^{j}}=e_{i}^{j}\right),\Gamma^{\prime}\right)\right].italic_M @ italic_K = divide start_ARG 1 end_ARG start_ARG | caligraphic_X | end_ARG ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT | caligraphic_X | end_POSTSUPERSCRIPT ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT divide start_ARG 1 end_ARG start_ARG italic_k end_ARG [ blackboard_I ( ∑ start_POSTSUBSCRIPT italic_j = roman_Γ + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT blackboard_I ( over^ start_ARG italic_e start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT end_ARG = italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT ) , roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) ] . (19)

The experiments are conducted on an Ubuntu server leveraging the Python 3.6 environment. The deep learning computations are performed using the PyTorch framework. The server’s hardware specifications include an Intel(R) Xeon(R) Platinum 8375C CPU with a clock speed of 2.90GHz, coupled with 8 NVIDIA GeForce RTX 3090 GPUs, each featuring 24GB of memory. To ensure the robustness and generalizability of our model, hyperparameters are tuned based on the performance of the validation set. The fine-tuning of these hyperparameters is crucial for balancing the bias-variance trade-off and optimizing the model’s performance. All hyperparameters are listed in C.

Refer to caption
Figure 7: Example results in Chengdu (upper) and Shanghai (lower), with the red line indicating last observed link, green line the actual future route, blue lines the predicted future routes.

5.3.2 Main Results Analysis

Table reftab:mainresults shows a comparison of the accuracy of the different methods in predicting future routes on two real-world datasets under three scenarios. Overall, our proposed RouteKG model achieves optimal accuracy on all metrics. It is observed that for all models, the route-level prediction accuracy is lower than the link-level prediction accuracy. This underscores the importance of modeling the consistency between different road links. Comparing the different models, we can find that Deep Learning-based methods achieve higher accuracy in general. This aligns with empirical findings and is further enhanced with the integration of additional information. For instance, models like NetTraj and RouteKG, which incorporate spatial data, outperform simpler models like RNN and its variants. Remarkably, RouteKG outperforms the NetTraj model and other baselines, even without extra information, which highlights the effectiveness of our approach to integrate KG for future route prediction. Comparing under different experimental settings, intuitively, introducing more Goal information progressively improves overall accuracy. In particular, RouteKG’s prediction accuracy is greatly improved after the gradual incorporation of Goal’s information, and at the same time, it also has an accuracy improvement of about 5.41% in comparison with the optimal baseline under the NoGoal condition, which proves the effectiveness of RouteKG in processing and utilizing Goal information, and its applicability under various conditions. Lastly, comparing between different datasets, the prediction accuracy on the chengdu dataset is better than that on the Shanghai dataset, likely attributed to the larger data volume of the former.

To provide intuitive understanding about the prediction results, we show two qualitative example RouteKG outputs under NoGoal. Figure 7 illustrates, for each example, the last observed link alongside the estimated direction and top-3 predictions. Although certain future routes may display peculiar turns due to constraints imposed by the road network, most predicted future routes exhibit a correct heading based on the estimated goal direction. An important observation from the first example is the misalignment between the links adjacent to the last observed link and the predicted direction. Consequently, the predicted road link initially are constrained on the road network. However, as the prediction progresses, subsequent steps are adjusted to align with the route’s predicted direction.

Refer to caption
Figure 8: Ablation analysis results with goal direction.

5.4 Ablation Analysis

This section analyzes the results of the ablation experiments. Specifically, we focus on the analysis performed on RouteKG under GoalD. By conducting these ablation experiments, we can gain insight into the importance of each component of the model and its contribution to the overall predictive capabilities of the model.

Figure 8 compares the performance of RouteKG with its two ablation variants. Notably, RouteKG w/o rerank removes the Rank Refinement Module. Experimental results show that removing this module significantly reduces prediction performance. This suggests the interconnected nature of link choices, emphasizing the need for a module to model route consistency and choice correlation. This highlights the module’s indispensability. Remarkably, even without reranking, RouteKG still outperforms most benchmark methods, particularly in the top 5 and top 10 predictions. This demonstrates RouteKG’s efficacy in identifying potential future routes, reinforcing the importance of integrating the ranking refinement module for enhancing top 1 predictions. In summary, while RouteKG effectively generates future route sets, incorporating a reranking module is crucial for accurately prioritizing the top 1,000 dollar predictions.

RouteKG w/o relation denotes the RouteKG model removes the KG representation learning. The observed performance drop in this variant is less pronounced compared to the removal of the Rank Refinement Module. This indicates that although KG representation learning is beneficial to the route prediction process, it acts more as an auxiliary component. The substantial effectiveness of using KGC alone in predicting future routes underscores the suitability of approaching future route prediction as a KGC problem.

5.5 Sensitivity Analysis

In this section, we perform a sensitivity analysis to assess the robustness and reliability of our model under various parameter settings.

Refer to caption
Figure 9: ΓsuperscriptΓ\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT sensitivities on Shanghai under NoGoal.

We investigate the model’s performance under varying lengths of future routes to be predicted, denoted as ΓsuperscriptΓ\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT. As depicted in Figure 9, by altering ΓsuperscriptΓ\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT from 2 to 8, there is a noticeable trend of declining performance with increasing ΓsuperscriptΓ\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT values. This indicates that predicting longer routes becomes progressively challenging due to an expanded candidate space and heightened uncertainty, particularly when lacking Goal information.

5.6 Efficiency Analysis

Efficient route prediction in transportation systems is paramount, necessitating prompt response for system operators and road users. To assess the model efficiency, we analyze the inference time of various models in two datasets, aiming to ascertain real-time performance capabilities. This allows us to identify the most efficient and responsive models, which is crucial for ensuring smooth user experiences and effective traffic management.

Figure 10 delineates the inference times across various models. Note that the results from Dijkstra and RCM-BC are omitted due to their overly high inference times. All baseline utilize the Spanning Route algorithm to generate future routes except the Markov model. The Markov model leverages pre-computed transition probabilities to sample and generate the top-k𝑘kitalic_k predictions through k𝑘kitalic_k iterations.

Refer to caption
Figure 10: Inference time of different methods in Chengdu and Shanghai. (mean ± std)

RouteKG demonstrates remarkable efficiency, achieving average inference times of 598.01ms and 244.47ms for every 10k requests on the Chengdu and Shanghai datasets, respectively, with standard deviations of 1.21ms and 19.35ms. In contrast, the Dijkstra model, based on dynamic programming, takes over 38 seconds, and the RCM-BC model exceeds 1000 seconds, rendering them impractical for real-time systems. Models utilizing the Spanning Route algorithm (e.g., RNN, GRU, LSTM, NetTraj, RouteKG) show superior inference times, with less than 400 milliseconds in Chengdu and 250 milliseconds in Shanghai per 10k requests. RouteKG exhibits a marginally higher inference time, likely attributable to the reranking process. Nonetheless, these results highlight RouteKG’s suitability for real-time traffic applications, where rapid processing is essential for efficient transportation systems.

5.7 Case Study: Traffic Flow Estimation

In this section, we conduct a case study on traffic flow estimation to demonstrate the practical use cases of RouteKG, utilizing its potential to generate future routes for accurate traffic flow estimations. This can offer key insights into traffic pattern dynamics and enhancing the reliability of traffic flow predictions. Specifically, we adopt a sampling-based method for generating future routes to maximize the utility of the top-k𝑘kitalic_k future routes predictions. Initially, the top-k𝑘kitalic_k predictions are converted to a probability distribution using temperature scaling (Guo et al. 2017). Subsequently, we sample from the predicted top-k𝑘kitalic_k future routes for each observed trajectory based on their probability distribution. The estimated link-level traffic flows are then obtained by aggregating the number of predicted future routes at the link level. To counter the effects of uncertainty, we iterate the experiments ten times and reported traffic flow estimation results in a mean±std format, focusing solely on the top-10 predictions for simplicity.

Table 4: Traffic flow estimation results on Chengdu and Shanghai dataset. (mean ± std)
Traffic Flow Chengdu Shanghai
NoGoal MAE RMSE R2superscriptR2\mathrm{R}^{2}roman_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT MAE RMSE R2superscriptR2\mathrm{R}^{2}roman_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT
Markov 7.849 ± 0.003 26.104 ± 0.010 0.820 ± 0.000 20.758 ± 0.012 42.040 ± 0.021 0.716 ± 0.000
RNN 3.774 ± 0.016 12.018 ± 0.109 0.962 ± 0.001 12.062 ± 0.167 22.711 ± 0.183 0.917 ± 0.001
GRU 3.974 ± 0.014 12.180 ± 0.115 0.961 ± 0.001 12.453 ± 0.153 23.674 ± 0.207 0.910 ± 0.002
LSTM 3.961 ± 0.008 12.517 ± 0.100 0.959 ± 0.001 12.705 ± 0.115 23.980 ± 0.137 0.908 ± 0.001
NetTraj 3.777 ± 0.014 11.896 ± 0.121 0.963 ± 0.001 12.333 ± 0.137 23.030 ± 0.201 0.915 ± 0.001
RouteKG 2.464 ± 0.030 6.725 ± 0.116 0.988 ± 0.000 8.178 ± 0.200 15.330 ± 0.537 0.962 ± 0.003
GoalD MAE RMSE R2superscriptR2\mathrm{R}^{2}roman_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT MAE RMSE R2superscriptR2\mathrm{R}^{2}roman_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT
RNN 3.121 ± 0.010 11.034 ± 0.114 0.968 ± 0.001 9.520 ± 0.136 17.287 ± 0.182 0.952 ± 0.001
GRU 3.226 ± 0.013 11.051 ± 0.120 0.968 ± 0.001 9.108 ± 0.153 16.400 ± 0.219 0.957 ± 0.001
LSTM 3.111 ± 0.009 10.995 ± 0.110 0.968 ± 0.001 8.390 ± 0.167 14.731 ± 0.277 0.965 ± 0.001
NetTraj 2.948 ± 0.003 10.796 ± 0.130 0.969 ± 0.001 8.006 ± 0.176 14.311 ± 0.307 0.967 ± 0.001
RouteKG 1.688 ± 0.032 6.237 ± 0.161 0.990 ± 0.001 4.682 ± 0.091 7.237 ± 0.284 0.992 ± 0.001
Goal MAE RMSE R2superscriptR2\mathrm{R}^{2}roman_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT MAE RMSE R2superscriptR2\mathrm{R}^{2}roman_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT
Dijkstra 4.386 17.146 0.922 12.655 29.711 0.858
RNN 2.988 ± 0.007 10.084 ± 0.170 0.973 ± 0.001 7.200 ± 0.144 14.232 ± 0.248 0.967 ± 0.001
GRU 3.055 ± 0.011 10.161 ± 0.169 0.973 ± 0.001 7.100 ± 0.127 13.496 ± 0.237 0.971 ± 0.001
LSTM 2.962 ± 0.014 10.167 ± 0.156 0.973 ± 0.001 6.903 ± 0.117 13.703 ± 0.187 0.970 ± 0.001
NetTraj 2.899 ± 0.004 9.970 ± 0.175 0.974 ± 0.001 6.669 ± 0.126 13.604 ± 0.231 0.970 ± 0.001
RCM-BC 3.299 ± 0.036 7.923 ± 0.037 0.980 ± 0.000 4.993 ± 0.136 8.701 ± 0.049 0.988 ± 0.000
RouteKG 1.012 ± 0.016 3.168 ± 0.096 0.997 ± 0.000 3.604 ± 0.088 6.340 ± 0.151 0.994 ± 0.000

The effectiveness of traffic flow estimation with RouteKG is demonstrated using three standard regression metrics: Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and the coefficient of determination (R2superscriptR2\mathrm{R}^{2}roman_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT), as detailed in Table 4. RouteKG consistently outperforms in all metrics for both datasets, aligning with our main experiment results in Section 5.3. Notably, incorporating more Goal information leads to improved accuracy in traffic flow predictions, highlighting the strength of our approach.

In particular, RouteKG’s performance in the NoGoal scenario significantly surpasses the baseline for both datasets, suggesting that our method of estimating moving directions and leveraging KGC is more effective than current state-of-the-art (SOTA) modeling methods. Quantitatively, it reduces MAE, RMSE, and R2superscriptR2\mathrm{R}^{2}roman_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT by 34.7%, 43.5%, and 2.6% respectively, compared to the best baseline. Under the GoalD scenario, performance increases notably, indicating potential for future refinement in modeling future directions. Importantly, RouteKG’s enhancements in traffic flow estimation, especially when including the actual future direction, are more significant than those of the baselines. This reaffirms RouteKG’s advanced integration of direction information in the KGC problem. With actual goal information incorporated, RouteKG achieves an MAE of 1, RMSE of 3, and 99.7% in R2superscriptR2\mathrm{R}^{2}roman_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT, underlining its efficacy and promise for practical applications.

To summarize, these results suggest that RouteKG could also be an effective tool for traffic flow estimation, offering accurate and rapid analysis essential for real-time traffic management.

6 Conclusion

This research presents RouteKG, a novel knowledge graph (KG) framework for short-term route prediction on road networks. It treats route prediction as a knowledge graph completion (KGC) problem. The framework constructs a KG based on the road network to facilitate KG representation learning, which is designed to capture spatial relations that are essential for various urban routing tasks. Through KGC, the learned relations can be further utilized for future route prediction. The devised Spanning Route algorithm allows for the efficient generation of multiple possible future routes, while a Rank Refinement Module is integrated to further leverage learned spatial relations to rerank the initial predictions, thereby achieving more accurate route prediction results.

RouteKG is evaluated using taxi trajectory data from Chengdu and Shanghai. The evaluation considers three practical scenarios with different levels of goal information availability: NoGoal, GoalD, and Goal. The experiment results show that the proposed RouteKG consistently outperforms the baseline methods based on various evaluation metrics. Additionally, the model efficiency analysis highlights that route predictions can be generated in less than 500ms per 10k requests, largely thanks to the Spanning Route algorithm, which validates the suitability of RouteKG for real-time traffic applications. To demonstrate the applicability of RouteKG beyond routing tasks, we utilize it to estimate link-level traffic flows, achieving an R2superscriptR2\mathrm{R}^{2}roman_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT value of 0.997 under the Goal scenario. This could provide valuable insights for future designs of intelligent transportation systems.

Future research can extend this work in several ways. First, incorporating other spatial relations (e.g., function zones, spatial regions, etc.) with urban and road network attributes can augment the scalability and generalizability of the model. This would enable the model to provide high-performance feedback for multi-functional intelligent transportation services rapidly, adapting to different tasks promptly. Second, future work can potentially enhance the Spanning Route algorithm by integrating an n-ary tree pruning approach, offering a solution to model complexity increases exponentially with route prediction length. The optimized algorithm is anticipated to offer superior scalability and more efficient future route generation with reduced computational resources. Last but not least, future research might delve deeper into harnessing KGs for broader urban applications, such as employing KGs to integrate diverse datasets and learn interrelationships amongst them. For instance, discerning correlations between traffic patterns and population demographics might empower urban planners to envisage and anticipate the implications of varied urban development strategies.

Acknowledgment

This research is supported by the National Natural Science Foundation of China (NSFC42201502) and Seed Funding for Strategic Interdisciplinary Research Scheme at the University of Hong Kong (URC102010057).

References

  • (1)
  • Abbas et al. (2020) Abbas, M. T., Jibran, M. A., Afaq, M. & Song, W.-C. (2020), ‘An adaptive approach to vehicle trajectory prediction using multimodel kalman filter’, Transactions on Emerging Telecommunications Technologies 31(5), e3734.
  • Alahi et al. (2016) Alahi, A., Goel, K., Ramanathan, V., Robicquet, A., Fei-Fei, L. & Savarese, S. (2016), Social lstm: Human trajectory prediction in crowded spaces, in ‘Proceedings of the IEEE conference on computer vision and pattern recognition’, pp. 961–971.
  • Bach et al. (2017) Bach, S. H., Broecheler, M., Huang, B. & Getoor, L. (2017), ‘Hinge-loss markov random fields and probabilistic soft logic’.
  • Bordes et al. (2013) Bordes, A., Usunier, N., Garcia-Duran, A., Weston, J. & Yakhnenko, O. (2013), ‘Translating embeddings for modeling multi-relational data’, Advances in neural information processing systems 26.
  • Chen, Zhang, Qian & Li (2022) Chen, T., Zhang, Y., Qian, X. & Li, J. (2022), ‘A knowledge graph-based method for epidemic contact tracing in public transportation’, Transportation Research Part C: Emerging Technologies 137, 103587.
  • Chen, Zhang, Sun & Zheng (2022) Chen, Y., Zhang, H., Sun, W. & Zheng, B. (2022), ‘Rntrajrec: Road network enhanced trajectory recovery with spatial-temporal transformer’, arXiv preprint arXiv:2211.13234 .
  • Chen et al. (2020) Chen, Z., Wang, Y., Zhao, B., Cheng, J., Zhao, X. & Duan, Z. (2020), ‘Knowledge graph completion: A review’, Ieee Access 8, 192435–192456.
  • Chi et al. (2022) Chi, H., Wang, B., Ge, Q. & Huo, G. (2022), ‘Knowledge graph-based enhanced transformer for metro individual travel destination prediction’, Journal of Advanced Transportation 2022.
  • Cho et al. (2014) Cho, K., Van Merriënboer, B., Gulcehre, C., Bahdanau, D., Bougares, F., Schwenk, H. & Bengio, Y. (2014), ‘Learning phrase representations using rnn encoder-decoder for statistical machine translation’, arXiv preprint arXiv:1406.1078 .
  • Chrastil & Warren (2015) Chrastil, E. R. & Warren, W. H. (2015), ‘Active and passive spatial learning in human navigation: acquisition of graph knowledge.’, Journal of experimental psychology: learning, memory, and cognition 41(4), 1162.
  • Dendorfer et al. (2020) Dendorfer, P., Osep, A. & Leal-Taixé, L. (2020), Goal-gan: Multimodal trajectory prediction based on goal position estimation, in ‘Proceedings of the Asian Conference on Computer Vision’.
  • Dijkstra (1959) Dijkstra, E. W. (1959), ‘A note on two problems in connexion with graphs’, Numerische Mathematik 1, 269–271.
  • Etienne & Jeffery (2004) Etienne, A. S. & Jeffery, K. J. (2004), ‘Path integration in mammals’, Hippocampus 14(2), 180–192.
  • Fu & Lee (2020) Fu, T.-Y. & Lee, W.-C. (2020), ‘Trembr: Exploring road networks for trajectory representation learning’, ACM Transactions on Intelligent Systems and Technology (TIST) 11(1), 1–25.
  • Gu et al. (2021) Gu, J., Sun, C. & Zhao, H. (2021), Densetnt: End-to-end trajectory prediction from dense goal sets, in ‘Proceedings of the IEEE/CVF International Conference on Computer Vision’, pp. 15303–15312.
  • Gu et al. (2022) Gu, T., Chen, G., Li, J., Lin, C., Rao, Y., Zhou, J. & Lu, J. (2022), Stochastic trajectory prediction via motion indeterminacy diffusion, in ‘Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition’, pp. 17113–17122.
  • Guo et al. (2017) Guo, C., Pleiss, G., Sun, Y. & Weinberger, K. Q. (2017), On calibration of modern neural networks, in ‘International conference on machine learning’, PMLR, pp. 1321–1330.
  • Gupta et al. (2018) Gupta, A., Johnson, J., Fei-Fei, L., Savarese, S. & Alahi, A. (2018), Social gan: Socially acceptable trajectories with generative adversarial networks, in ‘Proceedings of the IEEE conference on computer vision and pattern recognition’, pp. 2255–2264.
  • Hamilton et al. (2017) Hamilton, W., Ying, Z. & Leskovec, J. (2017), ‘Inductive representation learning on large graphs’, Advances in neural information processing systems 30.
  • Hart et al. (1968) Hart, P. E., Nilsson, N. J. & Raphael, B. (1968), ‘A formal basis for the heuristic determination of minimum cost paths’, IEEE transactions on Systems Science and Cybernetics 4(2), 100–107.
  • Helbing & Molnar (1995) Helbing, D. & Molnar, P. (1995), ‘Social force model for pedestrian dynamics’, Physical review E 51(5), 4282.
  • Ho et al. (2020) Ho, J., Jain, A. & Abbeel, P. (2020), ‘Denoising diffusion probabilistic models’, Advances in Neural Information Processing Systems 33, 6840–6851.
  • Hochreiter & Schmidhuber (1997) Hochreiter, S. & Schmidhuber, J. (1997), ‘Long short-term memory’, Neural computation 9(8), 1735–1780.
  • Huang et al. (2019) Huang, X., Zhang, J., Li, D. & Li, P. (2019), Knowledge graph embedding based question answering, in ‘Proceedings of the twelfth ACM international conference on web search and data mining’, pp. 105–113.
  • Huang et al. (2022) Huang, Y., Du, J., Yang, Z., Zhou, Z., Zhang, L. & Chen, H. (2022), ‘A survey on trajectory-prediction methods for autonomous driving’, IEEE Transactions on Intelligent Vehicles 7(3), 652–674.
  • Ji et al. (2015) Ji, G., He, S., Xu, L., Liu, K. & Zhao, J. (2015), Knowledge graph embedding via dynamic mapping matrix, in ‘Proceedings of the 53rd annual meeting of the association for computational linguistics and the 7th international joint conference on natural language processing (volume 1: Long papers)’, pp. 687–696.
  • Kong et al. (2017) Kong, X., Xia, F., Wang, J., Rahim, A. & Das, S. K. (2017), ‘Time-location-relationship combined service recommendation based on taxi trajectory data’, IEEE Transactions on Industrial Informatics 13(3), 1202–1212.
  • Lefèvre et al. (2014) Lefèvre, S., Vasquez, D. & Laugier, C. (2014), ‘A survey on motion prediction and risk assessment for intelligent vehicles’, ROBOMECH journal 1(1), 1–14.
  • Li et al. (2022) Li, G., Chen, Y., Liao, Q. & He, Z. (2022), ‘Potential destination discovery for low predictability individuals based on knowledge graph’, Transportation Research Part C: Emerging Technologies 145, 103928.
  • Li et al. (2020) Li, L., Jiang, R., He, Z., Chen, X. M. & Zhou, X. (2020), ‘Trajectory data-based traffic flow studies: A revisit’, Transportation Research Part C: Emerging Technologies 114, 225–240.
  • Li et al. (2017) Li, Y., Yu, R., Shahabi, C. & Liu, Y. (2017), ‘Diffusion convolutional recurrent neural network: Data-driven traffic forecasting’, arXiv preprint arXiv:1707.01926 .
  • Liang & Zhao (2021) Liang, Y. & Zhao, Z. (2021), ‘Nettraj: A network-based vehicle trajectory prediction model with directional representation and spatiotemporal attention mechanisms’, IEEE Transactions on Intelligent Transportation Systems 23(9), 14470–14481.
  • Lin et al. (2015) Lin, Y., Liu, Z., Sun, M., Liu, Y. & Zhu, X. (2015), Learning entity and relation embeddings for knowledge graph completion, in ‘Proceedings of the AAAI conference on artificial intelligence’, Vol. 29.
  • Liu et al. (2021) Liu, C., Gao, C., Jin, D. & Li, Y. (2021), ‘Improving location recommendation with urban knowledge graph’, arXiv preprint arXiv:2111.01013 .
  • Liu et al. (2022) Liu, K., Ruan, S., Xu, Q., Long, C., Xiao, N., Hu, N., Yu, L. & Pan, S. J. (2022), Modeling trajectories with multi-task learning, in ‘2022 23rd IEEE International Conference on Mobile Data Management (MDM)’, IEEE, pp. 208–213.
  • Mo et al. (2023) Mo, B., Wang, Q., Guo, X., Winkenbach, M. & Zhao, J. (2023), ‘Predicting drivers’ route trajectories in last-mile delivery using a pair-wise attention-based pointer neural network’, Transportation Research Part E: Logistics and Transportation Review 175, 103168.
  • Nickel et al. (2011) Nickel, M., Tresp, V., Kriegel, H.-P. et al. (2011), A three-way model for collective learning on multi-relational data., in ‘Icml’, Vol. 11, pp. 3104482–3104584.
  • Noy et al. (2019) Noy, N., Gao, Y., Jain, A., Narayanan, A., Patterson, A. & Taylor, J. (2019), ‘Industry-scale knowledge graphs: Lessons and challenges: Five diverse technology companies show how it’s done’, Queue 17(2), 48–75.
  • Paravarzar & Mohammad (2020) Paravarzar, S. & Mohammad, B. (2020), ‘Motion prediction on self-driving cars: A review’, arXiv preprint arXiv:2011.03635 .
  • Paulheim (2017) Paulheim, H. (2017), ‘Knowledge graph refinement: A survey of approaches and evaluation methods’, Semantic web 8(3), 489–508.
  • Popescu et al. (2009) Popescu, M.-C., Balas, V. E., Perescu-Popescu, L. & Mastorakis, N. (2009), ‘Multilayer perceptron and neural networks’, WSEAS Transactions on Circuits and Systems 8(7), 579–588.
  • Prato (2009) Prato, C. G. (2009), ‘Route choice modeling: past, present and future research directions’, Journal of Choice Modelling 2(1), 65–100.
  • Rao et al. (2022) Rao, X., Chen, L., Liu, Y., Shang, S., Yao, B. & Han, P. (2022), Graph-flashback network for next location recommendation, in ‘Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining’, pp. 1463–1471.
  • Rathore et al. (2019) Rathore, P., Kumar, D., Rajasegarar, S., Palaniswami, M. & Bezdek, J. C. (2019), ‘A scalable framework for trajectory prediction’, IEEE Transactions on Intelligent Transportation Systems 20(10), 3860–3874.
  • Ren et al. (2021) Ren, H., Ruan, S., Li, Y., Bao, J., Meng, C., Li, R. & Zheng, Y. (2021), Mtrajrec: Map-constrained trajectory recovery via seq2seq multi-task learning, in ‘Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining’, pp. 1410–1419.
  • Richardson & Domingos (2006) Richardson, M. & Domingos, P. (2006), ‘Markov logic networks’, Machine learning 62, 107–136.
  • Rudenko et al. (2020) Rudenko, A., Palmieri, L., Herman, M., Kitani, K. M., Gavrila, D. M. & Arras, K. O. (2020), ‘Human motion trajectory prediction: A survey’, The International Journal of Robotics Research 39(8), 895–935.
  • Rumelhart et al. (1986) Rumelhart, D. E., Hinton, G. E. & Williams, R. J. (1986), ‘Learning representations by back-propagating errors’, nature 323(6088), 533–536.
  • Sadeghian et al. (2019) Sadeghian, A., Kosaraju, V., Sadeghian, A., Hirose, N., Rezatofighi, H. & Savarese, S. (2019), Sophie: An attentive gan for predicting paths compliant to social and physical constraints, in ‘Proceedings of the IEEE/CVF conference on computer vision and pattern recognition’, pp. 1349–1358.
  • Schlichtkrull et al. (2018) Schlichtkrull, M., Kipf, T. N., Bloem, P., Van Den Berg, R., Titov, I. & Welling, M. (2018), Modeling relational data with graph convolutional networks, in ‘The Semantic Web: 15th International Conference, ESWC 2018, Heraklion, Crete, Greece, June 3–7, 2018, Proceedings 15’, Springer, pp. 593–607.
  • Shao et al. (2021) Shao, K., Wang, Y., Zhou, Z., Xie, X. & Wang, G. (2021), Trajforesee: How limited detailed trajectories enhance large-scale sparse information to predict vehicle trajectories?, in ‘2021 IEEE 37th International Conference on Data Engineering (ICDE)’, IEEE, pp. 2189–2194.
  • Sheth et al. (2019) Sheth, A., Padhee, S. & Gyrard, A. (2019), ‘Knowledge graphs and knowledge networks: the story in brief’, IEEE Internet Computing 23(4), 67–75.
  • Simmons et al. (2006) Simmons, R., Browning, B., Zhang, Y. & Sadekar, V. (2006), Learning to predict driver route and destination intent, in ‘2006 IEEE intelligent transportation systems conference’, IEEE, pp. 127–132.
  • Sutskever et al. (2014) Sutskever, I., Vinyals, O. & Le, Q. V. (2014), ‘Sequence to sequence learning with neural networks’, Advances in neural information processing systems 27.
  • Tan et al. (2021) Tan, J., Qiu, Q., Guo, W. & Li, T. (2021), ‘Research on the construction of a knowledge graph and knowledge reasoning model in the field of urban traffic’, Sustainability 13(6), 3191.
  • Tang et al. (2022) Tang, Y., He, J. & Zhao, Z. (2022), ‘Hgarn: Hierarchical graph attention recurrent network for human mobility prediction’, arXiv preprint arXiv:2210.07765 .
  • Tarjan (1972) Tarjan, R. (1972), ‘Depth-first search and linear graph algorithms’, SIAM journal on computing 1(2), 146–160.
  • Trouillon et al. (2016) Trouillon, T., Welbl, J., Riedel, S., Gaussier, É. & Bouchard, G. (2016), Complex embeddings for simple link prediction, in ‘International conference on machine learning’, PMLR, pp. 2071–2080.
  • Vashishth et al. (2019) Vashishth, S., Sanyal, S., Nitin, V. & Talukdar, P. (2019), ‘Composition-based multi-relational graph convolutional networks’, arXiv preprint arXiv:1911.03082 .
  • Wang et al. (2021) Wang, H., Yu, Q., Liu, Y., Jin, D. & Li, Y. (2021), ‘Spatio-temporal urban knowledge graph enabled mobility prediction’, Proceedings of the ACM on interactive, mobile, wearable and ubiquitous technologies 5(4), 1–24.
  • Wang et al. (2020) Wang, P., Liu, K., Jiang, L., Li, X. & Fu, Y. (2020), Incremental mobile user profiling: Reinforcement learning with spatial knowledge graph for modeling event streams, in ‘Proceedings of the 26th ACM SIGKDD international conference on knowledge discovery & data mining’, pp. 853–861.
  • Wang et al. (2014) Wang, Z., Zhang, J., Feng, J. & Chen, Z. (2014), Knowledge graph embedding by translating on hyperplanes, in ‘Proceedings of the AAAI conference on artificial intelligence’, Vol. 28.
  • Xiong et al. (2017) Xiong, C., Power, R. & Callan, J. (2017), Explicit semantic ranking for academic search via knowledge graph embedding, in ‘Proceedings of the 26th international conference on world wide web’, pp. 1271–1279.
  • Yan et al. (2022) Yan, B., Zhao, G., Song, L., Yu, Y. & Dong, J. (2022), ‘Precln: Pretrained-based contrastive learning network for vehicle trajectory prediction’, World Wide Web pp. 1–23.
  • Yang et al. (2014) Yang, B., Yih, W.-t., He, X., Gao, J. & Deng, L. (2014), ‘Embedding entities and relations for learning and inference in knowledge bases’, arXiv preprint arXiv:1412.6575 .
  • Yang & Gidofalvi (2018) Yang, C. & Gidofalvi, G. (2018), ‘Fast map matching, an algorithm integrating hidden markov model with precomputation’, International Journal of Geographical Information Science 32(3), 547 – 570.
  • Ye et al. (2016) Ye, N., Zhang, Y., Wang, R. & Malekian, R. (2016), ‘Vehicle trajectory prediction based on hidden markov model’.
  • Yurtsever et al. (2020) Yurtsever, E., Lambert, J., Carballo, A. & Takeda, K. (2020), ‘A survey of autonomous driving: Common practices and emerging technologies’, IEEE access 8, 58443–58469.
  • Zhang et al. (2023) Zhang, Q., Ma, Z., Zhang, P., Jenelius, E., Ma, X. & Wen, Y. (2023), ‘User-station attention inference using smart card data: A knowledge graph assisted matrix decomposition model’, Applied Intelligence .
  • Zhao et al. (2020) Zhao, L., Deng, H., Qiu, L., Li, S., Hou, Z., Sun, H. & Chen, Y. (2020), ‘Urban multi-source spatio-temporal data analysis aware knowledge graph embedding’, Symmetry 12(2), 199.
  • Zhao et al. (2019) Zhao, L., Song, Y., Zhang, C., Liu, Y., Wang, P., Lin, T., Deng, M. & Li, H. (2019), ‘T-gcn: A temporal graph convolutional network for traffic prediction’, IEEE transactions on intelligent transportation systems 21(9), 3848–3858.
  • Zhao & Liang (2023) Zhao, Z. & Liang, Y. (2023), ‘A deep inverse reinforcement learning approach to route choice modeling with context-dependent rewards’, Transportation Research Part C: Emerging Technologies 149, 104079.
  • Zhuang et al. (2017) Zhuang, C., Yuan, N. J., Song, R., Xie, X. & Ma, Q. (2017), Understanding people lifestyles: Construction of urban movement knowledge graph from gps trajectory., in ‘Ijcai’, pp. 3616–3623.
  • Ziebart et al. (2008) Ziebart, B. D., Maas, A. L., Dey, A. K. & Bagnell, J. A. (2008), Navigate like a cabbie: Probabilistic reasoning from observed context-aware behavior, in ‘Proceedings of the 10th international conference on Ubiquitous computing’, pp. 322–331.

Appendix A Notations

The adopted notations in this paper.

𝒯𝒯\mathcal{T}caligraphic_T

The set of all GPS trajectories.

G𝐺Gitalic_G

The road network data.

𝐆𝐆\mathbf{G}bold_G

The road network, represented by a Multi-Directed Graph (MultiDiGraph).

𝐕𝐕\mathbf{V}bold_V / 𝐄𝐄\mathbf{E}bold_E

The set of all nodes / edges of 𝐆𝐆\mathbf{G}bold_G.

v𝑣vitalic_v / e𝑒eitalic_e

An intersection (or node) / link (or edge) of a road network.

ridsubscriptsuperscript𝑟𝑑𝑖r^{d}_{i}italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT

The goal direction of the i𝑖iitalic_i-th future route.

rid^^subscriptsuperscript𝑟𝑑𝑖\widehat{r^{d}_{i}}over^ start_ARG italic_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG

The estimated goal direction of the i𝑖iitalic_i-th future route.

𝐫idsubscriptsuperscript𝐫𝑑𝑖\mathbf{r}^{d}_{i}bold_r start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT

The relation embedding of the estimated goal direction of the i𝑖iitalic_i-th future route.

eisuperscript𝑒𝑖e^{i}italic_e start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT

The i𝑖iitalic_i-th link (or edge) of a road network.

eijsuperscriptsubscript𝑒𝑖𝑗e_{i}^{j}italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT

The j𝑗jitalic_j-th link (or edge) of the i𝑖iitalic_i-th route.

eid,jsuperscriptsubscript𝑒𝑖𝑑𝑗e_{i}^{d,j}italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d , italic_j end_POSTSUPERSCRIPT

The direction of j𝑗jitalic_j-th link of the i𝑖iitalic_i-th route.

eiΓsuperscriptsubscript𝑒𝑖Γe_{i}^{\Gamma}italic_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT

The direction of j𝑗jitalic_j-th link of the i𝑖iitalic_i-th route.

𝐞𝐞\mathbf{e}bold_e

The set of embeddings of all links

𝐞iΓsubscriptsuperscript𝐞Γ𝑖\mathbf{e}^{\Gamma}_{i}bold_e start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT

The embedding of the last (i.e., the ΓΓ\Gammaroman_Γ-th) link in the i𝑖iitalic_i-th observed route.

𝐞isuperscriptsubscript𝐞𝑖\mathbf{e}_{i}^{\cdot}bold_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ⋅ end_POSTSUPERSCRIPT

The embedding of a link in the i𝑖iitalic_i-th observed route.

𝐞id,superscriptsubscript𝐞𝑖𝑑\mathbf{e}_{i}^{d,\cdot}bold_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d , ⋅ end_POSTSUPERSCRIPT

The direction embedding of a link in the i𝑖iitalic_i-th observed route.

𝐞i,Γsuperscriptsubscript𝐞𝑖perpendicular-toΓ\mathbf{e}_{i,\perp}^{\Gamma}bold_e start_POSTSUBSCRIPT italic_i , ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ end_POSTSUPERSCRIPT

The hyperplane-projected embedding of the last link in the i𝑖iitalic_i-th observed route.

𝐞subscript𝐞perpendicular-to\mathbf{e}_{\perp}bold_e start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT

The hyperplane-projected set of all candidate tail entities embeddings.

xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT

The i𝑖iitalic_i-th map-matched route on 𝐆𝐆\mathbf{G}bold_G of a GPS trajectory.

xiosubscriptsuperscript𝑥𝑜𝑖x^{o}_{i}italic_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT

The i𝑖iitalic_i-th observed route on 𝐆𝐆\mathbf{G}bold_G of a GPS trajectory.

xio,dsubscriptsuperscript𝑥𝑜𝑑𝑖x^{o,d}_{i}italic_x start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT

The set of links directions of the i𝑖iitalic_i-th observed route.

xifsubscriptsuperscript𝑥𝑓𝑖x^{f}_{i}italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT

The i𝑖iitalic_i-th future route on 𝐆𝐆\mathbf{G}bold_G of a GPS trajectory.

xi,kf~~superscriptsubscript𝑥𝑖𝑘𝑓\widetilde{x_{i,k}^{f}}over~ start_ARG italic_x start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG

The k𝑘kitalic_k-th future route out of the top-K𝐾Kitalic_K generated routes of i𝑖iitalic_i-th future route.

𝐱iosubscriptsuperscript𝐱𝑜𝑖\mathbf{x}^{o}_{i}bold_x start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT / 𝐱if~~subscriptsuperscript𝐱𝑓𝑖\widetilde{\mathbf{x}^{f}_{i}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG

The embedding of the i𝑖iitalic_i-th observed / future route.

𝐱io,dsubscriptsuperscript𝐱𝑜𝑑𝑖\mathbf{x}^{o,d}_{i}bold_x start_POSTSUPERSCRIPT italic_o , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT / 𝐱if,d~~subscriptsuperscript𝐱𝑓𝑑𝑖\widetilde{\mathbf{x}^{f,d}_{i}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f , italic_d end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG

The embedding of the i𝑖iitalic_i-th observed / future route’s directions.

𝐱i,cf~~subscriptsuperscript𝐱𝑓𝑖superscriptperpendicular-to𝑐\widetilde{\mathbf{x}^{f}_{i,\perp^{c}}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , ⟂ start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_ARG

The 𝐩csuperscript𝐩𝑐\mathbf{p}^{c}bold_p start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT hyperplane-projected embedding of the i𝑖iitalic_i-th future route.

𝐱i,sf~~subscriptsuperscript𝐱𝑓𝑖superscriptperpendicular-to𝑠\widetilde{\mathbf{x}^{f}_{i,\perp^{s}}}over~ start_ARG bold_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , ⟂ start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT end_ARG

The 𝐩ssuperscript𝐩𝑠\mathbf{p}^{s}bold_p start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT hyperplane-projected embedding of the i𝑖iitalic_i-th future route.

{xi,kf^}k=1Ksuperscriptsubscript^superscriptsubscript𝑥𝑖𝑘𝑓𝑘1𝐾\{\widehat{x_{i,k}^{f}}\}_{k=1}^{K}{ over^ start_ARG italic_x start_POSTSUBSCRIPT italic_i , italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT

The reranked k𝑘kitalic_k-th future route out of the top-K𝐾Kitalic_K generated routes of i𝑖iitalic_i-th future route.

𝒳𝒳\mathcal{X}caligraphic_X

The set of all map-matched routes.

𝒳osuperscript𝒳𝑜\mathcal{X}^{o}caligraphic_X start_POSTSUPERSCRIPT italic_o end_POSTSUPERSCRIPT / 𝒳fsuperscript𝒳𝑓\mathcal{X}^{f}caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT

The set of all observed / future routes.

𝒳kf~~subscriptsuperscript𝒳𝑓𝑘\widetilde{\mathcal{X}^{f}_{k}}over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG

The set of all generated k𝑘kitalic_k-th future routes out of the top-K𝐾Kitalic_K generated routes.

𝒳kf^^subscriptsuperscript𝒳𝑓𝑘\widehat{\mathcal{X}^{f}_{k}}over^ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_ARG

The set of all reranked k𝑘kitalic_k-th future routes out of the top-K𝐾Kitalic_K reranked routes.

Pr(xif,γ~)Pr~subscriptsuperscript𝑥𝑓𝛾𝑖\mathrm{Pr}(\widetilde{x^{f,\gamma}_{i}})roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG )

The predicted probability distribution indicating the likelihood of each link being the γ𝛾\gammaitalic_γ-th link of the i𝑖iitalic_i-th future route.

Pr(xif~)Pr~subscriptsuperscript𝑥𝑓𝑖\mathrm{Pr}(\widetilde{x^{f}_{i}})roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG )

The set of predicted probability distributions for the i𝑖iitalic_i-th future route xifsubscriptsuperscript𝑥𝑓𝑖x^{f}_{i}italic_x start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT.

Pr(𝒳f~)Pr~superscript𝒳𝑓\mathrm{Pr}(\widetilde{\mathcal{X}^{f}})roman_Pr ( over~ start_ARG caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG )

The set of all predicted probability distributions for future routes 𝒳fsuperscript𝒳𝑓\mathcal{X}^{f}caligraphic_X start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT.

ΓΓ\Gammaroman_Γ / ΓsuperscriptΓ\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT

The length of observed / future routes.

\mathcal{F}caligraphic_F

The route prediction mapping function.

K𝐾Kitalic_K

The number of generated future routes.

dsubscript𝑑\mathcal{M}_{d}caligraphic_M start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT / kgsubscript𝑘𝑔\mathcal{M}_{kg}caligraphic_M start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT / gsubscript𝑔\mathcal{M}_{g}caligraphic_M start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT / rsubscript𝑟\mathcal{M}_{r}caligraphic_M start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT

The mapping functions of the Data Preprocessing Module / Knowledge Graph Module / Route Generation Module / Rank Refinement Module.

ΘΘ\Thetaroman_Θ

The parameter set of \mathcal{F}caligraphic_F.

ΘkgsubscriptΘ𝑘𝑔\Theta_{kg}roman_Θ start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT / ΘrsubscriptΘ𝑟\Theta_{r}roman_Θ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT

The parameter set of kgsubscript𝑘𝑔\mathcal{M}_{kg}caligraphic_M start_POSTSUBSCRIPT italic_k italic_g end_POSTSUBSCRIPT / rsubscript𝑟\mathcal{M}_{r}caligraphic_M start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT.

𝐃𝐃\mathbf{D}bold_D

The direction label matrix.

𝐀𝐀\mathbf{A}bold_A

The node adjacent edges matrix.

𝐃dsuperscript𝐃𝑑\mathbf{D}^{d}bold_D start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT

The inter-road direction matrix.

𝒢𝒢\mathcal{G}caligraphic_G

The knowledge graph.

\mathcal{E}caligraphic_E / \mathcal{R}caligraphic_R

The set of all entities / relations of 𝒢𝒢\mathcal{G}caligraphic_G.

(h,r,t)𝑟𝑡(h,r,t)( italic_h , italic_r , italic_t )

A triplet within a knowledge graph 𝒢𝒢\mathcal{G}caligraphic_G, hhitalic_h is the head entity, r𝑟ritalic_r is the relation, t𝑡titalic_t is the tail entity.

𝐡𝐡\mathbf{h}bold_h / 𝐫𝐫\mathbf{r}bold_r / 𝐭𝐭\mathbf{t}bold_t

The head entity / relation / tail entity embedding.

𝐩rsuperscript𝐩𝑟\mathbf{p}^{r}bold_p start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT

The hyperplane of the relation r𝑟ritalic_r.

𝐩csuperscript𝐩𝑐\mathbf{p}^{c}bold_p start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT / 𝐩ssuperscript𝐩𝑠\mathbf{p}^{s}bold_p start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT / 𝐩asuperscript𝐩𝑎\mathbf{p}^{a}bold_p start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT / 𝐩dsuperscript𝐩𝑑\mathbf{p}^{d}bold_p start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT

The hyperplane of the ConnectBy / ConsistentWith / DistanceTo / DirectionTo relation.

csuperscript𝑐\mathcal{R}^{c}caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT / ssuperscript𝑠\mathcal{R}^{s}caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT / asuperscript𝑎\mathcal{R}^{a}caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT / dsuperscript𝑑\mathcal{R}^{d}caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT

The ConnectBy / ConsistentWith / DistanceTo / DirectionTo spatial relation.

δ𝛿\deltaitalic_δ

The hidden dimension.

δsubscript𝛿\delta_{\mathcal{E}}italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT

The dimension of the entity embedding spaces.

δcsubscript𝛿superscript𝑐\delta_{\mathcal{R}^{c}}italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT / δssubscript𝛿superscript𝑠\delta_{\mathcal{R}^{s}}italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT / δasubscript𝛿superscript𝑎\delta_{\mathcal{R}^{a}}italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT end_POSTSUBSCRIPT / δdsubscript𝛿superscript𝑑\delta_{\mathcal{R}^{d}}italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT

The dimension of the ConnectBy / ConsistentWith / DistanceTo / DirectionTo relation embedding spaces.

ΔcsubscriptΔsuperscript𝑐\Delta_{\mathcal{R}^{c}}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, ΔcsuperscriptsubscriptΔsuperscript𝑐\Delta_{\mathcal{R}^{c}}^{\prime}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT

The set of valid (positive) triplets and the set of invalid (negative) triplets of relation csuperscript𝑐\mathcal{R}^{c}caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT.

ΔssubscriptΔsuperscript𝑠\Delta_{\mathcal{R}^{s}}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, ΔssuperscriptsubscriptΔsuperscript𝑠\Delta_{\mathcal{R}^{s}}^{\prime}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT

The set of valid (positive) triplets and the set of invalid (negative) triplets of relation ssuperscript𝑠\mathcal{R}^{s}caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT.

ΔasubscriptΔsuperscript𝑎\Delta_{\mathcal{R}^{a}}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, ΔasuperscriptsubscriptΔsuperscript𝑎\Delta_{\mathcal{R}^{a}}^{\prime}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT

The set of valid (positive) triplets and the set of invalid (negative) triplets of relation asuperscript𝑎\mathcal{R}^{a}caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT.

ΔdsubscriptΔsuperscript𝑑\Delta_{\mathcal{R}^{d}}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, ΔdsuperscriptsubscriptΔsuperscript𝑑\Delta_{\mathcal{R}^{d}}^{\prime}roman_Δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT

The set of valid (positive) triplets and the set of invalid (negative) triplets of relation dsuperscript𝑑\mathcal{R}^{d}caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT.

ϕitalic-ϕ\phiitalic_ϕ

The scoring function of knowledge graph embedding.

ψ𝜓\psiitalic_ψ

The margin of positive and negative scores.

𝐖subscript𝐖\mathbf{W}_{\mathcal{E}}bold_W start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT

The trainable entity embedding matrix.

𝐖csubscript𝐖superscript𝑐\mathbf{W}_{\mathcal{R}^{c}}bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT / 𝐖ssubscript𝐖superscript𝑠\mathbf{W}_{\mathcal{R}^{s}}bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT / 𝐖asubscript𝐖superscript𝑎\mathbf{W}_{\mathcal{R}^{a}}bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT end_POSTSUBSCRIPT / 𝐖dsubscript𝐖superscript𝑑\mathbf{W}_{\mathcal{R}^{d}}bold_W start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT

The trainable ConnectBy / ConsistentWith / DistanceTo / DirectionTo relation embedding matrix.

𝐏csubscript𝐏superscript𝑐\mathbf{P}_{\mathcal{R}^{c}}bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT / 𝐏ssubscript𝐏superscript𝑠\mathbf{P}_{\mathcal{R}^{s}}bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT / 𝐏asubscript𝐏superscript𝑎\mathbf{P}_{\mathcal{R}^{a}}bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT end_POSTSUBSCRIPT / 𝐏dsubscript𝐏superscript𝑑\mathbf{P}_{\mathcal{R}^{d}}bold_P start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT

The trainable ConnectBy / ConsistentWith / DistanceTo / DirectionTo relation Hyperplane.

𝐫i,marginf,c,𝐫i,marginf,ssubscriptsuperscript𝐫𝑓𝑐𝑖𝑚𝑎𝑟𝑔𝑖𝑛subscriptsuperscript𝐫𝑓𝑠𝑖𝑚𝑎𝑟𝑔𝑖𝑛\mathbf{r}^{f,c}_{i,margin},\mathbf{r}^{f,s}_{i,margin}bold_r start_POSTSUPERSCRIPT italic_f , italic_c end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , italic_m italic_a italic_r italic_g italic_i italic_n end_POSTSUBSCRIPT , bold_r start_POSTSUPERSCRIPT italic_f , italic_s end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i , italic_m italic_a italic_r italic_g italic_i italic_n end_POSTSUBSCRIPT

The connection and consistent margins.

\mathcal{B}caligraphic_B

The batch size.

wsubscript𝑤w_{\cdot}italic_w start_POSTSUBSCRIPT ⋅ end_POSTSUBSCRIPT

The weights for different loss functions.

NAsubscript𝑁𝐴N_{A}italic_N start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT

The maximum number of the adjacent edges of all nodes in the 𝐆𝐆\mathbf{G}bold_G.

Ndsubscript𝑁𝑑N_{d}italic_N start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT

The number of sections into which directions are discretized.

,subscript\mathcal{L},\mathcal{L}_{\cdot}caligraphic_L , caligraphic_L start_POSTSUBSCRIPT ⋅ end_POSTSUBSCRIPT

The loss functions.

Appendix B Minibatch version of the Spanning Route algorithm

Algorithm 3 gives the pseudocode for the minibatch Spanning Route.

Input :  ΓsuperscriptΓ\Gamma^{\prime}roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT batched probability distributions {Pr(xf,γ~)×||}γ=1ΓsuperscriptsubscriptPr~superscript𝑥𝑓𝛾superscript𝛾1superscriptΓ\left\{\mathrm{Pr}(\widetilde{x^{f,\gamma}})\in\mathbb{R}^{\mathcal{B}\times|% \mathcal{E}|}\right\}_{\gamma=1}^{\Gamma^{\prime}}{ roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT end_ARG ) ∈ blackboard_R start_POSTSUPERSCRIPT caligraphic_B × | caligraphic_E | end_POSTSUPERSCRIPT } start_POSTSUBSCRIPT italic_γ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT;
road network 𝐆=(𝐕,𝐄)𝐆𝐕𝐄\mathbf{G}=(\mathbf{V},\mathbf{E})bold_G = ( bold_V , bold_E );
NAE matrix 𝐀|𝐕|×NA𝐀superscript𝐕subscript𝑁𝐴\mathbf{A}\in\mathbb{R}^{|\mathbf{V}|\times N_{A}}bold_A ∈ blackboard_R start_POSTSUPERSCRIPT | bold_V | × italic_N start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT end_POSTSUPERSCRIPT;
the tree’s degree n𝑛nitalic_n.
Output :  Top-K𝐾Kitalic_K predicted batched future routes {xkf~}k=1Ksuperscriptsubscript~superscriptsubscript𝑥𝑘𝑓𝑘1𝐾\left\{\widetilde{x_{k}^{f}}\right\}_{k=1}^{K}{ over~ start_ARG italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT.
1 // Initialize the root node.
2 root \leftarrow CreateNewNode(name = “root”, parent = NIL, end_nodes = vΓssuperscriptsubscript𝑣Γ𝑠superscriptv_{\Gamma}^{s}\in\mathbb{R}^{\mathcal{B}}italic_v start_POSTSUBSCRIPT roman_Γ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT caligraphic_B end_POSTSUPERSCRIPT, preds = NIL)
3 // Recursively generate a tree of future routes in a greedy manner.
4 for γ=1,,Γ𝛾1normal-…superscriptnormal-Γnormal-′\gamma=1,\dots,\Gamma^{\prime}italic_γ = 1 , … , roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT do
5       // Get leaves of the current tree.
6       leaves \leftarrow GetLeaves(root)
7       // Span for each leaf.
8       for leaf \in leaves do
9             // Get the adjacent edges given the end node.
10             𝒩end_nodee×NAsuperscriptsubscript𝒩𝑒𝑛𝑑_𝑛𝑜𝑑𝑒𝑒superscriptsubscript𝑁𝐴\mathcal{N}_{end\_node}^{e}\in\mathbb{R}^{\mathcal{B}\times N_{A}}caligraphic_N start_POSTSUBSCRIPT italic_e italic_n italic_d _ italic_n italic_o italic_d italic_e end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_e end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT caligraphic_B × italic_N start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT end_POSTSUPERSCRIPT = 𝐀[leaf.end_nodes,:]\mathbf{A}[leaf.end\_nodes,:]bold_A [ italic_l italic_e italic_a italic_f . italic_e italic_n italic_d _ italic_n italic_o italic_d italic_e italic_s , : ]
11             // Get the top-n𝑛nitalic_n adjacent edges with highest probabilities based on Pr(xif,γ~)Pr~subscriptsuperscript𝑥𝑓𝛾𝑖\mathrm{Pr}(\widetilde{x^{f,\gamma}_{i}})roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ).
12             {ekΓ+γ}k=1nsuperscriptsubscriptsuperscriptsubscript𝑒𝑘Γ𝛾superscript𝑘1𝑛\left\{e_{k}^{\Gamma+\gamma}\in\mathbb{R}^{\mathcal{B}}\right\}_{k=1}^{n}{ italic_e start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + italic_γ end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT caligraphic_B end_POSTSUPERSCRIPT } start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT = GetTopK(Pr(xf,γ~)[:,𝒩end_nodee]Pr~superscript𝑥𝑓𝛾:superscriptsubscript𝒩𝑒𝑛𝑑_𝑛𝑜𝑑𝑒𝑒\mathrm{Pr}(\widetilde{x^{f,\gamma}})[:,\mathcal{N}_{end\_node}^{e}]roman_Pr ( over~ start_ARG italic_x start_POSTSUPERSCRIPT italic_f , italic_γ end_POSTSUPERSCRIPT end_ARG ) [ : , caligraphic_N start_POSTSUBSCRIPT italic_e italic_n italic_d _ italic_n italic_o italic_d italic_e end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_e end_POSTSUPERSCRIPT ], K=n𝐾𝑛K=nitalic_K = italic_n)
13             // Create leaf node for top-n𝑛nitalic_n edges and add to the tree.
14             for k=1,,n𝑘1normal-…𝑛k=1,\dots,nitalic_k = 1 , … , italic_n do
15                   // Create leaf node and add to the tree.
16                   node = CreateNewNode(name=“k𝑘kitalic_k”, parent=leaf, end_node=ekΓ+γ[1]superscriptsubscript𝑒𝑘Γ𝛾delimited-[]1superscripte_{k}^{\Gamma+\gamma}[1]\in\mathbb{R}^{\mathcal{B}}italic_e start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + italic_γ end_POSTSUPERSCRIPT [ 1 ] ∈ blackboard_R start_POSTSUPERSCRIPT caligraphic_B end_POSTSUPERSCRIPT, pred=ekΓ+γsuperscriptsubscript𝑒𝑘Γ𝛾superscripte_{k}^{\Gamma+\gamma}\in\mathbb{R}^{\mathcal{B}}italic_e start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ + italic_γ end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT caligraphic_B end_POSTSUPERSCRIPT)
17             end for
18            
19       end for
20      
21 end for
22leaves \leftarrow GetLeaves(root)
23 // Traverse the tree to get top-K𝐾Kitalic_K future routes.
24 for k=1,,K𝑘1normal-…𝐾k=1,\dots,Kitalic_k = 1 , … , italic_K do
25       // Get the path from root to the k𝑘kitalic_k-th leaf.
26       pathksubscriptpath𝑘\text{path}_{k}path start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = Traverse(root, leaves[k𝑘kitalic_k])
27       // Get the generated k𝑘kitalic_k-th route.
28       xkf~×Γ~superscriptsubscript𝑥𝑘𝑓superscriptsuperscriptΓ\widetilde{x_{k}^{f}}\in\mathbb{R}^{\mathcal{B}\times\Gamma^{\prime}}over~ start_ARG italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_f end_POSTSUPERSCRIPT end_ARG ∈ blackboard_R start_POSTSUPERSCRIPT caligraphic_B × roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT = {pathk[i].pred}i=1Γsuperscriptsubscriptsubscriptpath𝑘[i].predsuperscript𝑖1superscriptΓ\left\{\text{path}_{k}\text{[i].pred}\in\mathbb{R}^{\mathcal{B}}\right\}_{i=1}% ^{\Gamma^{\prime}}{ path start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT [i].pred ∈ blackboard_R start_POSTSUPERSCRIPT caligraphic_B end_POSTSUPERSCRIPT } start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_Γ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT
29      
30 end for
Algorithm 3 Spanning Route (minibatch).

Appendix C Hyperparameters

This study applied consistent experimental configurations to both datasets to ensure reliable and comparable results. A training batch size of 2048 was maintained, and the maximum number of epochs was set to 10,000. Early stopping was employed with a patience parameter of 100 epochs. The hidden dimensions, denoted by δsubscript𝛿\delta_{\mathcal{E}}italic_δ start_POSTSUBSCRIPT caligraphic_E end_POSTSUBSCRIPT, δcsubscript𝛿superscript𝑐\delta_{\mathcal{R}^{c}}italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, δssubscript𝛿superscript𝑠\delta_{\mathcal{R}^{s}}italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_s end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, δasubscript𝛿superscript𝑎\delta_{\mathcal{R}^{a}}italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_a end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, and δdsubscript𝛿superscript𝑑\delta_{\mathcal{R}^{d}}italic_δ start_POSTSUBSCRIPT caligraphic_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, were uniformly set to 64.

The Adam optimizer was utilized to update the model’s parameters, with a learning rate 1e-3 and weight decay set at 1e-2. To scale the sampling probability distribution for top-k𝑘kitalic_k predictions, a temperature parameter of 0.1 was employed for the Chengdu dataset and 0.13 for the Shanghai dataset.

Regarding the weights assigned to different loss terms, under the NoGoal scenario, the weights [wrep,wrank,wpred,wd]subscript𝑤𝑟𝑒𝑝subscript𝑤𝑟𝑎𝑛𝑘subscript𝑤𝑝𝑟𝑒𝑑subscript𝑤𝑑[w_{rep},w_{rank},w_{pred},w_{d}][ italic_w start_POSTSUBSCRIPT italic_r italic_e italic_p end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT italic_r italic_a italic_n italic_k end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT italic_p italic_r italic_e italic_d end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ] were set at [1,1,1,2.4]1112.4[1,1,1,2.4][ 1 , 1 , 1 , 2.4 ] for the Chengdu dataset and [1.3,2.8,0.5,2.9]1.32.80.52.9[1.3,2.8,0.5,2.9][ 1.3 , 2.8 , 0.5 , 2.9 ] for the Shanghai dataset. Under the GoalD scenario, the weights [wrep,wrank,wpred]subscript𝑤𝑟𝑒𝑝subscript𝑤𝑟𝑎𝑛𝑘subscript𝑤𝑝𝑟𝑒𝑑[w_{rep},w_{rank},w_{pred}][ italic_w start_POSTSUBSCRIPT italic_r italic_e italic_p end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT italic_r italic_a italic_n italic_k end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT italic_p italic_r italic_e italic_d end_POSTSUBSCRIPT ] were established as [1,1,1]111[1,1,1][ 1 , 1 , 1 ] for the Chengdu dataset and [1.4,2.1,1.7]1.42.11.7[1.4,2.1,1.7][ 1.4 , 2.1 , 1.7 ] for the Shanghai dataset. Lastly, for the Goal scenario, the weights [wrep,wrank,wpred]subscript𝑤𝑟𝑒𝑝subscript𝑤𝑟𝑎𝑛𝑘subscript𝑤𝑝𝑟𝑒𝑑[w_{rep},w_{rank},w_{pred}][ italic_w start_POSTSUBSCRIPT italic_r italic_e italic_p end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT italic_r italic_a italic_n italic_k end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT italic_p italic_r italic_e italic_d end_POSTSUBSCRIPT ] were set as [2.4,2.2,2.8]2.42.22.8[2.4,2.2,2.8][ 2.4 , 2.2 , 2.8 ] for the Chengdu dataset and [1.9,1.3,2.4]1.91.32.4[1.9,1.3,2.4][ 1.9 , 1.3 , 2.4 ] for the Shanghai dataset. These weight configurations were chosen based on preliminary experiments and empirical observations.