Use Bellman-Ford shortest path algorithm
distance matrix, starting station, destination station
time matrix, starting station, destination station
shortest path and the shortest distance (or time)
distance matrix, time matrix, starting station s, destination station d
path, distance for each edge in the path, time for each edge in the path
- 1). Find all the stations which can be reached in 30 minutes from the station (s), and put them in a set (P) (excludes s)
- 2). Find the station (m) which is closest to the destination station (d) from the set (P)
- 3). Set s = m, and repeat 1) to 2) until s == d, which means the next station (s) is the destination station (d)
There are 41609 pairs of stations which are far away more than 30 minutes.
- 1). Average travelling distance: LSP - GSP = 0.48566 kilometers.
- 2). Average travelling time: LSP - GSP = -3.35 minutes.
- 1). Average travelling distance: LSP - GSP = -2.88435 kilometers.
- 2). Average travelling time: LSP - GSP = 11.59 minutes.