Network Theory-Based Optimization of Urban Bus Systems: A Multi-Modal Competition Analysis of Kigali City, Rwanda
# Bus Network Optimization System
A comprehensive system for analyzing and optimizing bus networks with multi-modal competition analysis.
## Project Structure
```
optimization_code/
├── main.py # Main execution file
├── scripts/ # All analysis modules
│ ├── __init__.py
│ ├── data_loader.py # Load and process datasets
│ ├── network_builder.py # Build network graph
│ ├── stop_analyzer.py # Analyze stop performance
│ ├── competition_analyzer.py # Analyze mode competition
│ ├── optimizer.py # Generate optimization recommendations
│ ├── visualizer.py # Create visualizations
│ └── report_generator.py # Generate reports
├── data/ # All input datasets
│ ├── bus_stops/ # Bus stops shapefile
│ ├── roads/ # Road network shapefile
│ ├── bus_od_matrix.csv # Bus OD matrix
│ ├── moto_cab_mar_2022_OD_table.csv
│ └── moto_cab_april_2022_OD_table.csv
└── results/ # All output files
├── *.png # Visualization files
└── *.csv # Analysis results
```
## Module Descriptions
### 1. data_loader.py
**Purpose**: Load and preprocess all transportation datasets.
**What it does**:
- Loads bus stops spatial data (shapefile)
- Loads road network spatial data (shapefile)
- Loads bus Origin-Destination (OD) matrix
- Loads motorcycle and car taxi OD tables
- Maps coordinate-based trips to nearest bus stops
- Creates combined demand matrices with conversion factors
- Validates and enhances data
**Expected Results**: Processed datasets ready for analysis
### 2. network_builder.py
**Purpose**: Create demand-weighted network graph from bus stops and infrastructure.
**What it does**:
- Creates NetworkX graph with bus stops as nodes
- Connects stops based on spatial proximity
- Weights edges by travel time, demand, and competition factors
- Adds comprehensive demand attributes to nodes
**Expected Results**: Network graph representing the …