Add edmonds blossom algo#238
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds implementations of several new algorithms to the R repository, including Edmonds' Blossom Algorithm for maximum matching in non-bipartite graphs, along with machine learning algorithms (k-NN, Gaussian Process, CNN), graph algorithms (Stoer-Wagner), and dynamic programming (Kadane's Algorithm). However, the PR title and description focus exclusively on Edmonds' Blossom Algorithm while other unrelated algorithms are included without mention.
Key Changes:
- Added Edmonds' Blossom Algorithm for maximum matching in general graphs
- Added multiple machine learning and graph algorithm implementations not mentioned in PR description
- All new files follow lowercase
.rextension convention
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| graph_algorithms/edmonds_blossom.r | Implementation of Edmonds' Blossom Algorithm using igraph for maximum matching |
| machine_learning/k-NN.r | Complete k-Nearest Neighbors implementation with classification and regression support |
| machine_learning/guassian_process.r | Gaussian Process Regression using kernlab package |
| machine_learning/cnn.r | Convolutional Neural Network architecture definition using Keras |
| graph_algorithms/stoer_wagner.r | Stoer-Wagner minimum cut algorithm for undirected weighted graphs |
| dynamic_programming/kadane's_algo.r | Kadane's Algorithm for maximum subarray sum with circular variant |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
machine_learning/guassian_process.r:1
- Corrected spelling of 'guassian' to 'gaussian' in filename.
# ==============================================
| @@ -0,0 +1,62 @@ | |||
| # ============================================== | |||
| # Gaussian Process Regression (GP) | |||
There was a problem hiding this comment.
The filename contains a misspelling ('guassian_process.r') that is inconsistent with the correct spelling used throughout the file content ('Gaussian'). The file should be renamed to 'gaussian_process.r'.
| @@ -0,0 +1,162 @@ | |||
| # Kadane's Algorithm in R | |||
There was a problem hiding this comment.
This algorithm is already implemented
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
This PR was closed because it has been stalled for 7 days with no activity. |
Overview
This implementation defines Edmonds’ Blossom Algorithm in R for computing the maximum matching in general (non-bipartite) graphs. The algorithm finds the largest set of edges without shared vertices, handling odd-length cycles (blossoms) efficiently.
Features
Computes maximum matching for both bipartite and non-bipartite graphs.
Handles odd-length cycles using blossom contraction.
Returns matched edges for further processing or analysis.
Includes an example graph for demonstration.
Useful for network pairing, scheduling, and project/task assignments.
Complexity
Time Complexity: O(V³) (V = number of vertices)
Space Complexity: O(V + E)
Demonstration
The included R script computes the maximum matching on a 5-vertex non-bipartite graph.
Prints the matched edges.
Users can replace the edge list with their own graph to find maximum matchings.
Summary
This implementation adds Edmonds’ Blossom Algorithm to the R algorithms repository. It is suitable for matching problems in networks, scheduling tasks, and pairing applications in non-bipartite graphs.