Skip to content
OnlyProjects
B.Sc · Computer ScienceFor educational purposes only

Route Planning on the Delhi Metro Network: A Benchmark Study of Shortest-Path Algorithms (Python)

Dijkstra, Bellman-Ford and A* measured on 243 real stations, not toy graphs

Mapped to your syllabusDelhi University UGCF 2022 · Dissertation / Academic Project / Entrepreneurship · Semester 7 & 8

Overview

1 min read

Route Planning on the Delhi Metro Network is a benchmarks-driven algorithms study written for the University of Delhi UGCF dissertation track (Semesters 7 and 8). Instead of testing shortest-path algorithms on the six-node toy graphs found in textbooks, it builds a weighted graph of the real Delhi Metro — 10 colour-coded lines, roughly 243 unique stations (271 station entries counting interchanges) and about 374 km of route — and measures how the classic trio Dijkstra, Bellman-Ford and A* actually behaves on it.

The study does four things. First, it curates a machine-readable station dataset from Wikipedia's line-wise station lists, cross-checked against the Delhi Metro Rail Corporation's official station list, with every source documented. Second, it constructs the adjacency structure correctly: consecutive stations on a line become edges, interchange stations get transfer edges, and edge weights model travel time rather than hop count. Third, it implements all three algorithms from scratch in Python and validates each one against the NetworkX reference implementation (an industry-standard library used only for cross-checking), so correctness is never assumed. Fourth, it runs a reproducible benchmark protocol — warm-up runs, fixed query sets and repeated trials timed with time.perf_counter — and reports runtimes, expanded-node counts and route quality side by side.

A small command-line tool prints itineraries for real journeys such as Rithala to Botanical Garden, and matplotlib figures (another industry-standard extra) draw the network and the timing results. Everything runs offline on an ordinary laptop.

Relevant for
Delhi
Level
Advanced · 24 weeks · solo
Common at
University of Delhi, University of Mumbai, University of Calcutta
Updated
Nov 2026

Syllabus alignment

Delhi University · UGCF 2022

Dissertation / Academic Project / Entrepreneurship · Semester 7 & 8 · 12 credits

Subjects this project applies
  • Python (UGCF discipline-specific course)
  • C/C++ (Statistics practical stream)
  • Research Methodology (DSE, Sem 6/7)
How it is evaluated

See your department's project guidelines.

Also fits: Mumbai University B.Sc IT 2022-23 (autonomous-college mirror), University of Calcutta CCF 2022 (4-year).

What's in the box

11 parts · 5 free · 3 previewed · 3 unlock for ₹2,000

Problem & synopsis

6 min read

Problem statement

A metro commuter choosing between two routes faces a real trade-off: the route with fewer interchanges may be longer in distance, and the route with fewer stops may need two line changes. Every route planner resolves this with shortest-path algorithms, but the algorithm behind the answer is never shown, and the weights that decide what "shortest" means are hidden. Meanwhile, computer-science students learn Dijkstra, Bellman-Ford and A* only on textbook graphs of a few nodes, where no algorithm shows any measurable advantage and interchange costs never arise.

There is no measured, reproducible evidence for the questions this dissertation asks: by how much does Bellman-Ford actually trail Dijkstra on a real transit network? Does the A* heuristic genuinely pay for its bookkeeping on a sparse, near-planar metro graph? And does interchange-aware weighting change which route counts as "shortest"? This study builds the dataset, the from-scratch implementations and the benchmark protocol needed to answer those questions with numbers instead of folklore, on a network every Delhi student knows first-hand.

Synopsis

Abstract

This dissertation benchmarks three classic shortest-path algorithms — Dijkstra's algorithm, the Bellman-Ford algorithm and A* search — on a weighted graph of the Delhi Metro built entirely from public data. The graph has about 243 unique stations across 10 lines, with interchanges modelled as explicit transfer edges. All three algorithms are implemented from scratch in Python, validated against NetworkX reference results on every ordered station pair, and timed on fixed query sets under a documented protocol. The study reports measured runtimes, memory use and route quality, and analyses when each algorithm is the right choice for transit routing.

Introduction

Route planning looks solved: mobile apps answer "Rithala to Botanical Garden?" in a second. But exactly how they answer it is invisible, and a B.Sc. curriculum teaches Dijkstra, Bellman-Ford and A* on tiny classroom graphs where every algorithm is instant and every route is obvious. The learning gap is real: students never see how graph size, edge density, weight design and interchange handling change behaviour. This study closes that gap by treating the Delhi Metro as a serious, verifiable dataset — large enough to produce measurable differences between algorithms, small enough to check by hand.

