Skip to content

AYUSH-148/Metro-Route

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš‡ Delhi Metro Route Finder

A full-stack route optimization application built with a focus on graph algorithms, specifically Dijkstraโ€™s shortest path algorithm, to compute optimal metro routes in Delhi. Users can select source and destination stations and receive:

  • ๐Ÿ›ค๏ธ Step-by-step route
  • ๐Ÿ” Interchanges
  • โฑ๏ธ Time / ๐Ÿ“ Distance
  • ๐Ÿ’ฐ Fare calculation
  • ๐Ÿ—บ๏ธ Interactive Metro Map
  • ๐Ÿ“„ Downloadable PDF route

๐Ÿ’ก Core Objective

This project was built to demonstrate the real-world application of graph data structures and Dijkstraโ€™s algorithm in metro navigation and routing systems.


๐Ÿ“ Data Structures Used

  • Graph (Adjacency Map): Each station is a node; connections are weighted edges (distance in km or time in seconds).
  • Min-Heap: Custom priority queue used for Dijkstra's efficient shortest path computation.
  • Dijkstraโ€™s Algorithm: Finds the optimal path from source to destination using a min-cost traversal.
  • HashMaps: For storing vertex data and visited tracking.
  • Custom Pair structures: For maintaining cost, path-so-far, and time during traversal.

๐Ÿš€ Features

Feature Description
๐Ÿ” Station Autocomplete Easy-to-search source & destination fields
๐Ÿง  Dijkstra Optimization Fast, accurate path calculation
๐Ÿงญ Distance / Time Mode Choose based on preference
๐Ÿ”„ Interchange Detection Counts and displays interchange points
๐Ÿงพ Fare Estimator Based on distance bands
๐Ÿ—บ๏ธ Interactive SVG Metro Map Route path visualized, with a legend
๐ŸŽจ Responsive UI React + Tailwind CSS (warm theme)

โš™๏ธ Tech Stack

Layer Tech Used
Frontend React 18 + TypeScript + Tailwind
State/API React Query + Axios
Backend Node.js + Express + TypeScript
Graph Logic Custom JavaScript Dijkstra Engine

๐Ÿงช Algorithms in Detail

๐Ÿ”ท Dijkstraโ€™s Algorithm

Implemented as:

  • Priority Queue with MinHeap<T> (custom-built)
  • Relaxation of neighbors based on edge weights
  • Supports both:
    • Distance-based mode (edge weight = distance)
    • Time-based mode (edge weight = 120 + 40 * distance seconds)

๐Ÿ“Ž Interchange Detection

  • Based on station line suffixes (~B, ~Y, etc.)
  • Compares line transitions in the route
  • Labels interchanges like: Janak Puri~B ==> Dwarka~Y

๐Ÿ Getting Started

๐Ÿ”ง Install & Run Locally

# Clone the repo
git clone https://github.com/yourusername/metro-route-finder.git
cd metro-route-finder

# Install backend
cd server
npm install
npm run dev

# In another terminal, start frontend
cd ../client
npm install
npm run dev

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published