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.
- Play with it yourself
- Grab the code from GitLab
- I've also created a version with every London station and train line.
- 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).
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
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.