An air route optimizer written in Java that reads ANAC CSV datasets, builds a graph of airports and flights, identifies the main structural hubs, and finds the best time-aware route between two airports using Dijkstra.
- What This Project Does
- Why This Project Is Useful
- Architecture Overview
- Routing Rules
- Getting Started
- Usage Examples
- Project Structure
- Where To Get Help
- Maintainers
The project implements a command-line application for planning routes in the Brazilian air network.
- Main.java coordinates user interaction, loads the data, and runs route queries.
- DataManager.java reads the files in T2_Dados/ and builds the graph.
- Graph.java stores airports and flights, calculates the top 5 hubs, and runs the temporal Dijkstra search.
- Route.java displays the resulting route with segments, airlines, aircraft, and waiting times.
- TimeUtils.java converts dates and times to absolute minutes and formats the output.
Main characteristics:
- Reads airports, airlines, aircraft, and flights from CSV files.
- Automatically computes structural hubs from the graph's total degree.
- Performs route search with time-based connection constraints.
- Optionally simulates the closure of a hub to assess connectivity impact.
- Prints a detailed itinerary in the terminal, segment by segment.
This repository is useful if you want to:
- Study a complete Java graph implementation applied to air logistics.
- Understand how real flight data can be organized for time-aware queries.
- See Dijkstra adapted for schedules, minimum connection times, and multiple layovers.
- Experiment with a network-analysis flow that includes hubs and airport-unavailability simulation.
The system is divided into four main blocks:
- Data ingestion:
- DataManager.java reads the CSV files and populates the graph.
- The expected input files live in T2_Dados/.
- Domain model:
- Airport.java represents airports and their metrics.
- Flight.java represents each flight using absolute times.
- Search engine:
- Graph.java sorts flights, indexes departures, and runs the temporal Dijkstra search.
- The graph also computes arrival, departure, and structural hub metrics.
- Result presentation:
- Route.java formats the final route in the terminal.
- Main.java drives the interactive application loop.
Execution flow:
- Load airports, airlines, aircraft, and flights from the CSV files.
- Sort flights by origin and departure time.
- Compute the 5 airports with the highest total degree.
- Receive origin, destination, and departure date/time from the user.
- Optionally remove a hub for simulation.
- Run temporal Dijkstra and display the route.
The algorithm works with absolute minutes starting from 01/03/2026 00:00 UTC.
- Normal airports require a minimum connection time of 45 minutes.
- Hubs require a minimum connection time of 60 minutes.
- Airports marked as removed become inaccessible.
- The search only considers flights that depart after the previous arrival time plus the minimum connection.
- The final output shows total duration, layovers, and ground waiting time.
- Java 25
- Maven 3.9 or later
- A terminal capable of running Java applications
From the repository root:
mvn compile
mvn exec:java -Dexec.mainClass="com.exemplo.Main"mvn testThe files in T2_Dados/ must remain in the expected path, because loading happens directly from that folder.
When the application starts, provide:
- Origin airport in ICAO format, for example SBPA.
- Destination airport in ICAO format, for example SBGR.
- Date and time in DD/MM/YYYY HH:MM format.
The program then computes the best sequence of flights and prints the detailed route in the terminal.
Before calculating a route, the application can temporarily remove one of the 5 structural hubs.
This lets you test how the network behaves when an important airport is no longer available.
After each route, you can choose to calculate another one. The graph is restored between queries, so each new simulation starts from a clean network state.
.
├── pom.xml
├── README.md
├── src/
│ ├── main/
│ │ └── java/com/exemplo/
│ │ ├── Airport.java
│ │ ├── DataManager.java
│ │ ├── Flight.java
│ │ ├── Graph.java
│ │ ├── Main.java
│ │ ├── Route.java
│ │ └── TimeUtils.java
│ └── test/
│ └── java/com/exemplo/AppTest.java
└── T2_Dados/
├── aerodromos.csv
├── aeronaves.csv
├── cias.csv
└── voos_mar2026.csv
- Start with Main.java to understand the interactive flow.
- Use DataManager.java to see how the CSV files are interpreted.
- Consult Graph.java for hub calculation and temporal search details.
- See Route.java to understand how output is formatted.
Maintainer: