Skip to content
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

Create alternate_disjoint_set.py #2302

Merged
merged 10 commits into from
Aug 28, 2020
Merged

Conversation

anubabajide
Copy link
Contributor

@anubabajide anubabajide commented Aug 13, 2020

This code implements a disjoint set using Lists
with added heuristics for efficiency
Union by Rank Heuristic and Path Compression

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

This code implements a disjoint set using Lists 
with added heuristics for efficiency
Union by Rank Heuristic and Path Compression
@TravisBuddy
Copy link

Hey @anubabajide,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: dd13e6c0-dd07-11ea-b6e2-493429cddfc3

Added typehints, doctests and some suggested variable name change
@TravisBuddy
Copy link

Hey @anubabajide,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: c08dcc30-dd72-11ea-9bc7-ef10f4dac8ce

@anubabajide
Copy link
Contributor Author

Hey,
I have fixed the issues...
Kindy review

@cclauss
Copy link
Member

cclauss commented Aug 14, 2020

Hey,
You have messed up the tasklist above...
Kindly fix

@anubabajide
Copy link
Contributor Author

I've fixed it @cclauss

@cclauss
Copy link
Member

cclauss commented Aug 17, 2020

@TravisBuddy
Copy link

Hey @anubabajide,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 39358360-e0cc-11ea-a6dd-d374b9ca78b0

@anubabajide
Copy link
Contributor Author

@cclauss I really can't tell why its failing

@cclauss
Copy link
Member

cclauss commented Aug 21, 2020

% python3 -m pip install black
% black my_code.py

or

% python3 -m pip install flake8
% flake8 --ignore=E203,W503 --max-complexity=25 --max-line-length=88 --statistics --count .

./data_structures/disjoint_set/alternate_disjoint_set.py:5:1: E302 expected 2 blank lines, found 0
./data_structures/disjoint_set/alternate_disjoint_set.py:21:1: W293 blank line contains whitespace
./data_structures/disjoint_set/alternate_disjoint_set.py:22:32: W291 trailing whitespace
./data_structures/disjoint_set/alternate_disjoint_set.py:28:1: W293 blank line contains whitespace
./data_structures/disjoint_set/alternate_disjoint_set.py:60:1: W293 blank line contains whitespace
./data_structures/disjoint_set/alternate_disjoint_set.py:63:44: W291 trailing whitespace
1     E302 expected 2 blank lines, found 0
2     W291 trailing whitespace
3     W293 blank line contains whitespace
6

https://www.flake8rules.com/

@TravisBuddy
Copy link

Hey @anubabajide,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 9b5cfbe0-e3a6-11ea-bb85-f7bf5149087f

@TravisBuddy
Copy link

Hey @anubabajide,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 41ed67f0-e3a8-11ea-bb85-f7bf5149087f

@cclauss
Copy link
Member

cclauss commented Aug 21, 2020

@TravisBuddy
Copy link

Travis tests have failed

Hey @anubabajide,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: e22352e0-e3ab-11ea-bb85-f7bf5149087f

@TravisBuddy
Copy link

Hey @anubabajide,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 0f814980-e3ad-11ea-bb85-f7bf5149087f

@cclauss
Copy link
Member

cclauss commented Aug 21, 2020

You should be able to run these tests on your own computer with:
python3 -m doctest -v alternate_disjoint_set.py

@anubabajide
Copy link
Contributor Author

I was trying to avoid cloning to my local computer because of space.
But I guess I will have to

@cclauss
Copy link
Member

cclauss commented Aug 21, 2020

Repos size is 10.6 MB

@anubabajide
Copy link
Contributor Author

Oh, wow.

@TravisBuddy
Copy link

Travis tests have failed

Hey @anubabajide,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: cb2d7f40-e930-11ea-ae3c-2d16223a9f65

@cclauss cclauss merged commit 1f5134b into TheAlgorithms:master Aug 28, 2020
@anubabajide
Copy link
Contributor Author

Finally it passes.
The repo was about 10 MB as you mentioned, but those dependencies 😅😅

stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* Create alternate_disjoint_set.py

This code implements a disjoint set using Lists 
with added heuristics for efficiency
Union by Rank Heuristic and Path Compression

* Update alternate_disjoint_set.py

Added typehints, doctests and some suggested variable name change

* Update alternate_disjoint_set.py

* Formatted with Black

* More formatting

* Formatting on line 28

* Error in Doctest

* Doctest Update in alternate disjoint set

* Fixed build error

* Fixed doctest
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