Skip to content

refactor: move optional arguments of community functions behind the ellipsis#2765

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

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

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 9 exported community 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/community.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
cluster_edge_betweenness() graph weights, directed, edge.betweenness, merges, bridges, modularity, membership
cluster_fast_greedy() graph merges, modularity, membership, weights
cluster_infomap() graph e.weights, v.weights, nb.trials, modularity
cluster_louvain() graph weights, resolution
cluster_optimal() graph weights
cluster_spinglass() graph weights, vertex, spins, parupdate, start.temp, stop.temp, cool.fact, update.rule, gamma, implementation, gamma.minus
cluster_walktrap() graph weights, steps, merges, modularity, membership
make_clusters() graph, membership algorithm, merges, modularity
modularity_matrix() graph, membership weights, resolution, directed

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-community branch 2 times, most recently from 781bd62 to 93936d7 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 93936d7 is merged into main:

  • ✔️as_adjacency_matrix: 828ms -> 827ms [-1.11%, +1.07%]
  • ✔️as_biadjacency_matrix: 793ms -> 792ms [-0.78%, +0.55%]
  • ✔️as_data_frame_both: 1.61ms -> 1.62ms [-1.57%, +3.04%]
  • ✔️as_long_data_frame: 4.18ms -> 4.19ms [-2.87%, +3.41%]
  • ✔️es_attr_filter: 2.96ms -> 2.88ms [-6%, +0.18%]
  • ✔️graph_from_adjacency_matrix: 126ms -> 125ms [-1.49%, +0.71%]
  • ✔️graph_from_data_frame: 3.53ms -> 3.51ms [-2.13%, +0.99%]
  • ✔️vs_attr_filter: 1.68ms -> 1.67ms [-3.06%, +1.57%]
  • ✔️vs_by_name: 1.07ms -> 1.07ms [-2.78%, +2.84%]
    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
…llipsis

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

Functions: cluster_edge_betweenness, cluster_fast_greedy, cluster_infomap, cluster_louvain, cluster_optimal, cluster_spinglass, cluster_walktrap, make_clusters, modularity_matrix

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
@krlmlr
krlmlr force-pushed the claude/ellipsis-community branch from 93936d7 to d9a5291 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 d9a5291 is merged into main:

  • ❗🐌as_adjacency_matrix: 783ms -> 790ms [+0.08%, +1.67%]
  • ✔️as_biadjacency_matrix: 760ms -> 756ms [-1.38%, +0.36%]
  • ✔️as_data_frame_both: 1.61ms -> 1.56ms [-9.92%, +4.29%]
  • ❗🐌as_long_data_frame: 3.91ms -> 3.97ms [+0.28%, +2.64%]
  • ✔️es_attr_filter: 2.82ms -> 2.75ms [-6.77%, +2.28%]
  • ✔️graph_from_adjacency_matrix: 123ms -> 122ms [-1.55%, +0.25%]
  • ✔️graph_from_data_frame: 3.39ms -> 3.37ms [-1.74%, +0.62%]
  • ✔️vs_attr_filter: 1.58ms -> 1.56ms [-3.22%, +0.88%]
  • ✔️vs_by_name: 1ms -> 1.02ms [-0.83%, +4.8%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

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