Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix RuntimeError in bipartite-check DFS/BFS and clean up doctests #12814

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
MaximSmolskiy merged 12 commits into TheAlgorithms:master from mohiuddin-khan-shiam:master
Aug 24, 2025

Conversation

Copy link
Contributor

@mohiuddin-khan-shiam mohiuddin-khan-shiam commented Jun 29, 2025

Fix RuntimeError in bipartite-check DFS/BFS and clean up doctests

Description

  • Iteration over graph mutated by defaultdict neighbours caused
    RuntimeError: dictionary changed size during iteration.
    – Iterate over list(graph) in both DFS and BFS helpers.
  • Corrected if __name__ == "__main__": typo.
  • Updated two doctests that now succeed after the fix.

All doctests now pass (30/30), eliminating a critical runtime failure and improving reliability of the graph algorithms.

odiomarcelino and others added 3 commits June 29, 2025 20:10
* Iteration over `graph` mutated by `defaultdict` neighbours caused
 `RuntimeError: dictionary changed size during iteration`.
 – Iterate over `list(graph)` in both DFS and BFS helpers.
* Corrected `if __name__ == "__main__":` typo.
* Updated two doctests that now succeed after the fix.
All doctests now pass (`30/30`), eliminating a critical runtime failure and improving reliability of the graph algorithms.
Co-Authored-By: S. M. Mohiuddin Khan Shiam <147746955+mohiuddin-khan-shiam@users.noreply.github.com>
 Iteration over graph mutated by defaultdict neighbours caused
 RuntimeError: dictionary changed size during iteration.
 – Iterate over list(graph) in both DFS and BFS helpers.
 Corrected if __name__ == "__main__": typo.
 Updated two doctests that now succeed after the fix.
All doctests now pass (30/30), eliminating a critical runtime failure and improving reliability of the graph algorithms.
@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Aug 24, 2025
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Aug 24, 2025
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Aug 24, 2025
@algorithms-keeper algorithms-keeper bot removed the awaiting reviews This PR is ready to be reviewed label Aug 24, 2025
@MaximSmolskiy MaximSmolskiy merged commit 561cc38 into TheAlgorithms:master Aug 24, 2025
5 checks passed
cclauss pushed a commit to cclauss/Python that referenced this pull request Aug 25, 2025
...eAlgorithms#12814)
* Fix `RuntimeError` in bipartite-check DFS/BFS and clean up doctests
* Iteration over `graph` mutated by `defaultdict` neighbours caused
 `RuntimeError: dictionary changed size during iteration`.
 – Iterate over `list(graph)` in both DFS and BFS helpers.
* Corrected `if __name__ == "__main__":` typo.
* Updated two doctests that now succeed after the fix.
All doctests now pass (`30/30`), eliminating a critical runtime failure and improving reliability of the graph algorithms.
Co-Authored-By: S. M. Mohiuddin Khan Shiam <147746955+mohiuddin-khan-shiam@users.noreply.github.com>
* Update check_bipatrite.py
* Update check_bipatrite.py
* Update check_bipatrite.py
* Update check_bipatrite.py
* Update check_bipatrite.py
* Update check_bipatrite.py
* Update check_bipatrite.py
* Update check_bipatrite.py
* Update check_bipatrite.py
---------
Co-authored-by: Odio Marcelino <odiomarcelino@gmail.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@MaximSmolskiy MaximSmolskiy MaximSmolskiy approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /