Beijing Subway and Light Rail Network

Finds different types of routes between stops on the Beijing subway

To use: select starting and ending stations either by using the dropdown boxes or by clicking a station on the map to select it. You can clear the stations by clicking "Clear" or by double clicking on the map. Once the start and end stations are chosen find the route. You can find the route which goes through the fewest number of stations or the one which requires the fewest changes.

"Most stations" is added for fun. When I used to travel on the subway regularly, to pass the time I would look at the map and try to find the longest route between two stops, not changing at any station twice. The "Most stations" button will compute this path. (on the map as of early 2010, the longest trip is 79 stations and 12 transfers)

By checking the "Trace algorithms" box you can see trace output from the algorithms used to find the paths. Be warned, in some cases this could be long, and require a longer time to display. It has been disabled for "Longest Path" because it generates too much output.

From: To:

Trace algorithms (slow)

Beijing subway map
Starting station Transfer station Destination station
This page was written as a sample demo for a class on OOP. The design is OK, but I had not used php in many years, so I make no claims as to the overall quality. If the point was the application it probably would be better to make the whole thing in javascript.

View the source code

© Russell Young 2010