Skip to content

hyiip/mtr_network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MTR Network Transfer Analysis

The Claim

"Has anyone noticed that any two MTR stations can be reached with at most 2 transfers? Excluding Disneyland."

Results Summary

Excluding Disneyland (97 stations)

Transfers Station Pairs Percentage
0 928 19.9%
1 2,620 56.3%
2 1,108 23.8%

Maximum transfers: 2CLAIM IS TRUE

Including Disneyland (98 stations)

Transfers Station Pairs Percentage
0 929 19.5%
1 2,627 55.3%
2 1,165 24.5%
3 32 0.7%

Maximum transfers: 3CLAIM IS FALSE

32 Stations Requiring 3 Transfers from Disneyland

Disneyland only connects to the network via Sunny Bay (Tung Chung Line), making these stations 3 transfers away:

  • Kwun Tong Line (non-interchange): Choi Hung, Kowloon Bay, Kwun Tong, Lam Tin, Lok Fu, Ngau Tau Kok, Shek Kip Mei, Wong Tai Sin, Yau Tong, Whampoa
  • East Rail Line (non-interchange): Exhibition Centre, Fanling, Fo Tan, Kowloon Tong, Lo Wu, Lok Ma Chau, Mong Kok East, Racecourse, Sha Tin, Sheung Shui, Tai Po Market, Tai Wo, University
  • Tseung Kwan O Line (non-interchange): Hang Hau, LOHAS Park, Po Lam, Tiu Keng Leng, Tseung Kwan O
  • South Island Line (non-interchange): Lei Tung, Ocean Park, South Horizons, Wong Chuk Hang

Algorithm

Graph Model

The MTR network is modeled as a weighted graph:

  • Nodes: (station, line) tuples — each station appears once per line serving it

    • e.g., Admiralty has 4 nodes: (Admiralty, Island), (Admiralty, Tsuen Wan), (Admiralty, South Island), (Admiralty, East Rail)
  • Edges:

Edge Type Weight Description
Same-line 0 Adjacent stations on the same line
Transfer 1 Same station, different lines
Walkway 1 Connected via walkway (Central↔Hong Kong, TST↔East TST)
Branch 0 Branch termini on same line (Lo Wu/Lok Ma Chau, Po Lam/LOHAS Park)

Shortest Path (Dijkstra)

For each station pair (A, B):

  1. Find all nodes for station A: [(A, line1), (A, line2), ...]
  2. Find all nodes for station B: [(B, line1), (B, line2), ...]
  3. Run Dijkstra's algorithm to find minimum weight path
  4. Return minimum weight = minimum number of transfers

Network Statistics

Total stations: 97 (excluding Disneyland)
Total station-line nodes: 121
Total edges: 142
Station pairs analyzed: 4,656

Files

  • mtr_transfer_test.py — Main analysis script
  • mtr_overlay_viz.py — Visualization overlay on MTR map
  • routemap.png — Official MTR system map

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages