Skip to content

Updated check_bipartite_graph_dfs.py #9525

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
merged 26 commits into from
Oct 5, 2023
Merged

Updated check_bipartite_graph_dfs.py #9525

merged 26 commits into from
Oct 5, 2023

Conversation

debnath003
Copy link
Contributor

Describe your change:

Updated the check_bipartite_graph_dfs.py in the graph folder which will reduce the time complexity. Furthermore I also included doctest module for testing some test cases included in the code.

  • 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 include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Oct 2, 2023
@debnath003
Copy link
Contributor Author

@tianyizheng02 please merge my PR, awaiting your review

@debnath003
Copy link
Contributor Author

@tianyizheng02 awaiting your review #9525

@debnath003
Copy link
Contributor Author

@tianyizheng02 could you please approve my PR review #9525? This is my first time contributing in this repository. Also please include hacktoberfest accepted label! Thanks again

@debnath003
Copy link
Contributor Author

@tianyizheng02 please look after this PR #9525 and merge this PR for hacktoberfest

@debnath003
Copy link
Contributor Author

@tianyizheng02 please look after #9525 and merge the PR for hacktoberfest

@debnath003
Copy link
Contributor Author

@tianyizheng02 @cclauss please look after this PR #9525 and merge the PR, so that it can be eligible for hacktoberfest. Please also add hacktoberfest-accepted label. Thanks a lot!

@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 4, 2023
@debnath003
Copy link
Contributor Author

if you do pipx install pre-commit and the pre-commit install at the root of this repo's directory then black (code formatting) and ruff (linting) will run automatically on each git commit.

I have actually done that in vscode, but the change that you have given seemingly shows some format errors, which is alright; Apart from that is the code okay, as edited by the changes that you have suggested? @cclauss

@debnath003
Copy link
Contributor Author

@cclauss looks like the code is having some error, in build, could you please point out the error?

@cclauss
Copy link
Member

cclauss commented Oct 4, 2023

@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Oct 4, 2023
@debnath003
Copy link
Contributor Author

@cclauss I have made the required changes, and the checks are also correct, could you please review that and merge the PR? It will be very helpful in hacktoberfest also if you add the hacktoberfest-accepted label

@debnath003 debnath003 requested a review from cclauss October 4, 2023 19:35
@debnath003
Copy link
Contributor Author

@cclauss @tianyizheng02 please someone check the review and approve my PR! Awaiting for review!

This is complex code so let's use self-documenting function and variable names to help readers to understand.

We should not shorten names to simplify the code formatting but use understandable name and leave to code formatting to psf/black.

I am not sure if `nbor` was supposed to be `neighbour`.  ;-)
@cclauss
Copy link
Member

cclauss commented Oct 5, 2023

This is complex code so let's use function and variable names that are self-documenting to help readers understand.

We should not shorten names to simplify the code formatting but use understandable names and leave the code formatting to psf/black.

I am unsure if nbor was supposed to be neighbour. ;-)

@algorithms-keeper algorithms-keeper bot added tests are failing Do not merge until tests pass and removed tests are failing Do not merge until tests pass labels Oct 5, 2023
@debnath003
Copy link
Contributor Author

All the checks have passed! @cclauss

@debnath003
Copy link
Contributor Author

This is complex code so let's use function and variable names that are self-documenting to help readers understand.

We should not shorten names to simplify the code formatting but use understandable names and leave the code formatting to psf/black.

I am unsure if nbor was supposed to be neighbour. ;-)

I actually did it intentionally, so that my formatting can be correct according to the ruff linter 😅 @cclauss

@debnath003
Copy link
Contributor Author

@cclauss could you please check this PR once again?

@cclauss
Copy link
Member

cclauss commented Oct 5, 2023

https://docs.astral.sh/ruff/faq/#is-ruff-compatible-with-black ;-) They both run in our pre-commit.

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!!!

@algorithms-keeper algorithms-keeper bot removed the awaiting reviews This PR is ready to be reviewed label Oct 5, 2023
@cclauss cclauss merged commit b76115e into TheAlgorithms:master Oct 5, 2023
@debnath003
Copy link
Contributor Author

https://docs.astral.sh/ruff/faq/#is-ruff-compatible-with-black ;-) They both run in our pre-commit.

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black

I think I forgot it 😅

@debnath003
Copy link
Contributor Author

debnath003 commented Oct 5, 2023

Nice work!!!

Please add hacktoberfest-accepted label so that it can be accepted in hacktoberfest @cclauss

@cclauss
Copy link
Member

cclauss commented Oct 5, 2023

Hacktoberfest knows this repo... They will accept this automatically but just in case...

@cclauss cclauss added the hacktoberfest-accepted Accepted to be counted towards Hacktoberfest label Oct 5, 2023
@debnath003
Copy link
Contributor Author

Thanks a lot @cclauss !

sedatguzelsemme pushed a commit to sedatguzelsemme/Python that referenced this pull request Sep 15, 2024
* Create dijkstra_algorithm.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dijkstra_algorithm.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dijkstra_algorithm.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dijkstra_algorithm.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Delete greedy_methods/dijkstra_algorithm.py

* Update check_bipartite_graph_dfs.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update check_bipartite_graph_dfs.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update graphs/check_bipartite_graph_dfs.py

Co-authored-by: Christian Clauss <[email protected]>

* Update graphs/check_bipartite_graph_dfs.py

Co-authored-by: Christian Clauss <[email protected]>

* Update check_bipartite_graph_dfs.py

* Update check_bipartite_graph_dfs.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update check_bipartite_graph_dfs.py

* Update check_bipartite_graph_dfs.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update check_bipartite_graph_dfs.py

* Update check_bipartite_graph_dfs.py

* Update check_bipartite_graph_dfs.py

* Let's use self-documenting variable names

This is complex code so let's use self-documenting function and variable names to help readers to understand.

We should not shorten names to simplify the code formatting but use understandable name and leave to code formatting to psf/black.

I am not sure if `nbor` was supposed to be `neighbour`.  ;-)

* Update check_bipartite_graph_dfs.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <[email protected]>
@isidroas isidroas mentioned this pull request Jan 25, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This PR modified some existing files hacktoberfest-accepted Accepted to be counted towards Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants