Best connected Cities in Switzerland

Today I had a look at the Swiss public transport API provided via the Swiss Open Knowledge Foundation side. It gives access to all Swiss train schedules and connections. One needs just a little python script to download the data.

I retrieved the list of all Swiss cities with at least 10K inhabitants from Wikipedia and consider for each city all connections to all the other Swiss cities and calculate the average travel time (taking the fastest connection in each case).

Due to its central location and good infrastructure Zürich has the lowest average travel time of 77 minutes. From Bern ones needs already 10 minutes more on average, from St.Gallen 138 minutes, Geneva 156 minutes, Lugano 228 minutes (see complete list).

I used the OpenStreeMap library in R to display the average travel times on a map (klick for a better view):


One can see nicely where the cities are located (I plotted only the bigger cities when numbers were overlapping). There are of course two factors which play a role here: how centrally a city is located, and how fast the train connection is. By comparing nearby values one can get an idea of the relative importance of the two.