Existing systems and the gap

  • Official and commercial planners (the DMRC app and third-party transit apps) are closed products: users cannot inspect the graph, the weights or the algorithm, and none publish benchmarks.
  • Textbook treatments run algorithms on graphs of five to ten nodes, so running-time differences are unmeasurable and interchange modelling never appears.
  • Typical student projects either hard-code a small sample of stations or simply call a library, which is fatal in a viva when the examiner asks what a binary heap actually does.
  • The gap: no measured, reproducible, from-scratch comparison of these three algorithms on a real Indian metro network with interchange-aware weights.

Proposed study

Build the station graph in three verified weight models — pure hop count, distance-based travel time, and travel time plus a fixed interchange penalty. Implement Dijkstra with a binary heap, Bellman-Ford with early exit, and A* with a haversine-based heuristic, all from scratch. Prove correctness against NetworkX on all ordered station pairs under every weight model, then time all algorithms on three fixed query sets: same-line journeys, one-interchange journeys and terminal-to-terminal worst cases. Analyse the results and present them with fully reproducible scripts.

Feasibility

  • Technical: the entire study runs on a student laptop; the largest computation (all-pairs Dijkstra over 243 nodes) finishes in seconds. All data is public and downloadable.
  • Economic: zero cost — no paid APIs, no cloud credits, only free open-source tools.
  • Operational: the 24-week UGCF dissertation window (6 credits per semester) comfortably fits data collection, implementation, experiments and writing, and the scheme's monthly progress reports keep the work visible to the supervisor throughout.

Objectives

  1. 01Curate a verified, machine-readable dataset of all Delhi Metro stations, lines and interchanges from Wikipedia's line-wise station lists, cross-checked against the official DMRC station list, with documented provenance for every value.
  2. 02Construct the network as a weighted adjacency structure in three models: pure hop count, distance-based travel time, and travel time with a configurable interchange penalty.
  3. 03Implement Dijkstra with a binary heap, Bellman-Ford with early exit, and A* with an admissible haversine heuristic, all from scratch without library shortest-path calls.
  4. 04Prove implementation correctness by comparing every from-scratch route against NetworkX reference implementations across all ordered station pairs and all weight models.
  5. 05Measure runtimes, expanded-node counts and memory on fixed query sets under a documented, repeatable benchmark protocol with warm-up runs and repeated trials.
  6. 06Quantify how the interchange penalty changes the recommended route for realistic journeys such as Rithala to Botanical Garden or Dwarka Sector 21 to Vaishali.
  7. 07Deliver a CLI itinerary demo, reproducible scripts and publication-quality figures suitable for the dissertation and the defence presentation.

Scope

In scope

  • The static Delhi Metro network: all 10 colour-coded lines and roughly 243 unique stations as publicly listed (271 station entries counting interchanges).
  • Single-source, single-destination shortest paths under three weight models; interchanges modelled as transfer edges with a configurable penalty.
  • From-scratch implementations of Dijkstra (binary heap), Bellman-Ford (early exit) and A* (haversine heuristic); NetworkX used strictly as a correctness reference, never inside the measured code paths.
  • Benchmarking on three fixed query sets (same-line, one-interchange, terminal-to-terminal) with warm-up runs and 30 timed repetitions per query.
  • A CLI route demo and matplotlib figures of the network and the results.

Out of scope (and why)

  • Timetable-aware routing: real train frequencies, dwell times and first/last trains are scheduling data, not graph structure, and would drown the algorithmic question.
  • Live disruptions, crowd levels and holiday timetables; the study models a typical network, not a real-time feed.
  • Fares, ticketing and first/last-mile integration.
  • Other cities in the main study — though the pipeline is written so that a Mumbai or Kolkata station file can replace the input with minimal edits.

Methodology

The study follows an experimental benchmarking research design mapped onto the two-semester UGCF dissertation: Semester 7 builds the artefact (data, graph, implementations) and Semester 8 runs the experiments and writes the dissertation. The design has one treatment (the algorithm), three controlled conditions (the weight models), one fixed workload (three query sets) and repeated measurement — the standard structure for a fair runtime comparison. Monthly progress reports to the supervisor are a scheme requirement and are used as checkpoints at the end of every phase.

PhaseWeeksActivitiesDeliverable
Literature study1–3Shortest-path theory, transit-routing literature, prior benchmark studiesAnnotated reading list, finalised research questions
Data collection4–6Curate stations.csv from Wikipedia line pages; cross-check counts against the DMRC list; record distances between consecutive stationsVerified stations.csv with provenance notes
Graph construction7–9build_graph.py: per-line node chains, transfer edges, three weight models; structural sanity checksadjacency files plus a graph validation report
Implementation10–13From-scratch Dijkstra, Bellman-Ford, A*; pytest unit tests; NetworkX cross-check on all station pairsTested algorithms module
Benchmarking14–17Warm-up runs, 30 timed repetitions per query, perf_counter timing, memory notes, fixed random seed for query generationresults.csv and a benchmark report
Analysis18–20Tables and figures; interchange-penalty route analysis; threats to validityResults chapter draft
Writing and defence21–24Full dissertation draft, supervisor review, pre-submission seminar, viva preparationFinal dissertation

