Skip to content

Implement Hamiltonian Cycle Finder #731

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

Merged

Conversation

sozelfist
Copy link
Contributor

Pull Request Template

Description

See details in the implementation

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I ran bellow commands using the latest version of rust nightly.
  • I ran cargo clippy --all -- -D warnings just before my last commit and fixed any issue that was found.
  • I ran cargo fmt just before my last commit.
  • I ran cargo test just before my last commit and all tests passed.
  • I added my algorithm to the corresponding mod.rs file within its own folder, and in any parent folder(s).
  • I added my algorithm to DIRECTORY.md with the correct link.
  • I checked COUNTRIBUTING.md and my code follows its guidelines.

@sozelfist sozelfist requested review from imp2002 and vil02 as code owners June 1, 2024 02:47
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.96%. Comparing base (4e59645) to head (b8de9b0).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #731      +/-   ##
==========================================
+ Coverage   94.95%   94.96%   +0.01%     
==========================================
  Files         303      304       +1     
  Lines       22533    22584      +51     
==========================================
+ Hits        21396    21447      +51     
  Misses       1137     1137              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sozelfist
Copy link
Contributor Author

Can you have a look on this PR (and other PRs in the backtracking category) and review them @vil02.

@sozelfist
Copy link
Contributor Author

Can you review this PR, @vil02?

@sozelfist sozelfist requested a review from vil02 June 19, 2024 03:15
@sozelfist sozelfist requested a review from vil02 June 20, 2024 01:32
@vil02
Copy link
Member

vil02 commented Jun 20, 2024

Failing CI will be fixed by #754.

@sozelfist sozelfist force-pushed the feat/backtracking/hamiltonian_cycle branch from 27e5351 to 300fb32 Compare June 20, 2024 06:55
- Add custom error `AdjMatError` type with 3 varients: `EmptyMat`, `StartOutOfBound` and `ImproperMat`
- Add tests for exceptional cases
- Change adjaceny matrix repr to `Vec<Vec<bool>>`
- Move error handling to appropriate methods
- Add `num_vertices` method
@sozelfist sozelfist force-pushed the feat/backtracking/hamiltonian_cycle branch from 300fb32 to 559b865 Compare June 21, 2024 01:06
- Rename custom error to more related name, from `AdjMatError` to `FindHamiltonialCycleError`
- Use `HashSet` to retrieve visited vextex in `O(1)` time
- Chain method when propagating error
- Add test for directed graph
@sozelfist sozelfist requested a review from vil02 June 21, 2024 02:20
- Write error names in full word format
- Use `Vec<bool>` to store visited vertices
- Represent path as `Vec<Option<usize>>` where the undefined vertex is represented as `None`
- Add suggested tests
@sozelfist sozelfist requested a review from vil02 June 21, 2024 15:06
@vil02 vil02 merged commit 081b61f into TheAlgorithms:master Jun 21, 2024
3 of 4 checks passed
@sozelfist sozelfist deleted the feat/backtracking/hamiltonian_cycle branch June 22, 2024 01:34
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.

3 participants