Contribute Media
A thank you to everyone who has made this possible: Read More

A Tube Story: How can Python help us understand London's most important transportation network?

Summary

If you work in London, you have certainly experienced the joys and frustrations of commuting on the Tube. There are the very good mornings (lo and behold! An empty seat on the Northern Line) and then there are the very bad mornings (there is more space in a sardine can than on the Piccadilly). Using graph-tool, Bokeh and SimPy, we unravel some of the fascinating features of the London Tube.

Description

The daily commute in London is an adventure that keeps surprising, in good ways and in bad. Some mornings things go smoothly: for once there is an empty seat on the Northern Line and you only need to wait ten minutes before reaching the escalator at Bank. On other days, a signal failure at Moorgate and all Piccadilly line travellers will become intimately acquainted with the sweet fragrance of a fellow commuter's toothpaste. After a few months, the more or less frustrated commuter will begin to notice some interesting patterns and ask questions. Why is it that a suspended Circle line can wreak havoc on commuters on the Central line? Can delays at Victoria lead to overcrowding of the Jubilee platform at London Bridge? What is the fastest way to visit all stations in the Tube network?

The London Tube can be modelled as a graph with vertices representing the stations and edges representing the connecting Tube lines. Using intuition and daily experience, we can guess that there are certain vertices in the Tube network that are vital to the overall health of the network. Pythonic graph analysis libraries such as graph-tool and interactive visualizations with Bokeh can corroborate that suspending stations – for example Baker Street, which lies at the intersection of 5 Tube lines- can cause congestion even at remote stations throughout the network.

In addition to studying the static properties of the London Tube, we will leverage the power of SimPy to create various simulations. This will allow us to explore how the Tube network evolves when key parameters such as commuter numbers, train speeds and the frequency of signal failures are introduced on and off peak times.

This talk is aimed at novice Python users. The attendees will hopefully come away with a basic understanding of how to use the graph-tool library to create graphs and store meta-information about them, how to use Bokeh to stream information to an interactive browser visualization and how to use SimPy to create simple simulations. While it will not be technically challenging, it will hopefully inspire beginner Pythonistas to seek interesting problems and apply libraries in the Python data analysis ecosystem to pose questions about data and then figure out the answers!

Details

Improve this page