liyaguang / DCRNN

Implementation of Diffusion Convolutional Recurrent Neural Network in Tensorflow
MIT License
1.22k stars 400 forks source link

How to calculate the distances between each node? #23

Closed kyungeuuun closed 5 years ago

kyungeuuun commented 5 years ago

Hello, Li. I wonder how to calculate the distances between each node. (According to README.md (Graph Construction), this part is being added, but it is not provided yet.)

I calculated some distances using Google map, however, my results were different from yours. For example, for the case of 773906 > 767471, my result was 13.0km, and the value from your data was 10419.9m.

Could you please explain how to calculate node-to-node distance, or provide the data for this process?

liyaguang commented 5 years ago

Hi kyungeuuun,

The distance between two locations/nodes are calculated using A* search on the road network. A map is needed for this calculation.
Besides, the discrepancy of the distance may because of the following two aspects:

You may the Euclidean distance between two nodes as a starting point.

sshleifer commented 5 years ago

Imagine we have one sensor on a northbound highway i and one on a southbound highway j at roughly the same exit. Would the "road network distance" for i,j be how long it takes to get off the highway, get back on the highway and drive south to the other sensor (in meters)?

liyaguang commented 4 years ago

Hi @sshleifer , the road network distance is shortest distance the vehicle has to travel from the source to the destination under the constraint imposed by the network. If

get off the highway, get back on the highway and drive south to the other sensor

is the shortest distance, it will be the case.

ThomasAFink commented 1 year ago

Here's how I created my own distance matrix: https://github.com/ThomasAFink/osmnx_adjacency_matrix_for_graph_convolutional_networks