Add Hamiltonian Path in R#245
Closed
nachiket2005 wants to merge 2 commits into
Closed
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds two new algorithm implementations to the repository: a Hamiltonian Path search using backtracking and a Fast Fourier Transform (FFT) using the Cooley-Tukey recursive approach. Both implementations include comprehensive documentation and example usage.
Key Changes:
- Adds a backtracking-based Hamiltonian Path algorithm for finding paths that visit each vertex exactly once in an undirected graph
- Adds a recursive FFT implementation with automatic zero-padding for non-power-of-two inputs
- Includes detailed documentation files explaining usage, complexity, and implementation notes for both algorithms
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| graph_algorithms/hamiltonian_path.r | Implements Hamiltonian Path search using backtracking with adjacency matrix input |
| mathematics/fast_fourier_transform.r | Implements Cooley-Tukey FFT algorithm with power-of-two padding |
| documentation/hamiltonian_path.md | Documents the Hamiltonian Path implementation including usage and complexity analysis |
| documentation/fast_fourier_transform.md | Documents the FFT implementation including usage examples and complexity notes |
siriak
requested changes
Oct 23, 2025
| @@ -0,0 +1,29 @@ | |||
| # Fast Fourier Transform (FFT) | |||
|
|
|||
| This file documents the recursive Cooley-Tukey FFT implementation added to `R/mathematics/fast_fourier_transform.r`. | |||
Member
There was a problem hiding this comment.
We don't add documentation in a separate file, please remove it
|
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. |
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.
Overview
The
hamiltonianPathfunction attempts to construct a valid Hamiltonian Path by recursively adding vertices to a path while ensuring adjacency and non-repetition constraints.If the input adjacency matrix does not contain a Hamiltonian Path, the algorithm reports that no valid path was found.
This implementation provides a clear, educational example of graph backtracking and can be extended to find Hamiltonian Cycles as well.
Features
TRUEif a path exists, otherwiseFALSEComplexity