Skip to content

Reads a .txt file of city-to-city flights and uses Breadth-First Search (BFS) to determine if a path exists between two locations. Highlights file I/O, graphs, and queue-based traversal.

Notifications You must be signed in to change notification settings

Denilson15/bfs-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BFS Lab – CS 20: Data Structures

This project was developed as part of the CS 20 Data Structures course. The goal was to implement a Breadth-First Search (BFS) algorithm to determine possible flight paths between cities, based on input from a .txt file.

💡 No AI was used in the development of this project. AI tools were utilized solely for documentation purposes, such as generating this README.

✨ Overview

The lab reads a list of direct flights between cities from a text file and determines whether there’s a valid route between a starting location and a target destination using BFS.

⚙️ How It Works

  • The program reads a text file where each line represents a flight:
    origin destination
  • A graph is constructed where cities are nodes and flights are edges.
  • The BFS algorithm is used to find a path (if one exists) from a starting city to a target city.
  • The program outputs the path, or a message stating no path is available.

🛠️ Concepts Practiced

  • Graph construction using adjacency lists
  • Breadth-First Search (BFS)
  • File I/O in C++
  • Using queue and map from the STL
  • Basic input parsing and dynamic data structures

📁 File Structure

  • flights.txt – Example input file of flight connections
  • main.cpp – Contains the BFS implementation and main program logic
  • README.md – Project documentation

🚧 Notes

  • This project was part of a lab assignment and may not reflect polished code.
  • Created during my learning process in CS 20 while I was also learning GitHub basics.

About

Reads a .txt file of city-to-city flights and uses Breadth-First Search (BFS) to determine if a path exists between two locations. Highlights file I/O, graphs, and queue-based traversal.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages