How do I determine where I can get from the city by car? [closed]
How do I determine where I can get to from the city (say New York) for 2 hours (can change) by car?
First create a graph :
- each edge is a road
- each vertex is a city
Second Give a weight to each road = weight is the time from one city to another using this edge considering traffic etc...
Use Dijkstra's algorithm for example to calculate the min distance between 2 cities
Finally chose all the one with a weight less than 2 hours
I found Google Distance Matrix API. It's kind of what should be )
精彩评论