Force Directed Graph of the London Tube Map - including CrossRail!
Force Directed Graphs of the London Underground have been done many times before - but I think I'm the first person to add the new Elizabeth Line (CrossRail).
I've also created a JSON graph of all of London's rail services - including DLR, Trams, C2C, ThamesLink etc.
Demo
- Play with it yourself
- Grab the code from GitLab
- I've also created a version with every London station and train line.
Limitations
- This is a quick weekend hack - don't expect polished code or performance!
- "Overlapping" lines don't show. So where a route is served by multiple lines, you'll only see one of them.
- Zoom is a bit shonky.
- Relies on an older version of D3 (V5).
Background
Drawing the Tube map as a graph is a popular pastime. See these prior arts:
- "Force-directed graph of tube lines" by Martin Zaltz Austwick (2011)
- "Graph Drawing by Weighted Constraint Relaxation" (2017)
- "What would the London Tube Map look like if Data Scientists designed it?" by Keith McNulty (2018)
- "Going Underground: Graphing and Pathfinding London Tube Lines" by Joe Depeau (2019)
- And many others.
I forked some code from Massimo Santini.
Chris Bell maintains an excellent CSV of all London stations and their connections
The official colours for each line can be found in TfL's colour branding guide and in hex versions at Oliver O'Brien's site.
What's next
Possible ideas - feel free to contribute on GitLab.
- Experiment with different layout algorithms.
- Weight links according to speed, distance, business, or some other metric.
- Better colour options for non-TfL lines.
- More efficient code.
HackerNewsTop10 said on twitter.com:
Force Directed Graph of London's Railways Link: shkspr.mobi/blog/2021/02/f… Comments: news.ycombinator.com/item?id=261318…
electronic max said on twitter.com:
i have just spent 10 minutes yanking the central line around on my screen > shkspr.mobi/blog/2021/02/f…
R says:
Fun to play with. Overground to enfield town is missing though: https://tfl.gov.uk/overground/stop/910GENFLDTN/enfield-town-rail-station?lineId=london-overground