A cross-city OD flow generation method and system based on a prototype guide diffusion model

CN122925837APending Publication Date: 2026-10-16UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610791209.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-03
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0008]本发明旨在解决现有技术中OD流方向非对称性刻画不充分以及跨城市泛化能力不足的问题

Benefits of technology

[0044] This invention, based on a diffusion-generative modeling framework, overcomes the limitations of traditional mechanism-driven models in characterizing complex nonlinear spatial interactions. It innovatively introduces a dual-scale (regional and city-level) prototype library guidance mechanism to reduce structural drift during cross-domain transfers. Furthermore, addressing the inherent directionality of traffic flow, this invention incorporates an asymmetric role decoupling mechanism into the diffusion model, enhancing the rationality of the generated OD matrix. Compared to existing baseline models, this invention improves the model's generalization performance and generation accuracy when dealing with different cities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122925837A_ABST
    Figure CN122925837A_ABST
Patent Text Reader

Abstract

The application discloses a kind of intercity OD flow generation method and system based on prototype guide diffusion model, steps are as follows: city is divided into multiple spatial regions, and the population statistics attribute, point of interest attribute, region adjacency relation and interregional distance relation of each region are constructed as city graph structure representation;Based on region attribute, adjacency matrix and distance matrix, construct city context representation, input diffusion generation framework as conditional information;Introduce OD prototype feature shared across cities in denoising network, enhance region node representation using prototype library to extract potential travel patterns shared across cities;Through Graph Transformer, the node features and edge features are jointly modeled;Through the forward noise and reverse denoising process of diffusion model, generate target city OD matrix.The application introduces an asymmetric role decoupling mechanism in the diffusion model, improving the rationality of the generated OD matrix, improving the generalization performance and generation accuracy of the model when dealing with different cities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of urban computing and artificial intelligence generative modeling technology, specifically relating to a method and system for generating cross-city commuting origin-destination flow based on a prototype-guided diffusion model. Background Technology

[0002] Commuting origin-destination (OD) flows characterize the spatial movement of people from their residences to their workplaces within a city, serving as a crucial data foundation for urban transportation planning, spatial organization optimization, infrastructure allocation, and public governance. Typically, OD flows can be represented as a directed weighted matrix, where matrix elements reflect the intensity of travel between different areas. Because commuting behavior is influenced by multiple factors, including population attributes, land use, and the overall urban morphology and structure, significant spatial heterogeneity and behavioral differences often exist between different cities. This makes accurate modeling and cross-city generalization of OD flows a challenging technical problem.

[0003] Existing OD flow modeling methods mainly fall into two categories: mechanism-driven methods and data-driven methods. Traditional mechanism-driven methods, such as gravity models, radiation models, and their improved models, typically describe inter-regional travel connections from the perspectives of population size and distance impedance. While they possess a certain degree of interpretability, they struggle to characterize the nonlinear coupling relationships between multiple heterogeneous factors in complex urban environments. Therefore, their generalization ability and modeling accuracy are significantly limited when faced with differences in urban spatial structures and commuting patterns.

[0004] With the development of artificial intelligence technology, data-driven OD flow modeling methods have gradually become a research hotspot. Early methods typically employed deep learning models such as convolutional neural networks and recurrent neural networks, combining demographic data, points of interest, road network structure, and historical traffic data to predict travel connections between regions. While these methods can improve the accuracy of OD flow modeling to some extent, their expression of spatial relationships is usually limited, especially when dealing with complex urban structures, making it difficult to simultaneously consider the combined impact of regional attribute differences and inter-regional spatial relationships.

