Representing a map of traffic as a matrix or vector

47 Views Asked by At

I have a map of road traffic in a city. This map is basically a graph (I think every navigation system represents it as a graph) where edges represent roads and nodes intersections. These edges have as attributes the amount of cars in that road, the average speed an other characteristics. I need to represent this network as a matrix or some kind of array, as I want to use it with a machine learning model to predict the future traffic in the edges.

The question is: How can I transform this graph representing traffic as a matrix or vector?. The key concept here is to be able to keep the spatial relations between the different roads as the traffic of an edge will likely affect the ones nearby. My intuition is that a Convolutional Neural Network (CNN's) such as the one used with images will work well with this use case too, but I don't know how can I transform this graph representation into one suitable for a CNN. I have seen methods that process an screenshot of the map of traffic (such as the MapImage attached) but I was looking for an alternative.

MapImage