Testing approach: pytest unit tests cover boundaries (source equals destination, adjacent stations, terminal-to-terminal) and hand-verified known routes; a full-network cross-check asserts that every from-scratch route matches NetworkX's Dijkstra under the same weights. Benchmark hygiene: one machine, no background load, warm-up excluded from statistics, median and 95th percentile reported alongside the mean.

Study design

2 diagrams · 5 tools · 2 min read

  • Python
  • NetworkX
  • pandas
  • matplotlib
  • pytest

The study is a pipeline of small, independently testable scripts rather than an application. Raw sources flow through a curation step into a versioned stations.csv; a builder turns it into adjacency lists under each weight model; the algorithms module consumes the graph; the harness times it; notebooks analyse the output. Each stage writes a file, so any stage can be re-run without redoing the earlier ones, and every artefact in the dissertation regenerates from the raw data with one command chain.

flowchart TD
  W["Wikipedia line-wise station lists"] --> C["stations.csv curation script"]
  D["DMRC official station list"] --> C
  C --> V["Verification: per-line counts and interchange flags"]
  V --> G["build_graph.py: adjacency lists with weights"]
  G --> M1["Weight model 1: hop count"]
  G --> M2["Weight model 2: distance-based travel time"]
  G --> M3["Weight model 3: travel time plus interchange penalty"]
  M1 --> Q["Query sets: same-line, one-change, terminal-to-terminal"]
  M2 --> Q
  M3 --> Q
  Q --> A["From-scratch Dijkstra, Bellman-Ford, A-star"]
  N["NetworkX reference implementations"] --> A
  A --> T["pytest correctness suite"]
  A --> B["benchmark.py: warm-up, 30 repeats, perf_counter"]
  B --> R["results.csv"]
  R --> P["Analysis notebooks and matplotlib figures"]
  P --> F["Dissertation chapters and defence deck"]
  A --> U["route.py CLI itinerary demo"]

The graph keeps one node per station per line, joined by transfer edges at interchange stations, which is what makes the interchange penalty expressible as an ordinary edge weight:

flowchart LR
  subgraph RedLine["Red Line"]
    NSP["Netaji Subhash Place (R)"] --- KG_R["Kashmere Gate (R)"]
  end
  subgraph YellowLine["Yellow Line"]
    KG_Y["Kashmere Gate (Y)"] --- NDLS["New Delhi"]
  end
  KG_R -. "transfer edge, weight 5 min" .- KG_Y

Design decisions worth defending in the viva: adjacency lists over matrices (the metro graph is very sparse, about two same-line edges per node); a binary heap for Dijkstra to get the standard O((V+E) log V) bound; an early exit for Bellman-Ford when a pass changes no distance; and an admissible, consistent haversine heuristic for A* so that no closed node ever needs reopening.

Work packages

6 packages

  1. Package 01

    Data Curation and Provenance

    Builds stations.csv from Wikipedia's line-wise station lists (station name, line, order on line, interchange flag, distance to next station) and verifies totals against the DMRC official list. Every value carries a source note, and recent station renames are recorded so older journey examples stay traceable.

  2. Package 02

    Graph Construction

    Converts the station table into per-line node chains plus transfer edges at interchanges, and emits three weight models: pure hop count, distance-based travel time at a constant commercial speed, and travel time with a fixed five-minute interchange penalty.

  3. Package 03

    From-Scratch Algorithms

    Implements Dijkstra with a binary heap, Bellman-Ford with early exit, and A* with an admissible haversine heuristic, all on plain Python dictionaries and lists. No library shortest-path function appears inside the implementations being measured.

  4. Package 04

    Correctness Cross-Check

    A pytest suite plus a full-network script that compares every from-scratch route and distance against NetworkX reference implementations under each weight model, across all ordered station pairs, failing loudly on any mismatch. This is the study's core evidence of correctness.

  5. Package 05

    Benchmark Harness

    Runs each algorithm over the three fixed query sets with warm-up, 30 repetitions, perf_counter timing and memory notes, and writes results.csv containing algorithm, weight model, query, distance, expanded-node count and timing statistics (mean, median, p95).

  6. Package 06

    Visualisation and CLI

    route.py prints step-by-step itineraries (stations, line changes, total weight) for real journeys; matplotlib draws the network sketch, the timing comparisons and the route-quality figures used in the dissertation and the defence slides.

Slides