[0005] To enhance the ability to characterize regional relationships, existing research has further introduced graph learning methods such as graph neural networks, representing urban regions as nodes and inter-regional relationships as edges, thereby modeling spatial interactions within cities. This type of method can effectively utilize the connectivity between regions, improving the model's ability to express urban spatial structure. However, most existing graph modeling methods employ a relatively uniform node interaction approach, which remains limited in representing the differentiated effects between originating and arriving regions when dealing with directional OD flows. Furthermore, to address the issue of insufficient historical OD data in some cities, existing research has begun to employ transfer learning methods, transferring knowledge from data-rich cities to target cities to improve modeling capabilities in data-scarce scenarios. This type of method alleviates the impact of insufficient target city samples to some extent, but due to significant differences in population distribution, regional functional structure, and spatial morphology among different cities, existing transfer methods are easily affected by inter-city differences when applied across cities, leading to decreased model stability and adaptability.

[0006] In recent years, generative models have been increasingly applied to OD flow modeling tasks. For example, some methods utilize variational autoencoders, generative adversarial networks, and diffusion models to learn OD flow distributions in order to generate the OD matrix of a target city. These methods can model commuter flows from an overall distribution perspective, showing certain advantages under conditions of data scarcity. However, existing generative methods are still insufficient in the joint utilization of multiple types of information, such as urban regional attributes and spatial structural relationships.

[0007] In summary, existing technologies generally suffer from shortcomings such as insufficient characterization of the asymmetry of OD flow direction and limited ability to extract cross-city shared mobility patterns. Therefore, there is an urgent need for a new method and system for generating cross-city OD flows to achieve collaborative modeling of regional semantics, directional features, and cross-city shared mobility patterns, thereby improving the accuracy, spatial consistency, and cross-city generalization ability of the generated results. Summary of the Invention

[0008] The present invention aims to solve the problems of insufficient characterization of OD flow direction asymmetry and insufficient cross-city generalization ability in the prior art.

[0009] To achieve the above-mentioned technical objectives and effects, the present invention provides the following technical solution:

[0010] A method for generating cross-city commuting origin-destination flows based on a prototype-guided diffusion model includes the following steps:

[0011] (1) City graph construction: The city is divided into multiple spatial regions, the attribute information of each region is extracted, and the regional attribute matrix, adjacency matrix and distance matrix are constructed. The regions are used as graph nodes and the commuting flow between regions is used as directed weighted edges to form a directed weighted graph structure of the city.

[0012] (2) Urban context representation: Urban spatial context representation is constructed based on regional attribute matrix, adjacency matrix and distance matrix, and it is used as conditional information input to the conditional diffusion generation framework;

[0013] (3) Prototype-guided representation enhancement: Introduce a cross-city shared prototype library into the denoising network, enhance the prototype features of regional node representations, and extract potential travel patterns shared across cities;

[0014] (4) OD role decoupling and interaction modeling: Using the Graph Transformer with asymmetric attention mechanism for decoupling the start-end role, the node features and edge features are jointly modeled to represent the asymmetric interaction relationship between the starting region and the destination region in the OD flow;

[0015] (5) OD matrix generation and output: Through the forward noise addition and reverse noise reduction process of the diffusion model, the OD matrix of the target city is gradually recovered and the commuter OD flow generation result of the target city is output.

[0016] Specifically, the process of step (1) is as follows: dividing the target city into... The graph is divided into three discrete spatial regions, each corresponding to a graph node. Demographic and interest features are extracted from each region to construct a region attribute matrix. An adjacency matrix is ​​constructed based on the adjacency relationships between regions, and a distance matrix is ​​constructed based on the geographical distances between regions. Commuting flows between regions are used as directed weighted edges to form a directed weighted graph of the city. ,in For a set of nodes, Let be a set of directed edges. This is the edge weight matrix.

[0017] Specifically, the process of step (2) is as follows:

[0018] The regional attribute matrix, adjacency matrix, and distance matrix are integrated into a representation of the urban spatial context. ,in For the region attribute matrix, It is a distance matrix. It is an adjacency matrix;

[0019] In the forward diffusion stage of the diffusion model, Gaussian noise is gradually injected into the OD matrix to obtain different diffusion steps. The noise OD matrix below Its Markov transition probability is:

[0020]

[0021] in, Indicates diffusion step The current travel flow status For the first The noise intensity parameters of the step;

