Visitar URL original
Warn when PageRank convergence check is ineffective by DresdenGman · Pull Request #8735 · networkx/networkx · GitHub
Skip to content

Warn when PageRank convergence check is ineffective - #8735

Merged
dschult merged 4 commits into
networkx:mainfrom
DresdenGman:pagerank-convergence-warning
Jul 7, 2026
Merged

dschult merged 4 commits into
networkx:mainfrom
DresdenGman:pagerank-convergence-warning

Conversation

@DresdenGman

Copy link
Copy Markdown
Contributor

A small RuntimeWarning for PageRank when len(G) * tol >= 2, where the L1 convergence threshold can no longer meaningfully gate iteration.

The change does not alter PageRank results or tolerance semantics; it only surfaces the ineffective-threshold case and adds regression coverage.

@dschult

dschult commented Jul 6, 2026

Copy link
Copy Markdown
Member

I'm iffy on a RuntimeWarning, not because it's not a valid thing to warn about, but because warnings are very often ignored and extra runtime cruft is not necessarily a good thing. I'd propose to stick with documenting this instead. Something like: Note: For large graphs you really need to think about tolerance levels. And then a 1-line description similar to whats in your warning.

@DresdenGman

Copy link
Copy Markdown
Contributor Author

Thanks, that makes sense. I've removed the runtime warning and switched this to a documentation-only note in the public pagerank docstring.

The updated version avoids runtime overhead and keeps the PR focused on documenting the tolerance caveat for large graphs.

I also removed the warning-specific tests since there is no longer a runtime warning behavior to test.

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I took the liberty of reducing the text and moving it to the parameter description, where this is more discoverable.

@DresdenGman

Copy link
Copy Markdown
Contributor Author

Thanks Ross, the parameter-doc placement is much better. Thanks for tightening the wording and for the review.

@dschult
dschult merged commit 472a452 into networkx:main Jul 7, 2026
43 checks passed
@dschult dschult added this to the 3.7 milestone Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants