-
-
Notifications
You must be signed in to change notification settings - Fork 342
Topological sort #266
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?
Topological sort #266
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 a topological sort algorithm implementation along with multiple new algorithm implementations across graph algorithms, dynamic programming, machine learning, and mathematics categories. The PR adds implementations for fundamental algorithms including topological sort (Kahn's algorithm), various graph traversal algorithms, dynamic programming solutions, and machine learning models.
Key Changes
- Implementation of topological sort algorithm using Kahn's algorithm for directed acyclic graphs
- Addition of multiple graph algorithms (BFS, DFS, Dijkstra, Bellman-Ford, Floyd-Warshall, Kruskal's MST, Hamiltonian cycle, bridge detection)
- Dynamic programming implementations (knapsack, LCS, LIS, coin change, subset sum, minimum path sum, matrix chain multiplication)
- Machine learning algorithms (gradient boosting, various documentation files)
- Mathematics algorithms (extended Euclidean, Catalan numbers, bisection method, etc.)
Reviewed Changes
Copilot reviewed 138 out of 211 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| graph_algorithms/topological_sort.r | Implements Kahn's algorithm for topological sorting of DAGs |
| graph_algorithms/kruskal_mst.r | Kruskal's MST algorithm with union-find data structure |
| graph_algorithms/dijkstra_shortest_path.r | Dijkstra's algorithm with priority queue implementation |
| graph_algorithms/bellman_ford_shortest_path.r | Bellman-Ford algorithm supporting negative weights |
| graph_algorithms/floyd_warshall.r | All-pairs shortest path algorithm using R6 classes |
| graph_algorithms/depth_first_search.r | DFS implementation with recursive and iterative versions |
| graph_algorithms/breadth_first_search.r | BFS with shortest path and distance finding utilities |
| graph_algorithms/bridge_detector.r | Tarjan's algorithm for finding bridges in graphs |
| graph_algorithms/hamilitonian_cycle.r | Backtracking algorithm for Hamiltonian cycle detection |
| dynamic_programming/*.r | Multiple DP algorithm implementations |
| machine_learning/gradient_boosting.r | Gradient boosting regressor with R6 classes |
| mathematics/*.r | Various mathematical algorithm implementations |
| documentation/.md/.html | Documentation and example files for ML algorithms |
| kruskal_mst.r | Duplicate Kruskal implementation in root directory |
siriak
left a comment
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.

Topological Sort is an ordering of the vertices of a Directed Acyclic Graph (DAG) such that for every directed edge u → v, vertex u comes before v in the order.
Used in task scheduling, course prerequisites, and build systems.
Cannot be performed if the graph contains a cycle.
Common algorithms: Kahn’s Algorithm (BFS) and DFS-based approach.