[0022] Before entering the denoising network, a learnable embedding mapping is performed on the heterogeneous inputs:

[0023]

[0024] in, For node features, As edge features, These are adjacent prior features. This is a distance prior feature.

[0025] Specifically, step (3) employs a cross-city shared two-layer OD prototype mechanism for feature representation enhancement, which specifically includes:

[0026] (a) Regional Prototype Enhancement: Spatial aggregation of node features is achieved through a graph convolutional network with distance information as aggregation weights, resulting in a regional representation that includes neighborhood context; a cross-city shared prototype is constructed. A region prototype library consisting of region prototype vectors The similarity between the region representation and the prototype is calculated, and the prototype attention weight is obtained by softmax normalization. The region representation enhanced by the prototype is obtained by weighted summation based on the weights, and then fused with the original region features to obtain the region prototype enhanced feature representation.

[0027] (b) Enhanced City-Level Macro Prototype: The city's macro feature vector is obtained by aggregating the mean values ​​of all regional node representations within the city, and then mapped to a city query vector using a multilayer perceptron; a cross-city shared prototype is constructed. A city prototype library composed of city prototype vectors The cosine similarity between the city query vector and each city prototype is calculated. After softmax normalization, the attention assignment weight of the city prototype is obtained. The city prototype is weighted and summed according to the weight to obtain the city-level macro-structure prior. A gating coefficient is generated for each regional node. The city-level macro-structure prior is injected into the node representation through the gating mechanism to obtain the feature representation of the city prototype.

[0028] Specifically, the process of step (4) is as follows:

[0029] Representing the nodes of each layer of the Graph Transformer By projecting independent linear mappings onto the origin semantic space and the destination semantic space respectively, we obtain the origin representation. and destination representation ;

[0030] In the Layer In each attention head, the origin representation, destination representation, and edge features are combined. and adjacent prior Calculate attention score Attention weights are obtained by softmax normalization. ;

[0031] The node representation is updated based on the destination value projection after weighted summation of attention weights; at the same time, multi-head attention scores are combined with distance priors. Update the edge representation; after multi-layer node-edge joint interaction modeling, output the final edge features for noise prediction.

[0032] Specifically, the process of step (5) is as follows:

[0033] During the training phase, the denoising network is optimized by minimizing the mean square error between the predicted noise and the actual injected noise. Its loss function is:

[0034]

[0035] in, The actual OD matrix, To inject noise into reality, Predict noise for the model;

[0036] In the inference phase, starting from the Gaussian noise matrix, under the constraints of urban spatial context representation and two-layer prototype mechanism, a complete reverse denoising sampling process is executed to gradually reconstruct the commuting OD matrix of the target city.

[0037] On the other hand, the present invention also provides a cross-city OD flow generation system based on a prototype-guided diffusion model, for implementing the method described above, including:

[0038] The city map construction module is used to divide the target city into multiple spatial regions, extract the demographic and interest features of each region, construct the regional attribute matrix, the inter-regional adjacency matrix, and the distance matrix, and form a directed weighted city graph structure with regions as nodes and commuting flows as directed weighted edges.

[0039] The city context representation module is used to integrate the regional attribute matrix, adjacency matrix and distance matrix to generate a city spatial context representation. It uses this as input to the conditional information diffusion generation framework and performs learnable embedding mapping on node features, edge features, adjacency priors and distance priors.

[0040] The prototype-guided representation enhancement module has a built-in regional prototype library and city prototype library that are shared across cities. It is used to perform regional-level prototype enhancement and city-level macro prototype enhancement on the regional node representation in sequence, and to extract potential travel patterns shared across cities.

[0041] The OD role decoupling and interaction modeling module adopts a Graph Transformer with an asymmetric attention mechanism for decoupling the start-end role, which is used to jointly model node features and edge features to characterize the asymmetric interaction relationship between the starting region and the destination region of the OD flow.

