Skip to content

Conversation

@ArpitaHanjagi
Copy link
Contributor

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.

Copilot AI review requested due to automatic review settings October 20, 2025 17:54
Copy link

Copilot AI left a 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 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

@siriak
Copy link
Member

siriak commented Oct 25, 2025

This algorithm is already implemented in the repository

@siriak siriak closed this Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants