Overview
MND models the Sylhet transportation network as a directed graph with 19 nodes (locations) and 289 edges (connections).Nodes
19 locations in Sylhet
Edges
289 connections between locations
Routes
7 bus routes with schedules
Graph Structure
Visual Representation
This diagram shows the major connections. The actual graph contains 289 edges including local transport and walking paths.
Nodes (Locations)
Node Types
MND defines 3 types of nodes based on their role in the network:- Stop (14 nodes)
- Intersection (4 nodes)
- Destination (1 node)
Bus stops where buses pick up/drop off passengers.Examples:
- TILAGOR
- SHIBGONJ
- NAIORPUL
- KUMARPARA
- PATHANTULA
- MODINA_MARKET
- JAIL_RD
- NAYASARAK
- LAKKATURA
- SHEIKHGHAT
- Served by at least 1 bus route
- May have local transport connections
- Typically residential or commercial areas
Node Data Structure
MND-backend/src/data/nodes.json
Complete Node List
All 19 Nodes
All 19 Nodes
| ID | Name | Type | Routes Serving |
|---|---|---|---|
| TILAGOR | Tilagor | stop | bus1, bus2 |
| SHIBGONJ | Shibgonj | stop | bus1, bus2 |
| NAIORPUL | Naiorpul | stop | bus1-6 |
| KUMARPARA | Kumarpara | stop | bus1-4 |
| SHAHI_EIDGAH | Shahi Eidgah | intersection | bus1, bus2, bus6, bus7 |
| AMBARKHANA | Ambarkhana | intersection | bus1-7 |
| SUBIDBAZAR | Subidbazar | intersection | bus1-7 |
| PATHANTULA | Pathantula | stop | bus1-7 |
| MODINA_MARKET | Modina Market | stop | bus1-7 |
| CAMPUS | SUST Campus | destination | bus1-7 |
| JAIL_RD | Jail Road | stop | bus3, bus4, bus6 |
| NAYASARAK | Nayasarak | stop | bus3, bus4 |
| CHOWHATTA | Chowhatta | intersection | bus1-4, bus6, bus7 |
| RIKABI_BAZAR | Rikabi Bazar | stop | bus3, bus4, bus6, bus7 |
| LAKKATURA | Lakkatura | stop | bus5 |
| SHEIKHGHAT | Sheikhghat | stop | bus7 |
| HOSPITAL | Hospital | destination | (local only) |
| ZINDABAZAR | Zindabazar | stop | (local only) |
| POINT | Point | stop | (local only) |
Edges (Connections)
Edge Types
Edges represent connections between nodes using different transport modes:Bus Edges
1,537 edges (50%)
- Cost: 0 BDT (free)
- Time: ~5 min per hop
- Bidirectional (most)
Local Edges
1,200 edges (39%)
- Cost: 20-50 BDT
- Time: Distance-dependent
- Bidirectional
Walking Edges
337 edges (11%)
- Cost: 0 BDT (free)
- Time: ~4-5 km/h
- Bidirectional
Edge Data Structure
MND-backend/src/data/edges.json (289 lines)
Edge Properties Explained
from / to
from / to
Source and destination nodes for this edge.Example:
- Must reference valid node IDs from
nodes.json - Direction matters for one-way edges
mode
mode
Transport mode for this connection:
"bus"- Free scheduled bus service"local"- Paid CNG/rickshaw"walk"- Pedestrian movement
route_ids
route_ids
Bus routes that use this edge (only for
mode: "bus").Example:- Multiple routes can share the same edge
- Used to filter edges when planning specific bus routes
time_min
time_min
Travel time in minutes to traverse this edge.Calculation methods:
- Bus: Average 5 min per stop (heuristic)
- Local/Walk: Google Distance Matrix API duration
- Manual: Estimated based on distance and traffic
distance_meters
distance_meters
Physical distance in meters (optional).Uses:
- Cost calculation for local transport (2 BDT per 100m)
- Display in UI (“2.1 km”)
- Routing preference (shorter distance preferred)
cost
cost
Travel cost in Bangladeshi Taka (BDT).Values:
0- Free (bus, walking)20-50- Typical local transport cost> 100- Long-distance CNG rides
one_way
one_way
Directionality of the edge.Examples:
false- Bidirectional (most edges)true- One-way street (rare in Sylhet)
source
source
Data source for this edge.Values:
"graph"- Manually added to edges.json"distance_matrix"- Fetched from Google Maps API
Adjacency List
Why Adjacency List?
For fast neighbor lookups, the graph is pre-processed into an adjacency list on server startup:- Concept
- Data Structure
- Build Algorithm
Before (Edge List):After (Adjacency List):Performance: 10x faster for Dijkstra’s algorithm!
Graph Algorithms
Dijkstra’s Shortest Path
MND implements Dijkstra’s algorithm to find the shortest path using only local transport:- Algorithm
- Complexity
- Example
Graph Statistics
Network Metrics
Nodes
19 locations
- 14 stops
- 4 intersections
- 1 destination (CAMPUS)
Edges
289 connections
- 1,537 bus (50%)
- 1,200 local (39%)
- 337 walking (11%)
Average Degree
162 edges per nodeHigh connectivity enables flexible routing
Diameter
5 hops maximumLongest shortest path in the graph
Node Connectivity
Top 5 Most Connected Nodes
Top 5 Most Connected Nodes
| Rank | Node | Degree | Bus Routes | Role |
|---|---|---|---|---|
| 1 | SUBIDBAZAR | 180 | 7 routes | Major hub |
| 2 | AMBARKHANA | 175 | 7 routes | Major hub |
| 3 | CAMPUS | 165 | 7 routes | Destination |
| 4 | CHOWHATTA | 158 | 4 routes | Intersection |
| 5 | NAIORPUL | 152 | 6 routes | Hub |
Graph Density
Graph Density
Density Formula:Interpretation:
- Dense graph (density > 1 due to multiple edges between nodes)
- High redundancy (good for alternative routes)
- Multiple transport modes create parallel edges
Connected Components
Connected Components
Number of components: 1 (fully connected)Every node is reachable from every other node using at least one transport mode.Proof: All nodes connect to CAMPUS via bus routes, and buses create a connected subgraph.
Code Examples
Loading Graph Data
Querying the Graph
Visualization
Interactive Network Graph
The web dashboard includes an interactive graph visualization powered by D3.js, showing all 19 nodes and their connections.
- 🔵 Blue nodes: Bus stops
- 🟠 Orange nodes: Intersections
- 🟢 Green node: CAMPUS (destination)
- Hover: View node details and connections
- Click: See all routes serving this location
Next Steps
Routing Algorithm
See how the graph is traversed to find routes
Transport Modes
Learn about bus, local, and walking edges
API: Get Nodes
Fetch all graph nodes via API
Architecture
Understand the full system design