[0042] The OD matrix generation and output module is used to optimize the parameters of the denoising network through mean square error loss during the training phase, and to generate and output the target city commuting OD matrix from Gaussian noise through a reverse denoising process during the inference phase.

[0043] Compared with the prior art, the beneficial effects of the present invention are:

[0044] This invention, based on a diffusion-generative modeling framework, overcomes the limitations of traditional mechanism-driven models in characterizing complex nonlinear spatial interactions. It innovatively introduces a dual-scale (regional and city-level) prototype library guidance mechanism to reduce structural drift during cross-domain transfers. Furthermore, addressing the inherent directionality of traffic flow, this invention incorporates an asymmetric role decoupling mechanism into the diffusion model, enhancing the rationality of the generated OD matrix. Compared to existing baseline models, this invention improves the model's generalization performance and generation accuracy when dealing with different cities. Attached Figure Description

[0045] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the description of the specific embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0046] Figure 1 This is a schematic diagram of the basic process of the method in an embodiment of the present invention;

[0047] Figure 2 This is a schematic diagram of the multi-scale prototype enhancement module structure in an embodiment of the present invention;

[0048] Figure 3This is a schematic diagram of an asymmetric interaction network based on OD role decoupling in an embodiment of the present invention. Detailed Implementation

[0049] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0050] A method for generating cross-city origin-destination flows based on a prototype-guided diffusion model, the implementation steps of which are as follows:

[0051] (1) City map construction: Divide the city into multiple spatial regions, extract regional attribute information, construct regional attributes, adjacency matrix and distance matrix to form city map structure;

[0052] (2) City context representation: The city context representation is constructed based on the regional attribute matrix, adjacency matrix and distance matrix, and is used as the conditional information input for the diffusion generation framework;

[0053] (3) Prototype-guided representation enhancement: Introduce a cross-city shared prototype library into the denoising network to enhance the representation of regional nodes and extract potential travel patterns shared across cities.

[0054] (4) OD role decoupling and interaction modeling: Graph Transformer with asymmetric attention mechanism for decoupling start-end roles is used to jointly model node features and edge features;

[0055] (5) OD matrix generation and output: The OD matrix of the target city is gradually recovered through a denoising network, and the commuting OD flow generation result of the target city is output.

[0056] The detailed steps of step (1) are as follows:

[0057] The target city is divided into multiple spatial regions, and each region is represented as a graph node. Demographic and interest features of each region are extracted to construct a regional attribute matrix. An adjacency matrix is ​​constructed based on the adjacency relationships between regions, and a distance matrix is ​​constructed based on the geographical distances between regions. Commuting flows between regions are represented as directed weighted edges, thus forming the city graph structure of the target city.

[0058] The detailed steps of step (2) are as follows:

[0059] A city context representation is constructed based on the regional attribute matrix, adjacency matrix, and distance matrix, and the city context representation is used as conditional information input to the diffusion generation model.

[0060] The detailed explanation of step (3) is as follows:

[0061] In the denoising network, a regional prototype library shared across cities is set up. By calculating the similarity between the regional node representation and the regional prototype, the feature representation of the regional prototype is enhanced. At the same time, the information of each region is fused to construct a city-level context vector, and city prototype information is extracted to obtain the feature representation of the city prototype enhanced.

[0062] The detailed explanation of step (4) is as follows:

[0063] Region nodes are mapped to the starting and ending semantic spaces, respectively, and an asymmetric attention mechanism is constructed based on these spaces. A Graph Transformer is used to jointly model node features and edge features to characterize the asymmetric interaction between the starting and ending regions in the OD flow.

[0064] The detailed explanation of step (5) is as follows:

[0065] The noise introduced during the diffusion process is predicted by a denoising network, and the noise OD matrix is ​​gradually denoised and restored based on the prediction results to generate the target city OD matrix.

[0066] The invention will be further explained below with reference to the accompanying drawings, taking the generation of cross-city commuting OD flows as an example.

[0067] like Figure 1 As shown, the cross-city OD flow generation method of this invention has the following implementation steps:

[0068] (1) City map construction;

[0069] (2) City context representation;

[0070] (3) Prototype-guided representation enhancement;

[0071] (4) Decoupling of OD roles and interaction modeling;

[0072] (5) OD matrix generation and output.

[0073] In this embodiment, the specific description of the city map construction in step (1) is as follows:

[0074] The urban commuting OD matrix is ​​modeled as a directed weighted graph. The city was divided into A discrete spatial region, a set of nodes Each node in the list corresponds to a city region. ; Let it be a set of directed edges, representing travel connections between regions; The edge weights correspond to the commuter flow scale. Each node consists of a region attribute feature vector. The description reflects the distribution of population and functions. All regional characteristics together constitute the urban regional characteristic matrix. Spatial relationships between regions are determined by a distance matrix. Adjacency Matrix Depiction, where spaces are adjacent Otherwise, it is 0.

[0075] In this embodiment, the specific explanation of the city context representation in step (2) is as follows:

[0076] Regional attribute features, distance matrix, and adjacency matrix are collectively referred to as the spatial context representation of a city. Before entering the denoising network, learnable embedding mappings are performed on node features, edge features, and spatial structure priors:

[0077]

[0078] in, Represents city Population and functional characteristics of each region; This represents the noise OD matrix at the current diffusion step; and These are the adjacency matrix and the distance matrix, respectively. Through the above embedding operation, heterogeneous inputs are uniformly mapped to a learnable semantic space, providing a basic representation for subsequent structured denoising modeling.

[0079] In this embodiment, the specific explanation of the prototype-guided representation enhancement in step (3) is as follows:

[0080] To enhance cross-city generalization capabilities, a two-layer OD prototype mechanism for cross-city sharing is constructed within the denoising network:

[0081] (a) Region-level prototype enhancement: Spatial aggregation of node representations is performed using a lightweight GNN to obtain region representations that include neighborhood context. :

[0082]

[0083] in, This represents a graph convolutional network that uses distance information as aggregation weights to converge functional and population information of neighboring regions, enhancing the spatial consistency of prototype weight estimation. Next, cross-city shared [data / mechanisms] are introduced. The prototype vectors constitute the prototype library: Calculate region-prototype similarity and obtain prototype attention allocation: , Based on this, weights are assigned to obtain the prototype-enhanced region representation:

[0084]

[0085] Finally, the prototype enhancement features are fused with the original region features to form the node input that is fed into the subsequent denoising network.

[0086]

[0087] (b) City-level macro prototype: Mean aggregation of all regional node representations within the city:

[0088]

[0089] Map it to a query vector using MLP. Let the city prototype library be... The attention assignment is obtained by calculating the cosine similarity between the query and the prototype and normalizing it.

[0090]

[0091] Based on this attention, a weighted summation of the city prototype is used to construct a priori city-level macro-structure:

[0092]

[0093] Generate gating coefficients for each region node. And inject city-level priors into the node representation:

[0094]

[0095] In this embodiment, the specific process of step (4) OD role decoupling and interaction modeling is as follows:

[0096] Considering the directional asymmetry of the origin-destination flow between the origin and destination, the node representation in the Graph Transformer is decoupled from the OD role. The node representation in layer l is as follows: , among which when hour, The origin and destination representations are obtained through independent linear mappings:

[0097]

[0098] In the Layer In each attention head, edge features are combined. and Adjacency Prior Calculate attention scores. Only in front of the... The first layer concatenates the adjacency embeddings and edge representations as an attention bias, causing the model to prioritize local spatial relationships. Subsequent layers remove the adjacency embeddings, retaining only the edge representations, to enhance the modeling ability for global OD interactions.

[0099]

[0100] Normalize the attention scores to obtain attention weights:

[0101]

[0102] Update the node representation based on this weight:

[0103]

[0104] in, Representation and region A set of spatially adjacent regions.

[0105] Simultaneously, the edge representation is updated using the multi-head attention score:

[0106]

[0107] in, The distance prior, obtained by mapping the distance matrix, is used to constrain the distance decay characteristics of the OD flow. After multi-layer node-edge joint interaction modeling, the prediction results for the noise term are output using the final edge features.

[0108] In this embodiment, the specific process of generating and outputting the OD matrix in step (5) is as follows:

[0109] During the training phase, the denoising network is optimized by minimizing the mean square error between the predicted noise and the actual noise, and its loss function is:

[0110]

[0111] in, The actual OD matrix, To inject noise, To predict noise for the model.

[0112] During the inference phase, starting from the Gaussian noise matrix, and under the joint constraints of urban spatial context representation and two-layer prototype mechanism, a commuting OD matrix that conforms to the target urban spatial structure and functional characteristics is finally generated after a complete reverse denoising sampling process.

[0113] In summary, the key to achieving this embodiment lies in providing a cross-city OD flow generation method based on a prototype-guided diffusion model. According to this method, high-fidelity commuter flow matrices can be effectively synthesized for new target cities lacking historical data. Based on a diffusion-generated modeling framework, this method overcomes the limitations of traditional mechanism-driven models in characterizing complex nonlinear spatial interactions. It innovatively introduces a dual-scale (regional and city-level) prototype library guidance mechanism, reducing structural drift during cross-domain transfers. Furthermore, considering the inherent directionality of traffic flow, this invention introduces an asymmetric role decoupling mechanism into the diffusion model, improving the rationality of the generated OD matrix. Compared to existing baseline models, this invention improves the model's generalization performance and generation accuracy when dealing with different cities.

[0114] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0115] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.

Claims

1. A method for generating cross-city commuting origin-destination flows based on a prototype-guided diffusion model, characterized in that, Includes the following steps: (1) City graph construction: The city is divided into multiple spatial regions, the attribute information of each region is extracted, and the regional attribute matrix, adjacency matrix and distance matrix are constructed. The regions are used as graph nodes and the commuting flow between regions is used as directed weighted edges to form a directed weighted graph structure of the city. (2) Urban context representation: Urban spatial context representation is constructed based on regional attribute matrix, adjacency matrix and distance matrix, and it is used as conditional information input to the conditional diffusion generation framework; (3) Prototype-guided representation enhancement: Introduce a cross-city shared prototype library into the denoising network, enhance the prototype features of regional node representations, and extract potential travel patterns shared across cities; (4) OD role decoupling and interaction modeling: Using GraphTransformer with asymmetric attention mechanism for decoupling the start-end role, node features and edge features are jointly modeled to represent the asymmetric interaction relationship between the starting region and the destination region in the OD flow; (5) OD matrix generation and output: Through the forward noise addition and reverse noise reduction process of the diffusion model, the OD matrix of the target city is gradually recovered and the commuter OD flow generation result of the target city is output.

2. The method according to claim 1, characterized in that, The specific process of step (1) is as follows: divide the target city into The graph is divided into three discrete spatial regions, each corresponding to a graph node. Demographic and interest features are extracted from each region to construct a region attribute matrix. An adjacency matrix is ​​constructed based on the adjacency relationships between regions, and a distance matrix is ​​constructed based on the geographical distances between regions. Commuting flows between regions are used as directed weighted edges to form a directed weighted graph of the city. ,in For a set of nodes, Let be a set of directed edges. This is the edge weight matrix.

3. The method according to claim 1, characterized in that, The specific process of step (2) is as follows: The regional attribute matrix, adjacency matrix, and distance matrix are integrated into a representation of the urban spatial context. ,in For the region attribute matrix, The distance matrix is... It is an adjacency matrix; In the forward diffusion stage of the diffusion model, Gaussian noise is gradually injected into the OD matrix to obtain different diffusion steps. The noise OD matrix below Its Markov transition probability is: ; in, Indicates diffusion step The current travel flow status For the first The noise intensity parameters of the step; Before entering the denoising network, a learnable embedding mapping is performed on the heterogeneous inputs: ; in, For node features, As edge features, These are adjacent prior features. This is a distance prior feature.

4. The method according to claim 1, characterized in that, Step (3) employs a cross-city shared two-layer OD prototype mechanism for feature representation enhancement, specifically including: (a) Regional Prototype Enhancement: Spatial aggregation of node features is achieved through a graph convolutional network with distance information as aggregation weights, resulting in a regional representation that includes neighborhood context; a cross-city shared prototype is constructed. A region prototype library consisting of region prototype vectors The similarity between the region representation and the prototype is calculated, and the prototype attention weight is obtained by softmax normalization. The region representation enhanced by the prototype is obtained by weighted summation based on the weights, and then fused with the original region features to obtain the region prototype enhanced feature representation. (b) Enhanced City-Level Macro Prototype: The city's macro feature vector is obtained by aggregating the mean values ​​of all regional node representations within the city, and then mapped to a city query vector using a multilayer perceptron; a cross-city shared prototype is constructed. A city prototype library composed of city prototype vectors The cosine similarity between the city query vector and each city prototype is calculated. After softmax normalization, the attention assignment weight of the city prototype is obtained. The city prototype is weighted and summed according to the weight to obtain the city-level macro-structure prior. A gating coefficient is generated for each regional node. The city-level macro-structure prior is injected into the node representation through the gating mechanism to obtain the feature representation of the city prototype.

5. The method according to claim 1, characterized in that, The specific process of step (4) is as follows: Representing the nodes of each layer of the Graph Transformer By projecting independent linear mappings onto the origin semantic space and the destination semantic space respectively, we obtain the origin representation. and destination representation ; In the Layer In each attention head, the origin representation, destination representation, and edge features are combined. and adjacent prior Calculate attention score Attention weights are obtained by softmax normalization. ; The node representation is updated based on the destination value projection after weighted summation of attention weights; at the same time, multi-head attention scores are combined with distance priors. Update the edge representation; after multi-layer node-edge joint interaction modeling, output the final edge features for noise prediction.

6. The method according to claim 1, characterized in that, The specific process of step (5) is as follows: During the training phase, the denoising network is optimized by minimizing the mean square error between the predicted noise and the actual injected noise. Its loss function is: ; in, The actual OD matrix, To inject noise into reality, Predict noise for the model; In the inference phase, starting from the Gaussian noise matrix, under the constraints of urban spatial context representation and two-layer prototype mechanism, a complete reverse denoising sampling process is executed to gradually reconstruct the commuting OD matrix of the target city.

7. A cross-city OD flow generation system based on a prototype-guided diffusion model, characterized in that, For implementing the method as described in any one of claims 1-6, comprising: The city map construction module is used to divide the target city into multiple spatial regions, extract the demographic and interest features of each region, construct the regional attribute matrix, the inter-regional adjacency matrix, and the distance matrix, and form a directed weighted city graph structure with regions as nodes and commuting flows as directed weighted edges. The city context representation module is used to integrate the regional attribute matrix, adjacency matrix and distance matrix to generate a city spatial context representation. It uses this as input to the conditional information diffusion generation framework and performs learnable embedding mapping on node features, edge features, adjacency priors and distance priors. The prototype-guided representation enhancement module has a built-in regional prototype library and city prototype library that are shared across cities. It is used to perform regional-level prototype enhancement and city-level macro prototype enhancement on the regional node representation in sequence, and to extract potential travel patterns shared across cities. The OD role decoupling and interaction modeling module adopts GraphTransformer with a start-end role decoupling asymmetric attention mechanism to jointly model node features and edge features, and characterize the asymmetric interaction relationship between the starting region and the destination region of the OD flow. The OD matrix generation and output module is used to optimize the parameters of the denoising network through mean square error loss during the training phase, and to generate and output the target city commuting OD matrix from Gaussian noise through a reverse denoising process during the inference phase.