Skip to content

refactor: move optional arguments of hrg-embedding functions behind the ellipsis - #2771

Merged
krlmlr merged 2 commits into
mainfrom
claude/ellipsis-hrg-embedding
Jul 27, 2026
Merged

refactor: move optional arguments of hrg-embedding functions behind the ellipsis#2771
krlmlr merged 2 commits into
mainfrom
claude/ellipsis-hrg-embedding

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 7 exported hrg-embedding 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/hrg-embedding.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
embed_adjacency_matrix() graph, no weights, which, scaled, cvec, options
embed_laplacian_matrix() graph, no weights, which, type, scaled, options
sample_sphere_surface() dim, n radius, positive
sample_sphere_volume() dim, n radius, positive
consensus_tree() graph, hrg start, num.samples
fit_hrg() graph, hrg start, steps
predict_edges() graph, hrg start, num.samples, num.bins

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-hrg-embedding branch 2 times, most recently from 60af603 to fb2efa0 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 fb2efa0 is merged into main:

  • ✔️as_adjacency_matrix: 736ms -> 738ms [-0.46%, +1.15%]
  • ✔️as_biadjacency_matrix: 717ms -> 718ms [-0.67%, +0.83%]
  • ✔️as_data_frame_both: 1.44ms -> 1.42ms [-3.14%, +0.47%]
  • ✔️as_long_data_frame: 3.82ms -> 3.78ms [-2.49%, +0.16%]
  • ✔️es_attr_filter: 2.6ms -> 2.6ms [-1.98%, +2.28%]
  • ✔️graph_from_adjacency_matrix: 115ms -> 114ms [-1.83%, +0.63%]
  • ✔️graph_from_data_frame: 3.24ms -> 3.24ms [-1.41%, +1.39%]
  • ✔️vs_attr_filter: 1.43ms -> 1.46ms [-0.71%, +4.34%]
  • ✔️vs_by_name: 930µs -> 933µs [-1.46%, +2.03%]
    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 force-pushed the claude/ellipsis-hrg-embedding branch 2 times, most recently from 82f8f7e to e4cbbc2 Compare July 26, 2026 15:20
@github-actions

Copy link
Copy Markdown
Contributor

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

  • ✔️as_adjacency_matrix: 800ms -> 806ms [-1.17%, +2.54%]
  • ✔️as_biadjacency_matrix: 732ms -> 730ms [-1.13%, +0.59%]
  • ✔️as_data_frame_both: 1.57ms -> 1.57ms [-1.79%, +1.61%]
  • ✔️as_long_data_frame: 3.98ms -> 3.95ms [-2.03%, +0.73%]
  • ✔️es_attr_filter: 2.84ms -> 2.81ms [-2.69%, +0.63%]
  • ✔️graph_from_adjacency_matrix: 145ms -> 146ms [-1.64%, +1.83%]
  • ✔️graph_from_data_frame: 3.5ms -> 3.51ms [-2.08%, +2.2%]
  • ✔️vs_attr_filter: 1.58ms -> 1.58ms [-4.38%, +4.2%]
  • ✔️vs_by_name: 1.02ms -> 1.03ms [-1.21%, +3.16%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@krlmlr krlmlr closed this Jul 26, 2026
@krlmlr
krlmlr force-pushed the claude/ellipsis-hrg-embedding branch from e4cbbc2 to 0f7d122 Compare July 26, 2026 16:24
…he ellipsis

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

Functions: consensus_tree, embed_adjacency_matrix, embed_laplacian_matrix, fit_hrg, predict_edges, sample_sphere_surface, sample_sphere_volume

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
@krlmlr krlmlr reopened this Jul 26, 2026
Add an "ellipsis migration: argument coverage" section to test-hrg.R and
test-embedding.R exercising the keyword-only tail arguments and the legacy
positional recovery path (with its deprecation warning) for the seven
migrated functions: fit_hrg(), consensus_tree(), predict_edges(),
embed_adjacency_matrix(), embed_laplacian_matrix(), sample_sphere_surface(),
and sample_sphere_volume().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
@github-actions

Copy link
Copy Markdown
Contributor

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

  • ✔️as_adjacency_matrix: 897ms -> 892ms [-2.12%, +0.95%]
  • ✔️as_biadjacency_matrix: 845ms -> 840ms [-1.9%, +0.89%]
  • ✔️as_data_frame_both: 1.79ms -> 1.75ms [-5.34%, +0.13%]
  • ✔️as_long_data_frame: 4.63ms -> 4.56ms [-4.35%, +1.34%]
  • ✔️es_attr_filter: 3.02ms -> 2.96ms [-4.82%, +0.9%]
  • ✔️graph_from_adjacency_matrix: 143ms -> 141ms [-3.39%, +0.85%]
  • ✔️graph_from_data_frame: 3.83ms -> 3.8ms [-2.92%, +1.17%]
  • ✔️vs_attr_filter: 1.73ms -> 1.72ms [-3.17%, +1.11%]
  • 🚀vs_by_name: 1.11ms -> 1.09ms [-4.65%, -0.08%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@krlmlr
krlmlr merged commit cc3ced5 into main Jul 27, 2026
9 checks passed
@krlmlr
krlmlr deleted the claude/ellipsis-hrg-embedding branch July 27, 2026 17:51
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