Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The changes are well-covered by new/updated tests and only a minor release-note typo remains.
Pull request overview
Updates netrics to v1.0.3 with targeted correctness fixes across heterogeneity measures (homophily/spatial/diversity) and community membership algorithms, aligning computation, metadata, and documentation with intended behavior.
Changes:
- Fixes Moran’s I (
net_by_spatial()) for two-mode networks (projection vs multilevel), missing attributes, and zero-variance/empty-edge cases. - Fixes homophily (
net_by_homophily(),node_by_homophily()) to correctly handle Geary’s C (including weighted ties) and attribute handling within ego subgraphs. - Fixes/extends community memberships:
node_in_partition()stability (best-pass retention) + newstart=option; Leiden defaultresolution=NULL(density-based) and weak-connectivity eligibility for algorithms that treat graphs as undirected.
File summaries
| File | Description |
|---|---|
| tests/testthat/test-member_community.R | Adds/updates regression tests for partition stability, random starts, Leiden resolution defaults, and weak connectivity handling. |
| tests/testthat/test-measure_heterogeneity.R | Adds regression tests for two-mode spatial autocorrelation routing, missing-value handling, Geary’s C labeling/weights, and factor diversity fallback. |
| R/member_community.R | Implements weak-connectivity gating, improves Kernighan–Lin pass behavior, adds start= to node_in_partition(), and updates Leiden default resolution behavior. |
| R/measure_heterogeneity.R | Updates homophily handling (Geary’s C weights + correct ego attribute mapping), enhances net_by_spatial() for two-mode + missing values, and broadens categorical detection for diversity. |
| NEWS.md | Adds v1.0.3 release notes. |
| man/member_community_non.Rd | Documents node_in_partition(start=) and Leiden resolution=NULL default semantics. |
| man/measure_diverse_net.Rd | Documents HHI relationship to Blau’s index and adds citation. |
| man/measure_assort_node.Rd | Documents weighted Geary’s C upper range behavior. |
| man/measure_assort_net.Rd | Documents weighted Geary’s C upper range behavior and expanded spatial autocorrelation behavior notes. |
| DESCRIPTION | Bumps package version to 1.0.3. |
Review details
Files not reviewed (4)
- man/measure_assort_net.Rd: Generated file
- man/measure_assort_node.Rd: Generated file
- man/measure_diverse_net.Rd: Generated file
- man/member_community_non.Rd: Generated file
- Files reviewed: 6/10 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #36 +/- ##
==========================================
+ Coverage 89.25% 90.15% +0.90%
==========================================
Files 30 30
Lines 3620 3657 +37
==========================================
+ Hits 3231 3297 +66
+ Misses 389 360 -29 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Measures
node_by_homophily()issuesnet_by_homophily()discarding tie weights before Geary's Cnet_by_spatial()erroring on a two-mode networknet_by_spatial()propogating missing valuesnet_by_diversity()andnode_by_diversity()erroring on a factor attributeMemberships
node_in_leiden()issuesresolutionnode_in_community(),node_in_spinglass()andnode_in_fluid()treating a weakly connected directed network as unconnected
node_in_partition()returning a split it had already improved uponstart=for a random rather than a node-order initialisation