fix: Add deprecation warnings for inconsistent mode parameter defaults
#2457
+187
−45
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.
The
modeparameter defaults are inconsistent across analysis functions.distances()defaults to"all"(ignoring edge directions) whileshortest_paths()defaults to"out"(respecting directions). For directed graphs,"out"is the more intuitive default.Changes
Added deprecation warnings to 9 functions when
modeis not explicitly specified on directed graphs:distances(),eccentricity(),radius(),graph_center()ego(),ego_size(),make_ego_graph()degree(),strength()Implementation: Used
lifecycle::deprecate_soft()withmissing(mode)detection. Warnings only fire for directed graphs.Test updates: Fixed internal code and tests to explicitly specify
modewhere the old"all"behavior is intended.Documentation: Added breaking change notice to NEWS.md.
Example
This implements step 2 of the migration plan: warn users before changing defaults in a future release.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cran.rstudio.com/opt/R/4.5.1/lib/R/bin/exec/R --no-restore --no-echo --args nextArgigraph_2.2.1.9002.tar.gznextArg--as-crannextArg--timingsnextArg--no-manual(dns block)packagemanager.posit.co/opt/R/4.5.1/lib/R/bin/exec/R --no-restore --no-echo --args nextArgigraph_2.2.1.9002.tar.gznextArg--as-crannextArg--timingsnextArg--no-manual(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>Inconsistent defaults for the 'mode' parameter</issue_title>
<issue_description>Describe the bug
The default value of the common
modeparameter differs from function to function. In some functions it'sout, in others it'sall. This is a usability bug, as it makes igraph unpredictable.To reproduce
In
shortest_paths(), the default isout. In the closely relateddistances(), the default isall.You can use a grep line such as
rg 'mode *= *c\\(.*?\\)'to see many of the defaults.Grep output