Skip to content

refactor: move optional arguments of similarity-efficiency functions behind the ellipsis#2776

Open
krlmlr wants to merge 2 commits into
mainfrom
claude/ellipsis-similarity-efficiency
Open

refactor: move optional arguments of similarity-efficiency functions behind the ellipsis#2776
krlmlr wants to merge 2 commits into
mainfrom
claude/ellipsis-similarity-efficiency

Conversation

@krlmlr

@krlmlr krlmlr commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Part of the repo-wide ellipsis migration coordinated in #2757
see that PR for the full rationale (CONTRIBUTING.md, Argument Order and the Ellipsis).
Based directly on main (the registry split landed via #2779); a single topic commit.

What this does

Inserts ... between the defining arguments (head) and the optional
modifiers
(tail) of 6 exported similarity-efficiency functions.
Arguments after ... become keyword-only.

  • Legacy positional or abbreviated calls are recovered by the generated
    ARG_HANDLE block and emit a single lifecycle::deprecate_soft("3.0.0", …)
    behavior is unchanged.
  • No defaults change, no arguments are renamed, deprecated functions untouched.
  • Registry: tools/migrations/similarity-efficiency.R; blocks regenerated via
    Rscript tools/generate-migrations.R (idempotent, CI-checked).
  • Rd usage/arguments updated mechanically (see note below).

New signatures

function head (positional) keyword-only tail
assortativity_degree() graph directed
assortativity_nominal() graph, types directed, normalized
average_local_efficiency() graph weights, directed, mode
global_efficiency() graph weights, directed
local_efficiency() graph, vids weights, directed, mode
similarity() graph, vids mode, loops, method

Notes for review

  • The environment used to prepare this PR cannot install igraph.r2cdocs
    (GitHub API unreachable), so man/*.Rd files were updated mechanically
    (usage + ... argument item) instead of via devtools::document().
    R CMD check's usage↔formals validation passes; a follow-up
    devtools::document() run may reflow whitespace but should produce no
    semantic diff.
  • Package tests that called these functions positionally were updated to
    named arguments (they are the same soft-deprecation user code will see).

@krlmlr
krlmlr force-pushed the claude/ellipsis-similarity-efficiency branch from a0f8904 to 752e97a Compare July 26, 2026 10:52
@github-actions

Copy link
Copy Markdown
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 752e97a is merged into main:

  • ✔️as_adjacency_matrix: 778ms -> 784ms [-0.97%, +2.46%]
  • ✔️as_biadjacency_matrix: 743ms -> 745ms [-0.45%, +1.04%]
  • ✔️as_data_frame_both: 1.54ms -> 1.56ms [-2.01%, +4.65%]
  • ✔️as_long_data_frame: 4.19ms -> 4.24ms [-1.9%, +4.04%]
  • ✔️es_attr_filter: 2.66ms -> 2.68ms [-0.17%, +1.57%]
  • ✔️graph_from_adjacency_matrix: 120ms -> 119ms [-1.58%, +0.92%]
  • ✔️graph_from_data_frame: 3.45ms -> 3.42ms [-2.65%, +1.16%]
  • ✔️vs_attr_filter: 1.52ms -> 1.52ms [-1.21%, +1.44%]
  • ✔️vs_by_name: 975µs -> 963µs [-2.39%, 0%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@krlmlr
krlmlr marked this pull request as ready for review July 26, 2026 15:03
@krlmlr krlmlr closed this Jul 26, 2026
@krlmlr
krlmlr force-pushed the claude/ellipsis-similarity-efficiency branch from 752e97a to 0f7d122 Compare July 26, 2026 16:24
…behind the ellipsis

Insert `...` between the defining arguments and the optional
modifiers of 6 functions,
following the zoning rules in CONTRIBUTING.md.
Legacy positional and abbreviated calls are recovered
by the generated ARG_HANDLE blocks
(registry: tools/migrations/similarity-efficiency.R)
and emit a single soft deprecation for igraph 3.0.0.
No defaults change and no arguments are renamed.

Functions: assortativity_degree, assortativity_nominal, average_local_efficiency, global_efficiency, local_efficiency, similarity

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
@krlmlr krlmlr reopened this Jul 26, 2026
Same fix as #2781: the migration rewriter collapsed multi-line enum
defaults and air skips c() calls, so restore the original layout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
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.

2 participants