Skip to content

Latest commit

 

History

History
155 lines (119 loc) · 6.25 KB

File metadata and controls

155 lines (119 loc) · 6.25 KB

Flight Map Routing Ting - Get Your Jet Sorted, Innit

Wagwan G?

Listen up, yeah? This Flight Map Routing Project ain't no joke ting. It's a Python banger that sorts you out with the maddest flight routes across the globe, like boom! We're talkin' proper graph algorithms and bare real flight data. This bad boy gives you the options, ranked by distance, how many stops (less is blessed, innit), how much P's it costs, and even how much it's mashin' up the ozone, fam.

Built this for the CSC1108: Data Structures and Algorithms flex, just to show the mandem how these computer science tings work in the real world, get me?

What Makes It Peng?

  • Bare Routes, Bruv: Finds you nuff ways to get from A to B, any airport in the ends.
  • Sick Routing Brain: Got that modified A* algorithm with a Fibonacci heap, movin' faster than feds on a chase. Proper efficient.
  • Custom Fib Heap: Built our own priority queue ting, makes the standard ones look slow like a snail on ket. Speeds up the whole damn thing.
  • Choose Your Flava: Optimize routes for what you rate most:
    • Shortest hop (Quick ting)
    • Least stops (Direct flex)
    • Cheapest ticket (Save them P's)
    • Best value path (Bang for your buck)
    • Lowest CO2 (For the green mandem)
  • Easy Peasy UI: Streamlit ting, looks slick, interactive maps, even your nan could use it.
  • All Journey Types: One-way, round trip, even multi-city madness when you're doin' up tourist. Sorted.
  • Real Costs: Got proper pricing models and carbon emission calculations, no funny business.
  • Currency Switch Up: Flips between different spondoolies automatically, safe.

Tech Stack & Brain Bits

  • Graph Game: Airports are points, flights are the lines connectin' 'em. Simple.
  • Fibonacci Heap: That priority queue ting we mentioned, makes finding paths rapid.
  • Circular Doubly Linked Lists: Helps the Fib heap nodes stay linked up proper.
  • A* Algorithm: Tweaked it for K-shortest paths, jugglin' all them optimization factors. Smart shit.
  • Caching: Remembers distances so it ain't gotta calculate the same ting twice. Quick maths.
  • Quicksort: Custom sortin' ting for rankin' the routes how you like.

How to Get This Ting Running

Need These Bits First

  • Python 3.8 or higher (Get the right tool for the job, yeah?)
  • pip (Obvs)

Setting Up Your Yard (Virtual Environment)

# Make the virtual space
python -m venv venv

# Step inside
# Windows mandem
venv\Scripts\activate
# Mac/Linux G's
source venv/bin/activate

Gettin' the Goods (Dependencies)

# Slap all the required bits in
pip install -r requirements.txt

Fire It Up!

# Start the Streamlit magic
streamlit run app.py

Should pop up in your browser at http://localhost:8501. Easy.

How the Files Are Stacked

flight-routing/
├── app.py                       # The main don running the show (Streamlit app)
├── airport_network.py           # Where the route brain lives
├── fibonacci_heap.py            # That speedy Fib heap code
├── models.py                    # Data blueprints (Airports, Airlines, etc.)
├── configuration.py             # Settings and configs, tunable tings
├── sorting.py                   # The custom sortin' logic
├── ui_controller.py             # Links the front-end pretty bits to the back-end muscle
├── currency_api.py              # Handles the money conversion magic
├── flight_ticket_price_api.py   # Hooks up to get flight prices
├── page/                        # Different screens for the UI
│   ├── single_flight_page.py    # One-way search page
│   ├── return_flight_page.py    # Round trip search page
│   └── multi_city_page.py       # Multi-city search page
├── static/                      # Pictures and styles
│   ├── styles/                  # CSS files to make it look good
│   └── templates/               # HTML skeletons
├── utils/                       # Helper tools
│   ├── css_loader.py            # Loads the CSS style sheets
│   ├── page_utils.py            # Utilities for the pages
│   └── template_loader.py       # Loads the HTML templates
├── data/                        # Where the raw data lives
│   └── airline_routes.json      # Airport and route info dump
└── requirements.txt             # List of all the tools needed

Nitty Gritty on the Algorithms

Modified A* K-Shortest Paths - The Brain Box

We levelled up the basic A* to find bare good paths:

  1. Guessing Game (Heuristic): Uses Haversine distance (posh way of sayin' distance on a sphere) to guess how far.
  2. Stop Penalties: Adds a little extra 'cost' for stops, so it knows direct flights are usually better.
  3. Multi-Tasking: Juggles distance, time, price, and emissions all at once. Mad.
  4. Fibonacci Heap: That quick priority queue we keep chattin' about. Essential.
  5. Path Tracker: Remembers how it got there to draw the route proper.

Speedy Distance Calc with Cache

To stop it lagging, we calculate distances using Haversine formula and store 'em so we don't gotta do it again:

def haversine_calculator(lat1, lon1, lat2, lon2):
    """
    Calculate the proper distance between two spots on the Earth.
    Standard.
    """
    earth_radius = 6371  # Earth's size in KM, innit
    # ... bare maths happens here ...
    return distance # Boom, distance sorted

Where'd We Get the Data?

The info on airports and routes comes from:

  • OpenFlights database (It's a bit old school, like 2014, but it works)
  • Jonty Airline Route Data (Another source, safe)

Added some made-up prices and flight times to make it look legit.

What's Next? (Future Plans)

  • Get live flight data, none of this old stuff.
  • Add weather checks, avoid them bumpy rides.
  • User accounts to save your favourite routes. Proper VIP ting.
  • Make a mobile app, obvs.
  • Link it so you can actually book the damn flights. Big moves.

The Mandem Who Built This Ting

  • Lucas Lee Jing Yi
  • Lim Tze Kai
  • Kieran Sim
  • Fahrul Razie Annaqi
  • Sheila Lim Yann Tsern
  • Tan Yuewen, Sara

Shout Outs

  • Big up OpenFlights for the data.
  • Respect to Streamlit for the easy UI ting.
  • Props to the CSC1108 instructor for the guidance. Safe.