Repository navigation
Rm networkx.algorithms.threshold.swap_d. - #8213
Merged
Merged
Conversation
Member
|
I agree that Thanks @rossbar ! |
dschult
approved these changes
Aug 30, 2025
alfred-mikhael
pushed a commit
to alfred-mikhael/networkx
that referenced
this pull request
Sep 3, 2025
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.
A proposal to remove the
swap_dfunction from thethresholdmodule.I originally came across this via test coverage - according to coverage metrics, this function is "covered" by the
test_all_random_functionstest, but that just tests that it runs with a single set of parameters. While trying to design more tests for this function, I found some (IMO) bugs. For example:This error originates from this section in the code - in particular, the
dlistleaves off the first and last element of the list, but doesn't account for this truncation in the enumeration. Therefore it's possible forchoiceto end up being0, which then causes the IndexError in L1012 when you try toseed.choice(range(0))Ultimately, I suspect that this function is neither very reliable nor widely used. Given that the
swap_dfunction is not tested (aside from smoke tests - see the test removals in this PR which cover all instances in the test suite) nor used internally anywhere else in the library, that proposing to remove it is justified. Given the fact that this is in a non-auto-imported module and there have been (to my knowledge) no issues raised related to it (despite the bugs, though they are stochastic) I'm proposing to remove it without a deprecation.