fix(community): bound label propagation iterations to guarantee termi…#1631
Open
MrNirmata wants to merge 3 commits into
Open
fix(community): bound label propagation iterations to guarantee termi…#1631MrNirmata wants to merge 3 commits into
MrNirmata wants to merge 3 commits into
Conversation
…nation label_propagation() ran a `while True` loop that only exited on full convergence. Synchronous (Jacobi-style) label propagation is not guaranteed to converge: on symmetric or tie-heavy graphs the assignment can settle into a period-two oscillation and flip between two states forever, so the loop never terminates. build_communities() then hangs, pinning a CPU with no progress and no error. Cap the propagation at MAX_LABEL_PROPAGATION_ITERATIONS (1000) and return the latest assignment when it has not converged, logging a warning. Graphs that do converge are unaffected: the `no_change` early-exit still fires exactly as before, so results are identical for every converging input. Add unit tests for a small non-convergent graph that previously hung, the non-convergence warning, and a separable graph that still converges to the expected communities.
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA behalf on myself, e-mail: mrnirmata@gmail.com |
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.
…nation
label_propagation() ran a
while Trueloop that only exited on full convergence. Synchronous (Jacobi-style) label propagation is not guaranteed to converge: on symmetric or tie-heavy graphs the assignment can settle into a period-two oscillation and flip between two states forever, so the loop never terminates. build_communities() then hangs, pinning a CPU with no progress and no error.Cap the propagation at MAX_LABEL_PROPAGATION_ITERATIONS (1000) and return the latest assignment when it has not converged, logging a warning. Graphs that do converge are unaffected: the
no_changeearly-exit still fires exactly as before, so results are identical for every converging input.Add unit tests for a small non-convergent graph that previously hung, the non-convergence warning, and a separable graph that still converges to the expected communities.
Summary
Brief description of the changes in this PR.
Type of Change
Objective
For new features and performance improvements: Clearly describe the objective and rationale for this change.
Testing
Breaking Changes
If this is a breaking change, describe:
Checklist
make lintpasses)Related Issues
Closes #[issue number]