Repository navigation
53 rich club - #157
Open
eriknw wants to merge 1 commit into
Open
53 rich club#157eriknw wants to merge 1 commit into
eriknw wants to merge 1 commit into
Conversation
The coefficient at degree k is 2 * E_k / (N_k * (N_k - 1)), where N_k is the number of nodes of degree above k and E_k the number of edges among them, for each k from 0 while N_k is at least 2, as NetworkX gives it. An edge counts while k is below the lower degree of its two ends, so histograms of the degrees and of each edge's lower end degree give every N_k and E_k by suffix sums, in time linear in the edges. The default, normalized=True, divides by the coefficients of graphs rewired with random double-edge swaps and is left to NetworkX, so only calls with normalized=False are answered here. A self-loop raises NetworkX's own exception. A seed is left to NetworkX too. It changes nothing without normalization, but NetworkX 3.7 and later check it all the same and raise ValueError for one that cannot seed a generator, where 3.6 does not. On a NetworkX before 3.7, which has no n_samples, a call with it is left to NetworkX, whose own function raises TypeError for it, as for the other keywords newer than 3.6.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 61-generic-declines #157 +/- ##
=======================================================
+ Coverage 92.90% 92.99% +0.09%
=======================================================
Files 182 185 +3
Lines 11294 11483 +189
Branches 1281 1290 +9
=======================================================
+ Hits 10493 10679 +186
- Misses 547 549 +2
- Partials 254 255 +1 🚀 New features to boost your workflow:
|
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
rich_club_coefficient, answered fornormalized=False. The coefficient at degree k is 2 * E_k / (N_k * (N_k - 1)), where N_k is the number of nodes of degree above k and E_k the number of edges among them. NetworkX's default,normalized=True, divides each value by the coefficient of a copy rewired with random double-edge swaps drawn fromseed. That is left to NetworkX, and so is any call with aseed, so only calls that passnormalized=Falseexplicitly, without a seed, are answered here. A declined call goes to NetworkX under backend priority.{}.normalized, such as 0 or None, is answered, since NetworkX tests it withif normalized.Qand 3.7'sn_sampleschange nothing without normalization, as in NetworkX, wheren_samples=0is refused only withnormalized=True.seedchanges nothing without normalization either, but NetworkX 3.7 and later check it all the same:seed="junk", 1.5 or[1]raise ValueError there, and 3.6 does not check it. A call with a seed is declined, so that each NetworkX checks its own.n_samples, which NetworkX added in 3.7, joins the newer keywords of 61, which are declined where the installed NetworkX lacks them. On 3.6 a call with it was answered here, where NetworkX's own function raises TypeError for it, and now NetworkX raises that error. Its row is added to that rule's test.NetworkXNotImplementedin NetworkX before dispatch, and a directed graph of this backend raises the same. A self-loop raises NetworkX's plainException, "rich_club_coefficient is not implemented for graphs with self loops.".Stacked on #156.