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