Conversation
…ead of `fict_marvel`
…e_in_spinglass()` specifically
There was a problem hiding this comment.
🟡 Changes recommended
Some tests call internal helpers (.to_positive()/.to_unsigned()) unqualified (will fail under R CMD check), and there is also a redundant .to_unsigned() call in net_by_eigenvector().
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Release bump to netrics 1.0.2, focusing on making marks/measures/memberships robust to signed and multilevel network shapes (per stocnet/manynet conventions), adding guardrails for exponential-time cohesion measures, and aligning tests/docs with updated {manynet} behavior.
Changes:
- Added/updated signed-network handling: distance-based functions drop to positive ties (
.to_positive()), while census/structural-style functions read ties by magnitude (.to_unsigned()), with corresponding documentation updates. - Improved multilevel handling by avoiding invalid two-mode projections (or stopping with clearer errors where no single-layer ideal applies).
- Added test coverage for previously failing shapes and introduced
limit=guards fornet_by_strength()/net_by_toughness()to prevent hangs on larger networks.
File summaries
| File | Description |
|---|---|
| tests/testthat/test-shapes.R | New regression sweep for signed + multilevel input shapes (node/tie/net/mode). |
| tests/testthat/test-member_equivalence.R | Asserts expected snet warning behavior for degenerate regular equivalence. |
| tests/testthat/test-member_community.R | Updates tests to accept warning/message behavior changes in snet output. |
| tests/testthat/test-measure_nodes.R | Adjusts node-measure sweep to account for signed eccentricity guard + eigenvector warnings. |
| tests/testthat/test-measure_net.R | Muffles expected eigenvector warnings in net-measure sweep. |
| tests/testthat/test-measure_heterogeneity.R | Adds test that net_by_spatial() errors clearly on non-numeric attributes. |
| tests/testthat/test-measure_cohesion.R | Adds tests for limit= guard behavior on exponential measures. |
| tests/testthat/test-mark_ties.R | Adds tests for tie_is_max/min() numeric vectors + improved argument errors. |
| tests/testthat/helper-netrics.R | Adds helpers to normalize snet warn/abort signaling across {manynet} versions. |
| R/netrics-utils.R | Removes retired compatibility shims; adds .to_unsigned() helper; keeps .to_positive() and .is_multilevel(). |
| R/motif_census.R | Applies .to_positive() for node_x_path() on signed networks + documents behavior. |
| R/method_coreness.R | Treats multilevel networks as one-mode (avoids incorrect two-mode handling). |
| R/member_community.R | Restricts signed networks to spinglass; adds clearer “no algorithm available” abort path; avoids node_in_optimal() shortcut when signed. |
| R/measure_holes.R | Avoids projection for multilevel networks in structural hole measures. |
| R/measure_hierarchy.R | Applies .to_positive() for signed networks and documents rationale. |
| R/measure_heterogeneity.R | Replaces stopifnot(is.numeric) with clear snet_abort() message for net_by_spatial(). |
| R/measure_features.R | Stops net_by_core/factions() on multilevel networks; applies .to_unsigned() for signed modularity. |
| R/measure_cohesion.R | Adds .check_enumerable() and limit= param to guard exponential-time measures; updates examples to use fict_greys. |
| R/measure_change.R | Drops .net_waves() shim and relies on {manynet} floor behavior. |
| R/measure_centrality_eigen.R | Reads signed ties by magnitude for eigen-family; treats multilevel as non-projectable; removes retired to_ties() shim usage. |
| R/measure_centrality_degree.R | Replaces retired .to_linegraph() shim with manynet::to_linegraph(). |
| R/measure_centrality_closeness.R | Applies .to_positive() for signed distance-based centrality/centralization functions + docs. |
| R/measure_centrality_between.R | Applies .to_positive() for signed betweenness centrality/centralization; uses .to_unsigned() for tie betweenness. |
| R/mark_ties.R | Improves tie_is_path() missing-arg error; applies .to_unsigned() for signed triangle marks; adds input-type guard for tie_is_max/min(). |
| R/mark_nodes.R | Applies .to_positive() for node_is_fold(); avoids projection for multilevel node_is_independent(); adds signed/multilevel docs. |
| NEWS.md | Adds release notes for 1.0.2. |
| man/motif_path.Rd | Documents signed-network behavior for node_x_path(). |
| man/method_coreness.Rd | Documents multilevel-network behavior for coreness methods. |
| man/member_community.Rd | Documents signed-network behavior/limitations for node_in_community(). |
| man/measure_hierarchy.Rd | Documents signed-network behavior for hierarchy measures. |
| man/measure_fragmentation.Rd | Documents limit= and enumeration cost; updates examples. |
| man/measure_fit.Rd | Documents signed modularity magnitude-reading; multilevel stops for core/factions. |
| man/measure_centralisation_close.Rd | Documents signed-network behavior for closeness centralization. |
| man/measure_centralisation_between.Rd | Documents signed-network behavior for betweenness centralization. |
| man/measure_central_tie_between.Rd | Documents signed-network magnitude-reading for tie betweenness. |
| man/measure_central_eigen.Rd | Documents signed magnitude-reading + multilevel non-projection for eigen measures. |
| man/measure_central_close.Rd | Documents signed-network behavior for closeness centrality. |
| man/measure_central_between.Rd | Documents signed-network behavior for betweenness centrality. |
| man/measure_broker_node.Rd | Documents multilevel non-projection behavior for broker node measures. |
| man/mark_triangles.Rd | Documents signed-network behavior for triangle marks. |
| man/mark_select_tie.Rd | Documents tie_is_max/min() accepting numeric vectors. |
| man/mark_nodes.Rd | Documents signed + multilevel behavior for node marks touched here. |
| DESCRIPTION | Bumps version to 1.0.2 and raises {manynet} dependency floor to 2.3.1. |
| .github/CONTRIBUTING.md | Extends “Input shapes” guidance, including .to_unsigned() convention for signed networks. |
Review details
Files not reviewed (11)
- man/mark_nodes.Rd: Generated file
- man/mark_select_tie.Rd: Generated file
- man/mark_triangles.Rd: Generated file
- man/measure_broker_node.Rd: Generated file
- man/measure_central_between.Rd: Generated file
- man/measure_central_close.Rd: Generated file
- man/measure_central_eigen.Rd: Generated file
- man/measure_central_tie_between.Rd: Generated file
- man/measure_centralisation_between.Rd: Generated file
- man/measure_centralisation_close.Rd: Generated file
- man/measure_fit.Rd: Generated file
Suppressed comments (1)
tests/testthat/test-shapes.R:102
- These calls to
.to_positive()/.to_unsigned()are unqualified internal helpers, which won’t be visible when tests run against an installed build. Qualify them withnetrics:::(or retrieve from the namespace) so the test file works inR CMD check.
- Files reviewed: 33/44 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } else if(grepl("eccentricity", fn) && | ||
| !manynet::is_connected(.to_positive(data_objs[[ob]]))){ | ||
| # An eccentricity is the distance to the furthest node, which is not |
| test_that(".to_positive() and .to_unsigned() each keep every node", { | ||
| pos <- .to_positive(signed_multilevel) | ||
| uns <- .to_unsigned(signed_multilevel) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #35 +/- ##
==========================================
+ Coverage 88.67% 89.25% +0.57%
==========================================
Files 30 30
Lines 3533 3620 +87
==========================================
+ Hits 3133 3231 +98
+ Misses 400 389 -11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Package
{manynet}floor to 2.3.1, retiringto_ties()andnet_waves()shimsMarks
node_is_fold()erroring on signed networks (closes Fourteen functions still error on networks holding signs as negative weights #25)node_is_independent()andnode_is_core()erroring on multilevel networks (closes Six further failures on multilevel networks #26)tie_is_transitive(),tie_is_triplet()andtie_is_cyclical()erroring on signed networks (closes Fourteen functions still error on networks holding signs as negative weights #25)tie_is_max()andtie_is_min()to accept a numeric vector, and to name what they marktie_is_path()to namefromandtowhere either is missing (closes Six further failures on multilevel networks #26)Measures
node_by_closeness(),node_by_harmonic(),node_by_reach(),node_by_decay(),node_by_integration(),node_by_radiality(),node_by_eccentricity(),node_by_vitality(),node_by_betweenness(),node_by_induced(),node_x_path()net_by_closeness(),net_by_betweenness(),net_by_connectedness(),net_by_reach(),net_by_harmonic(),net_by_decay(),net_by_integration()mode_by_closeness(),mode_by_betweenness()tie_by_betweenness()erroring on signed networks, which reads each tie by its magnitude so that every tie keeps a value (closes Fourteen functions still error on networks holding signs as negative weights #25)net_by_modularity()erroring on signed networks (closes Fourteen functions still error on networks holding signs as negative weights #25)net_by_core()andnet_by_factions()to stop with a clear message on a multilevel network, since acreate_*()ideal covers one layer (closes Six further failures on multilevel networks #26)net_by_spatial()to name a non-numeric attribute (closes Six further failures on multilevel networks #26)limit=tonet_by_strength()andnet_by_toughness(), which take a minimum over 2^n subsets and so hang above about twenty nodes or ties (closes net_by_strength() and net_by_toughness() enumerate 2^n subsets, so they hang or abort above about twenty nodes #34)fict_greysinstead offict_marvelMemberships
node_in_community()erroring on signed networks, which now considers onlynode_in_spinglass()(closes Fourteen functions still error on networks holding signs as negative weights #25)node_in_core()andnode_by_core()returning two values per node on multilevel networks (closes Six further failures on multilevel networks #26)Methods
coreness_rich()reading a multilevel network as a plain two-mode one (closes Six further failures on multilevel networks #26)