Add Dijkstra's shortest path algorithm implementation #[HACKTOBERFEST 2025]#153
Merged
siriak merged 3 commits intoTheAlgorithms:masterfrom Oct 5, 2025
Merged
Conversation
- Implement Dijkstra's algorithm with priority queue - Include path reconstruction functionality - Add functions to find all shortest paths from source - Handle weighted graphs with comprehensive examples - Create new graph_algorithms directory - Update DIRECTORY.md to include the new algorithm
There was a problem hiding this comment.
Pull Request Overview
Implements Dijkstra's shortest path algorithm with path reconstruction and utility helpers, plus documentation-style inline examples.
- Adds core algorithm (priority-queue based), path reconstruction, and all-paths helper.
- Introduces inline example / demo executions within the same source file.
- Updates DIRECTORY.md to list the new algorithm.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| graph_algorithms/dijkstra_shortest_path.r | Adds Dijkstra implementation, priority queue helpers, path reconstruction, and embedded runnable examples. |
| DIRECTORY.md | Registers the new Dijkstra algorithm in the index. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Member
|
Please check comments |
Contributor
Author
|
@siriak all conflicts 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 implements Dijkstra's shortest path algorithm for finding optimal paths in weighted graphs - a cornerstone algorithm in graph theory and network optimization.
✨ Features
🎯 Why This Matters
Dijkstra's algorithm is crucial for:
📚 Implementation Details
dijkstra_shortest_path()- Core algorithmget_shortest_path()- Path reconstructionget_all_shortest_paths()- All paths from source🔧 Technical Features
🧪 Testing
Extensive examples including:
📁 Files Added
graph_algorithms/dijkstra_shortest_path.r- Complete implementationDIRECTORY.mdwith Dijkstra entry🏆 Educational Value
Includes detailed comments explaining:
🎃 Hacktoberfest 2025
This completes the fundamental graph algorithms trilogy (DFS, BFS, Dijkstra) providing comprehensive graph algorithm coverage for the repository.