Our zip digits range 1-9. These are numbered 0-2 from left to right which correspond to routing rows. Routing one hop from a station towards another station requires finding the first mismatched digit then looking up the mismatched digit-1 in the routing table.
See Zip Hierarchy
The well connected Fort Wayne station has direct paths to eight other stations. Details include its own three digit zip code, population, latitude and longitude.
{ "city": "Fort Wayne", "zip": 323, "pop": 373000, "lat": 41, "lon": -85.16, "path": [341,322,324,316,321,314,317,333], "route": [ [321,322,323,341,324,324,324,324,324], [316,323,333,341], [321,322,323,324] ] },
Note: Fort Wayne's zone 3xx has only four regions and its region 32x has only four stations. This makes for shorter routing tables for traffic within the zone or region.
function hop (from, toward) { for (let row of [0,1,2]) { if(digit(from,row) != digit(toward,row)) { let col = digit(toward,row)-1 return stations[from].route[row][col] } } return null }
The simulation starts quickly using precomputed least-hops routes for stations one, two and three zip digits away. For example, Flint 312 differs in the second digit so we look up 1 in the second route table to select the next hop to station 316, Battlecreek, Michigan.
A route from New York to San Francisco runs as follows. A route to self means traffic is at destination.
121 New York 124 Philadelphia 126 Harrisburg 151 Johnstown 154 Youngstown 156 Cleveland 321 Toledo 323 Fort Wayne 324 South Bend 511 Chicago 514 Rockford 542 Dubuque 545 Des Moines 546 Lincoln 721 North Platte 712 Cheyenne 731 Pueblo 611 Santa Fe 631 Gallup 633 Flagstaff 811 Las Vegas 831 Sequoia 833 Fresno 853 Monterey 855 San Fransisco
We expect stations to share estimates as to how quickly traffic will flow towards a distant station and that routing tables will be dynamically adjusted based on this information.
pages/next-hop-routing
See Analysis Tools