Kosaraju scc#268
Closed
ArpitaHanjagi wants to merge 5 commits intoTheAlgorithms:masterfrom
Closed
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds implementations of Kosaraju's Strongly Connected Components (SCC) algorithm along with numerous other graph algorithms, dynamic programming solutions, mathematics functions, and machine learning implementations in R. The PR includes comprehensive examples and documentation for each algorithm.
- Implements Kosaraju's SCC algorithm for finding strongly connected components in directed graphs
- Adds multiple graph algorithms (DFS, BFS, Dijkstra, Bellman-Ford, Floyd-Warshall, Prim's MST, Kruskal's MST, topological sort, Hamiltonian cycle detection, bridge detection)
- Includes dynamic programming solutions (0/1 knapsack, coin change, LCS, LIS, matrix chain multiplication, minimum path sum, subset sum)
- Provides mathematics utilities (Armstrong numbers, amicable numbers, bisection method, Catalan numbers, Euclidean distance)
- Implements machine learning algorithms (gradient boosting)
Reviewed Changes
Copilot reviewed 139 out of 213 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| graph_algorithms/kosaraju_scc.r | Implements Kosaraju's algorithm for finding strongly connected components |
| graph_algorithms/*.r | Multiple graph algorithm implementations (DFS, BFS, shortest paths, MST, etc.) |
| dynamic_programming/*.r | Dynamic programming solutions for classic problems |
| mathematics/*.r | Mathematical utility functions and number theory algorithms |
| machine_learning/gradient_boosting.r | Gradient boosting regressor implementation using R6 classes |
| documentation/.md/.html | Documentation and examples for various algorithms |
| kruskal_mst.r | Duplicate Kruskal's MST implementation in root directory |
Member
|
This algorithm is already implemented in the repository |
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.
Kosaraju’s Strongly Connected Components (SCC) Algorithm
Kosaraju’s algorithm finds all strongly connected components in a directed graph.
It performs two depth-first searches (DFS): first on the original graph to compute finishing times, then on the transposed graph in decreasing order of finish times to identify SCCs.
Time Complexity: O(V + E)
Space Complexity: O(V + E)
Input: Directed graph as an adjacency list
Output: List of SCCs, each as a vector of vertices
The code also prints the graph and the detected SCCs for easy visualization.