Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 28, 2025

Functions used inconsistent parameter names for algorithm selection: some used algo, others algorithm, and many used method. This standardizes all algorithm-selection parameters to algorithm.

Changes

Renamed parameters with lifecycle deprecation:

  • algoalgorithm: page_rank(), feedback_arc_set(), feedback_vertex_set()
  • methodalgorithm: sample_tree(), sample_degseq(), realize_degseq(), realize_bipartite_degseq()

Preserved method for non-algorithm parameters:

  • Comparison methods: compare(), similarity()
  • Isomorphism methods: isomorphic(), subgraph_isomorphic()
  • Layout methods: layout.merge(), merge_coords()

Implementation:

  • Updated Stimulus YAML configuration for code generation
  • Added workaround for Stimulus parameter renaming in DEPS-based conditionals
  • Regenerated R/aaa-auto.R and src/rinterface.c

Example

# New (recommended)
page_rank(g, algorithm = "prpack")
sample_tree(100, algorithm = "lerw")
sample_degseq(degs, algorithm = "configuration")

# Old (deprecated, but still works)
page_rank(g, algo = "prpack")  # Warning: use `algorithm` instead
sample_tree(100, method = "lerw")  # Warning: use `algorithm` instead

Backward Compatibility

Old parameter names continue to work with soft deprecation warnings via lifecycle::deprecate_warn().

Original prompt

This section details on the original issue you should resolve

<issue_title>Consistency in parameter names: algo vs algorithm vs method</issue_title>
<issue_description>At this moment, some functions use algorithm as a parameter names (e.g. shortest_paths, sample_pa, etc.), some others use algo (e.g. page_rank, feedback_arc_set, etc.), and yet others use method (e.g. sample_degseq, sample_tree, etc.). The naming should be made consistent across functions.</issue_description>

Comments on the Issue (you are @copilot in this section)

@maelle Relevant lifecycle doc: https://lifecycle.r-lib.org/articles/communicate.html#renaming-an-argument

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits October 28, 2025 22:33
- Changed `algo` → `algorithm` in page_rank, feedback_arc_set, feedback_vertex_set
- Changed `method` → `algorithm` in sample_tree, sample_degseq, realize_degseq, realize_bipartite_degseq
- Added deprecation warnings for old parameter names using lifecycle
- Updated Stimulus YAML configuration to rename parameters in generated code
- Updated documentation and examples to use new parameter names
- Regenerated aaa-auto.R and rinterface.c with Stimulus

Co-authored-by: krlmlr <[email protected]>
…initialization

- Fixed DEPS references to use C parameter names for correct C code generation
- Added options initialization logic to page_rank wrapper to work around Stimulus bug
- Regenerated src/rinterface.c to fix c_algorithm/c_algo references
- All functions now work correctly with new 'algorithm' parameter
- Deprecated parameters ('algo', 'method') work with proper warnings

Co-authored-by: krlmlr <[email protected]>
- Updated games test snapshots to include new deprecation warnings
- All tests now pass with new parameter names

Co-authored-by: krlmlr <[email protected]>
Copilot AI changed the title [WIP] Refactor parameter names for consistency across functions Standardize algorithm parameter names from algo/method to algorithm Oct 28, 2025
Copilot AI requested a review from krlmlr October 28, 2025 22:46
Copilot finished work on behalf of krlmlr October 28, 2025 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consistency in parameter names: algo vs algorithm vs method

2 participants