Repository navigation
ENH: add normalize option for subgraph_centrality and its _exp version - #8340
Merged
Merged
Conversation
amcandio
reviewed
Nov 9, 2025
| G: graph | ||
| normalized : bool | ||
| If True, normalize the centrality values using the largest eigenvalue of the | ||
| adjacency matrix so that the centrality values are generally between 0 and 1. |
Contributor
There was a problem hiding this comment.
What does "generally" mean here? Is there a case where they are not between 0 and 1?
Contributor
There was a problem hiding this comment.
I'm assuming "generally" is here to account for precision issues. Wording LGTM!
Member
Author
There was a problem hiding this comment.
Yes -- it is not clear to me that the choice of normalization will keep the values between 0 and 1. Round-off and other issues might creep in -- but might not. And I haven't looked at that issue closely -- hopefully not worth the time. So I added the word "generally" to hedge my words slightly.
rossbar
approved these changes
Nov 10, 2025
| G: graph | ||
| normalized : bool | ||
| If True, normalize the centrality values using the largest eigenvalue of the | ||
| adjacency matrix so that the centrality values are generally between 0 and 1. |
Contributor
There was a problem hiding this comment.
I'm assuming "generally" is here to account for precision issues. Wording LGTM!
Contributor
|
LGTM! |
amcandio
approved these changes
Nov 11, 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.
Add normalize keyword-only arg for subgraph_centrality and _exp version see #1243
This has been around a LONG time. Not sure if anyone needs subgraph_centrality to be normalized or maybe they are doing it on their own. But it unifies the API between centralities a little. Default value is
Falsefor backward compatibility.Tests are added in the doc_strings. Nothing fancy here so I didn't add any others to the test suite.
Fixes #1243