Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ihfaz297/MND/llms.txt

Use this file to discover all available pages before exploring further.

Overview

MND supports three primary transport modes that can be combined intelligently to create optimal multi-modal routes:

Bus

Free scheduled university buses

Local

Paid CNG/rickshaw transport

Walking

Free pedestrian movement

🚌 Bus Transport

Overview

SUST operates 7 free bus routes serving 19 locations across Sylhet city.
Cost
Free
University buses are 100% free for students and staff
Schedule
Fixed
Buses run on fixed schedules with specific departure times:
  • Morning: 07:30 - 09:35
  • Afternoon: 13:10 - 17:10
  • Evening: 18:30 (limited routes)
Capacity
40-50 passengers
Standard bus capacity, can get crowded during peak hours
Speed
~5 min per stop
Average travel time between consecutive stops
7 Bus Routes:
  • Bus 1 & 2: TILAGOR ↔ CAMPUS (via AMBARKHANA)
  • Bus 3 & 4: NAIORPUL ↔ CAMPUS (via JAIL_RD)
  • Bus 5: LAKKATURA ↔ CAMPUS
  • Bus 6: NAIORPUL/SHAHI_EIDGAH ↔ CAMPUS
  • Bus 7: SHEIKHGHAT/SHAHI_EIDGAH ↔ CAMPUS
Key Hub Stops:
  • AMBARKHANA (5 routes)
  • SUBIDBAZAR (6 routes)
  • CAMPUS (all routes)
Bus 1 Schedule (Sample Day):
Trip IDDirectionDepartureRoute
bus1_0825to_campus08:25TILAGOR β†’ CAMPUS
bus1_0930to_campus09:30TILAGOR β†’ CAMPUS
bus1_1310from_campus13:10CAMPUS β†’ TILAGOR
bus1_1710from_campus17:10CAMPUS β†’ TILAGOR

Data Model

export interface Route {
    route_id: string;      // "bus1", "bus2", etc.
    name: string;          // "Bus 1", "Bus 2", etc.
    trips: Trip[];         // List of scheduled trips
}

export interface Trip {
    trip_id: string;       // "bus1_0825"
    direction: 'to_campus' | 'from_campus';
    stops: string[];       // Node IDs in order
    departure_time: string; // "08:25" (HH:MM)
}
Source: MND-backend/src/data/routes.json

Travel Time Calculation

Bus travel time is estimated using a 5-minute-per-hop heuristic:
// From planner.ts:98-111
const hopsBefore = fromIndex;
const tripStart = parseTime(trip.departure_time);
const tripStartMin = timeToMinutes(tripStart);

// Estimate time to reach 'from' stop
const timeToFrom = hopsBefore * 5; // 5 min average per hop
const departureMin = tripStartMin + timeToFrom;

// Calculate travel time
const hops = toIndex - fromIndex;
const travelTime = hops * 5; // 5 min per stop
const arrivalTime = addMinutes(trip.departure_time, timeToFrom + travelTime);
The 5-minute estimate accounts for driving time + stop duration. Actual times may vary based on traffic.

Color Coding: Blue

In the mobile app, bus segments are displayed in blue:
// Color mapping in Flutter app
Color getModeColor(String mode) {
  switch (mode) {
    case 'bus':
      return Colors.blue;      // 🚌 Bus routes
    case 'local':
      return Colors.orange;    // πŸš• Local transport
    case 'walk':
      return Colors.green;     // 🚢 Walking
    default:
      return Colors.grey;
  }
}

πŸš• Local Transport (CNG/Rickshaw)

Overview

Local transport refers to paid, on-demand options like CNG auto-rickshaws and cycle rickshaws.
Characteristics:
  • πŸ’° Cost: 20-50 BDT (typically ~2 BDT per 100m)
  • ⚑ Speed: Moderate (faster than rickshaw, slower than bus)
  • πŸ›£οΈ Range: Short to medium distances (1-5 km)
  • 🚦 Availability: High (found everywhere in Sylhet)
When to Use:
  • Final mile connectivity (after bus drop-off)
  • Destinations not served by buses
  • Urgent travel (no time to wait for bus)
Characteristics:
  • πŸ’° Cost: 10-30 BDT (cheaper than CNG)
  • 🐌 Speed: Slow (human-powered)
  • πŸ›£οΈ Range: Very short distances (< 2 km)
  • 🚦 Availability: High in residential areas
