Repository navigation
Conversation
cn_soundarajan_hopcroft, ra_index_soundarajan_hopcroft and within_inter_cluster read each node's community, and the conversion refused node attributes for them, so they always fell back. It now carries the community for them as it does for the attribute mixing names. The scores come from products masked to the pairs: the common neighbors over the adjacency, and those in the pair's community over the edges within communities, weighted by 1 / degree for the resource allocation index. The counts, and within_inter_cluster's ratios, are NetworkX's exactly; the resource allocation sums are added in another order, so within rounding. The triples come in NetworkX's order, and a node without the community raises NetworkXAlgorithmError when the pair that looks it up is reached, as there. Where two or more common neighbors of that pair lack it, NetworkX names the first in its sets' order, which a matrix does not keep, so such a call is left to it; so are community values other than plain Python ones, whose `==` may not be a dict's.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 31-node-attrs #162 +/- ##
=================================================
+ Coverage 93.73% 93.94% +0.21%
=================================================
Files 196 197 +1
Lines 13062 13536 +474
Branches 1522 1581 +59
=================================================
+ Hits 12244 12717 +473
Misses 560 560
- Partials 258 259 +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
cn_soundarajan_hopcroft,ra_index_soundarajan_hopcroftandwithin_inter_cluster. They read each node's community, which the conversion now carries for them as it does for the attribute mixing names (#130); before, it refused, and they always fell back. The scores come from products masked to the pairs: the common neighbors over the adjacency, and those in the pair's community over the edges within communities, weighted by 1 / degree for the resource allocation index.sum, so a score may differ in its last bits (relative 4.5e-16 at most on the random graphs below, and 1.3e-15 with up to 369 common neighbors). NetworkX's int 0, for a pair of two communities or an empty sum, stays an int. A node whose community is NaN is in no community, not even its own, as NetworkX's==finds.ebunchand for every non-edge.delta <= 0raises NetworkXAlgorithmError on the call, beforeebunchis checked. A node ofebunchthat is not in the graph raises NodeNotFound on the call, and an iteratorebunchis used up by that check, so nothing is scored. A node without the community raises NetworkXAlgorithmError ("No community information available for Node u", from a KeyError) only when the generator reaches the first pair that looks it up: NetworkX looks upu, thenv, and the common neighbors only whereuandvare of one community. The triples before that pair are yielded, and the node is named as the caller wrote it.==may differ from how a dict keys it, and NumPy's may raise (np.bool_(True) == 2**70raises OverflowError inside NetworkX's generator). Adeltaother than a Python float or an int below 2**52 (NetworkX adds an int exactly). And, as for the mixing names, acommunitythat is None, callable or unhashable, and a graph class with its ownadjacencyornodes.ebunchare scored in one masked product, so memory follows the caller's list, and every non-edge is scored a node at a time, as NetworkX hands them out. Reading every non-edge of a 3000-node graph (4.5e6 pairs) peaks at 117 MiB, and of a 6000-node graph (1.8e7 pairs) at 129 MiB (NetworkX: 59 and 66 MiB; the difference is GraphBLAS and the conversion).G.nodes[u]["community"] = c) empties no NetworkX cache, so withcache_converted_graphson, a cached conversion keeps the old value, as for the mixing names._predicttakes acheckrun on the call, andnode_attribute_rulethe name of the parameter that names the attribute.delta's values and types, theebunchchecks and containers, small graphs, views, a conversion cached for another name, and direct calls. 32 mutants of the kernel, the wrappers and the attribute rule each fail them, in NetworkX dev, 3.7 and 3.6.1.test_link_prediction.py) through the backend in dev, 3.7 and 3.6.1: the same 97 pass before and after, with 34 community calls served in each.Stacked on #130.