Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (26 sloc) 5.98 KB

LongestChainOfStopsInAlphabeticalOrder

A .NET 2 console application to find the longest chain of consecutive public transport stop that are also in alphabetical order in Great Britain. It relies on the Traveline National Dataset (TNDS), which is available from Traveline Open Data.

How to run it?

The Easiest way to run this program is to open the solution in Visual Studio 2017, change string basePath = @"D:\Dec_2017_traveline\"; in Program.cs to point to unzipped TransXChange format xml files you've downloaded from Traveline, and run the program. .NET 2 applications can run on Linux, and Mac OS too if you like, you'll need to download the .NET 2 runtime. Expect it to take about 10 minutes on a 3GHz Intel Core i7.

Just show me the results

There's an Excel file (.xlsx) in the root of this repo which combines all modes and rail. It's simplified a bit to remove very similar journeys, but it's pretty much all you need. If you want more results, dig into the folders. The results were generated by the program run on 2018-06-02.

What are the highlights?

  • There are 16715 unique services and 380552 unique journey patterns in the Traveline National Dataset. (a single service can run many patterns).
  • There is a 12 stop bus sequence in Newcastle, but the stops are numbered which i don't like. They are Barrack Road N/b, Bbc Tv Centre N (08926), Fenham Hall Drive W (08223), Fenham Hall Drive W (08241), Fenham Hall Drive W (08242), Fenham Hall Drive W (08243), Fenham Hall Drive W (08244), Fenham W (08245), Netherby Drive Nw (08246), Netherby Drive Nw (08247), Stamfordham Road W (08089), Stamfordham Road W (08090).
  • I consider the best of the longest consecutive alphabetical bus journeys in Great Britain to be in Tamworth. 11 stops, Bus Service 7, Tamworth - Stonydelph, which stops at the following named stops in order, Ealingham, Fossdale, Gayle, Grindsbook, Hawkside, Hebden, Lintly, Lowforce, Mellwaters, Mossdale, Murton.
  • The onther 11 stop sequence is on service 205, Dewsbury - Pudsey, which stops at the following named stops in order, Commonside Black Labrador PH, Commonside Bromley Street, Commonside Wood Lane, High Street Commonside, High Street Highgate St, High Street Kirkgate, High Street Rathlin Rd, John Ormsby Way Leeds Rd, Owl Lane Dewsbury Rams Stadium, Windsor Rd Owl Lane, Windsor Rd Windsor Close.
  • The longest consecutive alphabetical tram journey in Great Britain is in Manchester. 6 stops, Etihad Campus, Holt Town, New Islington, Piccadilly, Piccadilly Gardens, St Peter's Square.
  • The longest consecutive tube journey is 5 stops long. There are multiple examples, on the Central, Circle, District, Hammersmith & City, Jubilee, Metropolitan, Northern, and Picaddilly lines. Start at Leyton, Baker Street, Barons Court, Bermondsey, Croxley, Harrow-on-the-Hill, Borough, Arsenal, or Eastcote. There is a single example of 6 stops long that was timetabled only for a very brief period when London Bridge station was closed on the Southbound Northern Line. The sequence was Bank, Borough, Elephant & Castle, Kennington, Oval, Stockwell.
  • The longest consecutive coach jouney is 6 stops long. The 303 Rothwell - Market Harborough - Melton Mowbray, with consecutive stops at Bus Station, Chapel Building, Church Lane Hail & Ride, Horseshoe House Hail & Ride, Lowesby Lane Hail & Ride, Petrol Station Hail & Ride, The Farm Hail & Ride.
  • Two ferry journeys have 5 consecutive stops that are in alphabetical order. Both in London they are, Bankside Pier, Blackfriars Pier, Embankment Pier, Millbank Pier, Vauxhall St. George Wharf Pier and Battersea Power Station Pier, Cadogan Pier, Chelsea Harbour Pier, PLANTATION WHARF PIER, Wandsworth Riverside Quarter Pier.

Are you sure your calculations are right?

No.

Why have you done this?

  1. I saw this tweet.
  2. I'm currently working on a few projects that needs me to parse the TransXChange public transport timetable format quickly and reliably, so this was time worth spending.
  3. Although this isn't a very useful project, the fact that it is possible is hugely important to the UK. Traveline are a small independent organisation who collect data from hundreds of public transport operators, local authorities, and passenger transport executives right across Great Britain. On a tight budget, with no national government funding, they organise, correct, and republish it in a single place, as open data, for anyone to use. It is open data like that, provided for free and without restriction by Traveline, that lets services like Google Maps and CityMapper give you public transport directions. It also allows useful analysis that helps plan public transport routes to ensure that people can get to jobs, services, and entertainment that improves their lives. When organisations like The Open Data Institute argue that Data is Infrastructure and when The National Infrastructure Commission agrees this is what they're talking about. Knowing the longest chain of consecutive public transport stops that are also in alphabetically order is obviously not very important, but the fact that Great Britain's world-class data infrastructure makes it possible is.

What about trains?

The Traveline National Dataset provides timetables for Ferries, Coaches, Buses, Underground, Metro, and Light Rail in the TransXChange format. National Rail (train) timetables are available in another format (CIF) from a different website -- RSP data. My analysis of that is on the LongestChainOfRailStopsInAlphabeticalOrder repo.

License

MIT license for my code. The data is derived from Traveline Open Data and RSP data.