Add Breadth-First Search (BFS) algorithm implementation #[HACKTOBERFEST 2025]#152
Merged
siriak merged 3 commits intoTheAlgorithms:masterfrom Oct 5, 2025
Merged
Conversation
- Implement BFS with queue-based traversal - Include shortest path finding functionality - Add function to find vertices at specific distances - Comprehensive examples with complex graphs - Create new graph_algorithms directory - Update DIRECTORY.md to include the new algorithm
There was a problem hiding this comment.
Pull Request Overview
Adds a new Breadth-First Search (BFS) implementation with shortest path and distance-based utilities, plus an index entry in DIRECTORY.md.
- Implements three BFS-related functions (traversal, shortest path, vertices at distance).
- Adds embedded example/demo code executing on load.
- Updates directory listing with a Graph Algorithms section.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 12 comments.
| File | Description |
|---|---|
| graph_algorithms/breadth_first_search.r | Adds BFS traversal, shortest path, and distance query functions plus inline executable examples. |
| DIRECTORY.md | Adds Graph Algorithms section pointing to new BFS implementation. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Member
|
Please check the comments |
Contributor
Author
|
@siriak sir all conflicts has been resolved |
siriak
approved these changes
Oct 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 Overview
This PR adds a comprehensive implementation of the Breadth-First Search (BFS) algorithm with advanced features including shortest path finding and distance-based vertex discovery.
✨ Features
🎯 Why This Matters
BFS is essential for:
📚 Implementation Details
bfs_shortest_path()- Returns path and distancebfs_vertices_at_distance()- Finds vertices at exact distance🧪 Testing
Comprehensive examples including:
📁 Files Added
graph_algorithms/breadth_first_search.r- Complete BFS implementationDIRECTORY.mdwith BFS entry🔗 Complements
This pairs perfectly with DFS to provide complete graph traversal coverage for the repository.
🎃 Hacktoberfest 2025
Adds another fundamental algorithm with practical applications, enhancing the repository's educational value for computer science students.