  Real-time what-if traffic prediction is crucial for decision making in
intelligent traffic management and control. Although current deep learning
methods demonstrate significant advantages in traffic prediction, they are
powerless in what-if traffic prediction due to their nature of
correla-tion-based. Here, we present a simple deep learning framework called
TraffNet that learns the mechanisms of traffic generation for what-if
pre-diction from vehicle trajectory data. First, we use a heterogeneous graph
to represent the road network, allowing the model to incorporate causal
features of traffic flows, such as Origin-Destination (OD) demands and routes.
Next, we propose a method for learning segment representations, which models
the process of assigning OD demands onto the road network. The learned segment
represen-tations effectively encapsulate the intricate causes of traffic
generation, facilitating downstream what-if traffic prediction. Finally, we
conduct experiments on synthetic datasets to evaluate the effectiveness of
TraffNet. The code and datasets of TraffNet is available at
https://github.com/iCityLab/TraffNet.