When to Use:
  • Very short distances
  • Budget-conscious travel
  • Areas with narrow roads (CNG can’t access)

Data Model

export interface Edge {
    from: string;
    to: string;
    mode: 'bus' | 'local' | 'walk';
    route_ids?: string[];        // Only for bus edges
    time_min: number;            // Travel time in minutes
    distance_meters?: number;    // Physical distance
    cost: number;                // 0 for bus/walk, > 0 for local
    one_way: boolean;            // Directionality
    source?: 'graph' | 'distance_matrix';
}

Cost Calculation

Local transport costs are estimated using a distance-based formula:
// From planner.ts:179
const costPerHundredMeters = 2; // BDT
const totalCost = Math.round(distanceMeters / 100) * 2;

// Example: 2000 meters = 20 Γ— 2 = 40 BDT
This is an approximate cost model. Actual fares may vary based on:
  • Negotiation with driver
  • Time of day (night surcharge)
  • Traffic conditions
  • Shared vs. private ride

Distance Matrix Integration

When local transport segments are not in the graph, MND uses Google Maps Distance Matrix API:
// From distanceMatrixClient.ts
export async function getLocalSegment(
    from: string,
    to: string,
    mode: 'driving' | 'walking'
): Promise<DistanceMatrixResult> {
    // Check cache first
    const cacheKey = `${from}-${to}-${mode}`;
    const cached = this.cache.get(cacheKey);
    
    if (cached && !this.isCacheExpired(cached)) {
        return { ok: true, ...cached, fromCache: true };
    }
    
    // Call Google Maps API
    const response = await fetch(
        `https://maps.googleapis.com/maps/api/distancematrix/json?` +
        `origins=${from}&destinations=${to}&mode=${mode}&key=${API_KEY}`
    );
    
    const data = await response.json();
    const element = data.rows[0]?.elements[0];
    
    if (element?.status === 'OK') {
        const result = {
            distanceMeters: element.distance.value,
            durationSeconds: element.duration.value,
            timestamp: Date.now()
        };
        
        // Cache for 7 days
        this.cache.set(cacheKey, result);
        
        return { ok: true, ...result, fromCache: false };
    }
    
    return { ok: false, errorMessage: 'API call failed' };
}

Color Coding: Orange

Local transport segments are displayed in orange:
// Flutter route visualization
if (leg.mode == 'local') {
  return Container(
    decoration: BoxDecoration(
      border: Border.all(color: Colors.orange, width: 3),
      borderRadius: BorderRadius.circular(8),
    ),
    child: ListTile(
      leading: Icon(Icons.local_taxi, color: Colors.orange),
      title: Text('CNG/Rickshaw'),
      subtitle: Text('${leg.durationMin} min β€’ ${leg.cost} BDT'),
    ),
  );
}

🚢 Walking

Overview

Walking is used for very short distances between nearby locations.
Cost
Free
Walking costs nothing
Speed
~4-5 km/h
Average walking speed (Google Maps standard)
Range
< 1 km
Only suggested for very short distances
Comfort
Weather-dependent
Not ideal during rain or extreme heat
  • Between nearby stops: SUBIDBAZAR ↔ RIKABI_BAZAR (300m)
  • Campus navigation: Building to building
  • Last 100 meters: From bus stop to exact destination

Data Model

{
  "from": "SUBIDBAZAR",
  "to": "RIKABI_BAZAR",
  "mode": "walk",
  "time_min": 4,
  "distance_meters": 300,
  "cost": 0,
  "one_way": false
}

Color Coding: Green

Walking segments are displayed in green:
if (leg.mode == 'walk') {
  return Container(
    decoration: BoxDecoration(
      border: Border.all(color: Colors.green, width: 3),
      borderRadius: BorderRadius.circular(8),
    ),
    child: ListTile(
      leading: Icon(Icons.directions_walk, color: Colors.green),
      title: Text('Walking'),
      subtitle: Text('${leg.durationMin} min β€’ ${leg.distanceMeters}m'),
    ),
  );
}

Multi-Modal Routes

MND’s power lies in combining transport modes intelligently:

Example 1: Bus + Local

Route Breakdown:
1

Board Bus 1 at TILAGOR

Departure: 08:25 | Cost: 0 BDT
2

Ride bus for 30 minutes

Pass through: SHIBGONJ, NAIORPUL, KUMARPARA, SHAHI_EIDGAH
3

Drop off at AMBARKHANA

Arrival: 08:55
4

Take CNG to final destination

AMBARKHANA β†’ LAKKATURA (10 min, 30 BDT)
Total: 40 min | 30 BDT

Example 2: Bus + Walk + Bus (Transfer)

Route Breakdown:
1

Board Bus 3 at NAIORPUL

08:30 departure
2

Ride to SUBIDBAZAR (20 min)

Free bus segment
3

Walk to RIKABI_BAZAR (5 min)

Short 400m walk between stops
4

Board Bus 6 at RIKABI_BAZAR

09:00 departure (5 min wait)
5

Arrive at CAMPUS (15 min)

Total journey: 40 min
Total: 40 min | 0 BDT

Example 3: Local Only (Fallback)

When Used:
  • ❌ No bus routes serve both locations
  • ⏰ Late night (no buses running)
  • 🚨 Emergency (can’t wait for bus)

Mode Selection Logic

How does MND decide which transport mode to use?

Decision Tree

Optimization Criteria

Minimize total journey time including:
  • ⏰ Wait time for bus
  • 🚌 Bus travel time
  • πŸš• Local transport time
  • 🚢 Walking time
Formula:
totalTimeMin = waitTime + busTravelTime + localTravelTime + walkTime

Transport Mode Statistics

Network Coverage

Bus Edges

1,537 connections50% of total graph edges

Local Edges

1,200 connections39% of total graph edges

Walking Edges

337 connections11% of total graph edges

Average Journey Composition

07:00 - 10:00 (to campus)
Mode% of RoutesAvg TimeAvg Cost
Bus Only45%40 min0 BDT
Bus + Local35%35 min25 BDT
Local Only20%25 min60 BDT

Visual Reference

Transport Mode Icons

Bus

🚌 Blue routesFree scheduled service

CNG

πŸš• Orange routesPaid on-demand

Walking

🚢 Green routesFree pedestrian

Route Card Design (Flutter)

// From mnd_flutter/lib/widgets/route_card.dart
Widget buildRouteLeg(RouteLeg leg) {
  final modeConfig = {
    'bus': {
      'icon': Icons.directions_bus,
      'color': Colors.blue,
      'label': 'Bus ${leg.routeId?.toUpperCase()}'
    },
    'local': {
      'icon': Icons.local_taxi,
      'color': Colors.orange,
      'label': 'CNG/Rickshaw'
    },
    'walk': {
      'icon': Icons.directions_walk,
      'color': Colors.green,
      'label': 'Walking'
    },
  }[leg.mode]!;
  
  return Container(
    padding: EdgeInsets.all(12),
    decoration: BoxDecoration(
      border: Border.all(color: modeConfig['color'], width: 3),
      borderRadius: BorderRadius.circular(8),
    ),
    child: Row(
      children: [
        Icon(modeConfig['icon'], color: modeConfig['color'], size: 32),
        SizedBox(width: 12),
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(modeConfig['label'], style: TextStyle(fontWeight: FontWeight.bold)),
            Text('${leg.from} β†’ ${leg.to}'),
            Text('${leg.durationMin} min β€’ ${leg.cost} BDT'),
          ],
        ),
      ],
    ),
  );
}

API Response Example

Here’s how transport modes appear in API responses:
{
  "from": "NAIORPUL",
  "to": "LAKKATURA",
  "requestTime": "08:30",
  "options": [
    {
      "label": "Fastest Route",
      "category": "fastest",
      "totalTimeMin": 45,
      "totalCost": 30,
      "legs": [
        {
          "mode": "bus",
          "route_id": "bus3",
          "from": "NAIORPUL",
          "to": "AMBARKHANA",
          "departure": "08:30",
          "arrival": "09:00",
          "durationMin": 30,
          "cost": 0,
          "source": "graph"
        },
        {
          "mode": "local",
          "submode": "driving",
          "from": "AMBARKHANA",
          "to": "LAKKATURA",
          "durationMin": 15,
          "distanceMeters": 2500,
          "cost": 30,
          "source": "distance_matrix"
        }
      ]
    }
  ]
}

Next Steps

Graph Model

See how transport modes connect 19 locations

Routing Algorithm

Learn how modes are combined optimally

API: Plan Route

Try the routing API with different modes

Architecture

Understand the full system design

Build docs developers (and LLMs) love