Skip to content

pdhinaka/BFS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graph Animation with Breadth-First Search

This project is a graph animation that demonstrates the Breadth-First Search (BFS) algorithm using p5.js. It allows you to generate a random graph, run BFS, and step through the algorithm to visualize how it explores nodes.

Getting Started

To launch the animation, follow these steps:

  1. Clone or download this repository to your local machine.

  2. Navigate to the project directory.

  3. Open the BFS.html file in a web browser. This file contains the HTML and JavaScript code for the animation.

  4. Interact with the animation using the provided buttons:

    • "Generate Graph": Creates a random graph.
    • "Run BFS": Initiates the BFS algorithm.
    • "Step BFS": Steps through the BFS algorithm one node at a time.

Usage

  • Adjust the number of nodes and edges using the input fields and click "Generate Graph" to create a random graph.

  • Click "Run BFS" to start the BFS algorithm. Nodes will be colored to indicate their state (unexplored, currently exploring, explored).

  • Use the "Step BFS" button to visualize the BFS algorithm step by step.

Customization

You can modify the appearance and behavior of the animation by editing the following files:

  • sketch.js: Contains the p5.js sketch code, including graph generation and BFS implementation.

  • bfs.js: Contains functions related to running BFS.

Author

  • Pranav Dhinakar

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors