Git Product home page Git Product logo

mariptime / planaflight Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 17 KB

The "Plan a Flight Project" is a software that uses graph data structures and backtracking algorithms to plan efficient flight routes between cities, outputting the top 3 plans based on time or cost. It's run from the command line and follows robust OOP design principles.

Java 100.00%
bfs-dfs cost-optimization iterative-backtracking-algorithm trees

planaflight's Introduction

Plan a Flight Project

This project involves planning flights between cities by analyzing flight data and requested flight plans. The goal is to output the most efficient flight plans based on time or cost.

Introduction

The task is to determine all possible flight plans between origin and destination cities using information from input files containing flight data and requested flight plans. Flight data includes city pairs, flight costs, and travel times. Requested flight plans specify origin/destination pairs and whether to sort results by time or cost. The program must output the top 3 most efficient flight plans or all plans if fewer than 3 exist. If no plan is possible, an error message is output.

Data Structures

An undirected graph data structure represents all flight connections between cities. Nodes are cities, and edges are flights between cities with associated costs and times. The graph is implemented using an adjacency list, where each city has a linked list of its connections.

A stack is also implemented to perform iterative backtracking during the exhaustive search for flight plans. The stack "remembers" the search path and allows backtracking if a dead end is reached.

Algorithm

An iterative backtracking algorithm uses the graph and stack to find all possible flight plans between an origin/destination pair. The stack holds the current partial path during depth-first search. If a dead end is reached, the search backtracks and tries a new path. All valid plans are output once the destination is reached.

Output

For each requested flight plan, the top 3 most efficient plans based on the time or cost sort parameter are output. Plans include the path taken and total time/cost. If fewer than 3 plans exist, all plans are output. An error message is shown if no plan is possible.

Implementation

The program is run from the command line, passing the input and output file names. Classes are used to represent the graph, stack, and other data structures. Methods are divided appropriately among classes. The main method has minimal code by delegating work to other classes/methods. Proper OOP design and robust, well-structured code is required.

planaflight's People

Contributors

mariptime avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

whigg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.