SBB
In the previous post the network consisted of only 25 nodes. Who needs computers, right? SBB
, the Swiss Federal Railways, definitely do. In fact, they maintain an amazing data repository comprised of over sixty datasets
with many thousand entries each. The company even launched a Kaggle
competition in 2018 because there was no standard software to cover their increasing needs.
Here I would like to show the bigger picture without going into task-specific problem solving. It is about connecting the dots, making a living organism out of the network, beyond coordinate systems.
Basel SBB
Import Data
The original dataset contains information about the yearly total number of trains that pass through each route section of Switzerland. The list contains entries for 2016, 2017 and 2018. Distinction is also made between passenger transport and cargo. For this post, I will focus only on passenger transport in 2018. Comparative studies along the aforementioned two axes are reserved for the near future.
PID | Anzahl_Zuege |
---|---|
SBB_GESE_CHY | 126307 |
SBB_GIBU_ROL | 97943 |
SBB_MIES_TAN | 126101 |
SBB_MOR_STJ | 121566 |
SBB_PER_ALL | 98005 |
Preprocessing
As is often the case with transportation networks, there are origin and destination points. Caution :skull:! These two sets of points do not have to be congruent and in this case they aren’t. Let’s extract the respective longitudes and latitudes and have a look.
Longitude of origin
Latitude of origin
Longitude of destination
Latitude of destination
Map of origins and destinations
Spot the difference :trollface:
Coordinates of origins
Coordinates of destinations
Final list of nodes
Building the graph
The graph is directed, so I will initialize it as a DiGraph
with weighted edges and proceed with a bidirectional copy.
Graph as a Map
Now the graph is fully operational and we can very easily do all kinds of fun calculations.
Graph as a Network
New positions based solely on network dynamics abstracting away geography.
Check out the Jupyter notebook!
P.S. The thick purple line in the core is Langstrasse
with 336586 passenger trains in 2018.