-
-
Couldn't load subscription status.
- Fork 342
Yen k shortest paths #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Yen k shortest paths #277
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces Yen's K Shortest Paths algorithm implementation in R, along with numerous supporting graph algorithms and dynamic programming solutions. The PR adds substantial educational content demonstrating various computer science algorithms with working examples.
Key Changes:
- Implementation of Yen's K Shortest Paths algorithm (simplified version)
- Addition of multiple graph algorithms (Kruskal, Prim, Dijkstra, Floyd-Warshall, etc.)
- Implementation of dynamic programming solutions (knapsack, LCS, subset sum, etc.)
- Documentation and example files for machine learning algorithms
Reviewed Changes
Copilot reviewed 141 out of 221 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
graph_algorithms/yen_k_shortest_paths.r |
Simplified Yen's algorithm using igraph library with placeholder implementation |
graph_algorithms/*.r (multiple files) |
Comprehensive graph algorithm implementations with examples |
dynamic_programming/*.r (multiple files) |
Various DP algorithms with detailed examples and testing |
kruskal_mst.r |
Duplicate implementation of Kruskal's algorithm in wrong directory |
documentation/*.md/*.html |
Machine learning tutorial references and example code outputs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have changed 221 files, check your changes
Algorithm: Yen's K Shortest Paths
Purpose: Finds the K shortest loopless paths between a source and target in a weighted directed graph.
Theory:
Starts with the shortest path using Dijkstra.
Iteratively generates alternative paths by deviating from previous paths.
Avoids cycles in paths.
Time Complexity: O(K * V * (V + E) * log V) with Dijkstra for each deviation.
Space Complexity: O(K * V).
Input: Weighted directed graph (adjacency list), source, target, K.
Output: List of K paths and their total distances.