Ghana Road Transport Network
2026-03-01Algorithms & Data Structures

Ghana Road Transport Network

Java 17Spring BootNext.jsTypeScriptTailwind CSS+6

01. Overview

A full-stack solution to the Ghana Road Transport Network Programming Challenge 2026 at Ashesi University. Models Ghana's intercity road network as a graph, implements Dijkstra, Yen's K-Shortest Paths, and cost analysis — exposed via a Java CLI, a Spring Boot REST API, and an interactive Next.js web frontend.

The Objective

To model Ghana's intercity road network as a graph and provide tools to explore routes, estimate costs, and manage road connectivity through a CLI, REST API, and interactive web interface.

The Outcome

A production-grade multi-layer system handling all 10 challenge questions, with an interactive force-directed graph visualization, route exploration, real-time edge editing, and cost recommendation engine.

02. Stack Architecture

Java 17
Spring Boot
Next.js
TypeScript
Tailwind CSS
React
Maven
REST API
Graph Algorithms
Dijkstra
Yen's K-Shortest Paths

03. Key Features

Dijkstra shortest distance and fastest time path (Q4, Q5)

Yen's Top-3 K-Shortest loopless paths (Q6)

Fuel and time cost recommendation engine (Q7, Q8)

Interactive CLI session with multi-query support (Q9)

Time complexity analysis scaling from 100 to 5,000 nodes (Q10)

Force-directed interactive network graph with route highlights

Real-time road editing (add, update, remove) from the browser

04. Engineering Pipeline

01

Parsed 557-entry road dataset, deduplicating to clean bidirectional edge set

02

Built CLI answering all 10 challenge questions (Q1–Q10) via terminal

03

Wrapped the same Java logic in a Spring Boot REST API (Q1–Q10 endpoints)

04

Built an interactive Next.js frontend with force-directed graph visualization

05

Added interactive edge editing (add, update, delete) through the frontend

05. Challenges & Execution

The Constraint

6 duplicate bidirectional edges with conflicting weights in the raw dataset

The Execution

Used a LinkedHashMap with case-insensitive town keys; addEdge silently overwrites duplicates to ensure a clean, deterministic graph.

The Constraint

Efficiently finding top-K loopless shortest paths without modifying the main graph

The Execution

Implemented Yen's K-Shortest Paths algorithm with a temporary EdgeRemover to spur-path-explore without permanently mutating the graph.

The Constraint

Bridging a Java backend and a Next.js frontend with CORS and shared state

The Execution

Configured Spring Boot CORS to allow localhost:3000 and designed a singleton graph bean shared across all API controllers.

Return to the Archive.

Emmanuel Adoum | Portfolio