Skip to content

refactor: move optional arguments of centrality functions behind the ellipsis#2763

Merged
krlmlr merged 1 commit into
mainfrom
claude/ellipsis-centrality
Jul 26, 2026
Merged

refactor: move optional arguments of centrality functions behind the ellipsis#2763
krlmlr merged 1 commit into
mainfrom
claude/ellipsis-centrality

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 10 exported centrality 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/centrality.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
alpha_centrality() graph, nodes alpha, loops, exo, weights, tol, sparse
betweenness() graph, v directed, weights, normalized, cutoff
closeness() graph, vids mode, weights, normalized, cutoff
diversity() graph weights, vids
edge_betweenness() graph, e directed, weights, cutoff
harmonic_centrality() graph, vids mode, weights, normalized, cutoff
page_rank() graph algo, vids, directed, damping, personalized, weights, options
power_centrality() graph, nodes loops, exponent, rescale, tol, sparse, weights
strength() graph, vids mode, loops, weights
subgraph_centrality() graph diag

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-centrality branch 2 times, most recently from 1f0b69d to e36651f Compare July 26, 2026 11:09
@github-actions

Copy link
Copy Markdown
Contributor

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

  • ✔️as_adjacency_matrix: 768ms -> 775ms [-0.16%, +1.85%]
  • ✔️as_biadjacency_matrix: 773ms -> 775ms [-0.93%, +1.56%]
  • ✔️as_data_frame_both: 1.56ms -> 1.58ms [-1.21%, +4.25%]
  • ✔️as_long_data_frame: 4.01ms -> 4.03ms [-1.53%, +2.39%]
  • ✔️es_attr_filter: 2.87ms -> 2.85ms [-8.26%, +6.32%]
  • ✔️graph_from_adjacency_matrix: 120ms -> 120ms [-0.83%, +1.37%]
  • ✔️graph_from_data_frame: 3.42ms -> 3.41ms [-1.7%, +1.46%]
  • ✔️vs_attr_filter: 1.65ms -> 1.62ms [-3.81%, +0.58%]
  • ✔️vs_by_name: 1.03ms -> 1.02ms [-3.2%, +1.82%]
    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
…ellipsis

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

Functions: alpha_centrality, betweenness, closeness, diversity, edge_betweenness, harmonic_centrality, page_rank, power_centrality, strength, subgraph_centrality

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
@krlmlr
krlmlr force-pushed the claude/ellipsis-centrality branch from e36651f to 561954e Compare July 26, 2026 16:23
@github-actions

Copy link
Copy Markdown
Contributor

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

  • ✔️as_adjacency_matrix: 886ms -> 885ms [-1.32%, +0.95%]
  • ✔️as_biadjacency_matrix: 855ms -> 852ms [-1.79%, +1.04%]
  • ✔️as_data_frame_both: 1.76ms -> 1.74ms [-2.42%, +0.37%]
  • ✔️as_long_data_frame: 4.61ms -> 4.6ms [-2.06%, +1.9%]
  • ✔️es_attr_filter: 3.19ms -> 3.12ms [-4.65%, +0.59%]
  • ✔️graph_from_adjacency_matrix: 133ms -> 133ms [-1.58%, +1.33%]
  • ✔️graph_from_data_frame: 3.74ms -> 3.74ms [-1.79%, +1.9%]
  • ✔️vs_attr_filter: 1.82ms -> 1.77ms [-5.89%, +0.84%]
  • ✔️vs_by_name: 1.19ms -> 1.19ms [-1.81%, +2.7%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@krlmlr
krlmlr merged commit 2ac85dc into main Jul 26, 2026
9 checks passed
@krlmlr
krlmlr deleted the claude/ellipsis-centrality branch July 26, 2026 19:10
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