12 slides · titles free · bullets, notes and the .pptx unlock

  1. Slide 1

    Route Planning on the Delhi Metro Network

  2. Slide 2

    Why Benchmark on a Real Network?

  3. Slide 3

    The Delhi Metro as a Graph Problem

  4. Slide 4

    Data Collection and Verification

  5. Slide 5

    Graph Model and Interchange-Aware Weights

  6. Slide 6

    The Three Algorithms

  7. Slide 7

    Proving Correctness

  8. Slide 8

    Benchmark Protocol

  9. Slide 9

    Results: Measured Runtimes

  10. Slide 10

    Results: What the Interchange Penalty Changes

  11. Slide 11

    Limitations and Threats to Validity

  12. Slide 12

    Conclusion and Future Scope

Bullets, speaker notes and the .pptx · ₹2,000

The titles above are the real outline. The rest is what you present from.

Unlock for ₹2,000

Viva questions & answers

3 of 14 answered free · 11 unlock

Read each answer, close it, and say it in your own words. Your viva will ask. Now you'll know.

  1. 01Concept

    Why does Dijkstra's algorithm fail with negative edge weights, and could negative weights ever arise in a metro graph?

    Dijkstra assumes that once a node is settled, no shorter path to it can appear later, which negative edges break because extending a path can lower its cost. A metro graph has only non-negative travel times and transfer penalties, so Dijkstra is safe here — but the assumption must be stated and defended in the viva.

  2. 02Concept

    What is the time complexity of your Dijkstra implementation, and why did the binary heap matter?

    With a binary heap the complexity is O((V+E) log V): each edge triggers a possible decrease-key and each node extraction costs log V. On about 243 nodes and roughly 300 edges a naive O(V-squared) scan would still be fast, but the heap matters because the argument scales to any large sparse transit graph.

  3. 03Concept

    What makes a heuristic admissible and consistent, and why is your haversine heuristic admissible?

    Admissible means it never overestimates the true remaining cost; consistent means each edge satisfies the triangle inequality with the heuristic. Haversine straight-line distance never exceeds the real along-track travel distance, and the travel-time weight is derived from distance at a constant speed, so it stays admissible under models 2 and 3.

+11 more questions, with answers

Try the free ones out loud first. Your examiner will not accept “it's in the PPT”.

How to reproduce the study

7 steps · unlocks with the project

Unlocks with the project · ₹2,000

7 steps

Every step to carry the project out with the tools in the tech stack, in order.

Unlock for ₹2,000

READMEFIRST

226 words · unlocks with the project

What to change before it goes anywhere near a submission. Skipping it is how the demo fails live.

Unlocks with the project · ₹2,000

226 words · ~1 min read

The checklist of things to rename, re-seed and re-think so the project reads as yours.

Unlock for ₹2,000

Instructions

237 words · unlocks with the project

How to study it, adapt it and walk your examiner through it, step by step.

Unlocks with the project · ₹2,000

237 words · ~1 min read

Report structure, formatting rules and the submission checklist your department will grade.

Unlock for ₹2,000

References

7 sources

  1. E. W. Dijkstra, "A Note on Two Problems in Connexion with the Graphs", Numerische Mathematik 1, pp. 269–271 (1959)
  2. P. E. Hart, N. J. Nilsson and B. Raphael, "A Formal Basis for the Heuristic Determination of Minimum Cost Paths", IEEE Transactions on Systems Science and Cybernetics 4(2), pp. 100–107 (1968)
  3. Wikipedia — List of Delhi Metro stations (line-wise station lists, interchange counts, network length)
  4. Delhi Metro Rail Corporation — official station list (DMRC smart card portal)
  5. NetworkX documentation — reference shortest-path implementations used for correctness cross-checking
  6. pytest documentation — testing framework used for the correctness suite
  7. T. H. Cormen, C. E. Leiserson, R. L. Rivest and C. Stein, Introduction to Algorithms, 4th ed., MIT Press (2022)

Cite this bundle

OnlyProjects. (2026). Route Planning on the Delhi Metro Network: A Benchmark Study of Shortest-Path Algorithms (Python): B.Sc Computer Science project bundle [Educational resource]. https://onlyprojects.online/projects/bsc-cs-delhi-metro-shortest-path-benchmark-study

Future scope

1 min read

  • Time-dependent weights: replace constant weights with headway-based waiting times at interchanges, turning the study into schedule-aware routing.
  • Faster algorithms: bidirectional Dijkstra and Contraction Hierarchies benchmarked the same way make an excellent follow-up chapter.
  • Other networks: the pipeline accepts any station table — Mumbai, Kolkata or the Namo Bharat RRTS drop in with a new CSV.
  • Open GTFS: if a metro GTFS feed appears on an open data portal, ingest it directly and retire the manual curation step.
  • Uncertainty: report route-time confidence intervals instead of single numbers, using the variance already captured across benchmark repetitions.

Keep browsing

Same degree, same syllabus slot, different idea. Pick the one your guide will actually approve.