Skip to content

refactor: snake_case the dotted arguments of the graph generators and degree-sequence functions - #2946

Merged
schochastics merged 31 commits into
claude/issue-2788-subagents-faw1t1-9from
claude/issue-2788-subagents-faw1t1-10
Dec 3, 2026
Merged

schochastics merged 31 commits into
claude/issue-2788-subagents-faw1t1-9from
claude/issue-2788-subagents-faw1t1-10

Conversation

@schochastics

@schochastics schochastics commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2788 (PR 10 of the stack, on top of #2945). It is the first part of the snake_case sweep ("underscores everywhere", krlmlr's comments listing no.sim, column.wise, cut.prob, sample.size, …), covering the generators in R/games.R, realize_*degseq() in R/make.R, and is_degseq()/is_graphical() in R/degseq.R.

Naming rule

Dots become underscores (pref.matrix → pref_matrix, out.deg → out_deg). Count prefixes follow the n convention from #2860 instead of a literal translation:

  • no.of.nodes → n (sample_k_regular(), sample_fitness_pl())
  • no.of.edges → n_edges (sample_fitness(), sample_fitness_pl())
  • islands.n → n_islands (sample_islands())

What this does

87 renames across 28 functions (spec twins such as pa()/pref()/sbm() included):

  • 52 tail arguments with a registry entry: pure registry renames, recovered under the standard single soft-deprecation.
  • 35 head arguments, or arguments of functions without a registry entry (e.g. sample_degseq(out.deg, in.deg), sample_sbm(pref.matrix, block.sizes), all four sample_islands() arguments, sample_pa_age(pa.exp, aging.exp)): they keep their position, so positional calls are unchanged. The dotted names stay as trailing deprecated() formals, and the registry records the head renames, so the generated block handles them (see refactor: Rename algo to algorithm in page_rank(), feedback_arc_set() and feedback_vertex_set() #2859; new entries for chung_lu()/sample_chung_lu(), sample_islands() and is_degseq()). A call that names a dotted argument is matched again against the pre-3.0.0 signature, so positional values after it keep their old meaning. realize_bipartite_degseq(allowed.edge.types) has no registry entry and keeps a hand-written bridge.
  • The spec twins pass the new names to constructor_spec().
  • Examples, tests and one internal call (is_degseq() → is_graphical()) use the new names. The deprecated *.game() wrappers are untouched; they keep forwarding the dotted names through the recovery.

Tests

expect_legacy_arg() (new, helper.R) checks one rename at a time: the legacy call soft-deprecates and returns the same result as the new spelling under the same seed. A table-driven test runs it for every renamed function in this PR. It evaluates the calls in the test's frame, because a call made from inside the helper would count as package-internal and stay silent.

Found along the way (unchanged, already on main)

  • sample_pa_age() errors whenever out.dist or out.seq is given ("Expecting a scalar integer but received a vector of length 0"), so these two arguments are unusable. They're renamed here, but the legacy-name test exercises out.pref instead.
  • sample_traits()/sample_traits_callaway() return a list (graph, node_type_vec, …, type.dist, pref.matrix) rather than a graph. The dotted element names are return values, not arguments, so this PR leaves them alone.

The #2788 stack

Each PR is based on the previous one and merges in this order:

  1. refactor: Rename algo to algorithm in page_rank(), feedback_arc_set() and feedback_vertex_set() #2859: algo → algorithm
  2. refactor: Rename nodes to n in generators and centr_*_tmax() #2860: nodes → n (vertex counts)
  3. refactor: snake_case weights arguments in clique functions and cluster_infomap() #2861: weights arguments
  4. refactor: Rename normalization flags to normalized #2862: normalization flags → normalized
  5. refactor: Purge legacy alias formals via the migration registry #2863: hand-rolled alias formals into the registry
  6. refactor: Rename vertex-selector arguments to vertices and vertex #2864: selectors → vertices/vertex
  7. refactor: Rename edge-selector arguments to edges #2943: edge selectors → edges
  8. refactor: Rename index to vertices/edges in the attribute accessors #2944: attribute accessors: index → vertices/edges
  9. refactor: Rename iteration arguments to n_iter/max_iter #2945: iterations → n_iter/max_iter
  10. refactor: snake_case the dotted arguments of the graph generators and degree-sequence functions #2946: snake_case: generators and degree sequences ← this PR
  11. refactor: snake_case the dotted arguments of the layout functions #2947: snake_case: layouts
  12. refactor: snake_case the dotted arguments of the community, HRG, motif and graphlet functions #2948: snake_case: community, HRG, motifs, graphlets (Mu → mu)
  13. refactor: snake_case the dotted arguments of the structural and conversion functions #2950: snake_case: structural and conversion functions
  14. refactor: Rename algorithm-selection arguments to algorithm and measure selection to measure #2951: algorithm family → algorithm/measure (closes Algorithm-selection argument names: census of method/algorithm/algo/impl/implementation #2932)

🤖 Generated with Claude Code

… degree-sequence functions

Dots become underscores; count prefixes follow the `n` convention
(`no.of.nodes` → `n`, `no.of.edges` → `n_edges`, `islands.n` → `n_islands`).
Legacy names are recovered with a soft-deprecation.
Adds `expect_legacy_arg()` to the test helpers.

Part of #2788.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if bbf027d is merged into claude/issue-2788-subagents-faw1t1-9:

  • ✔️E_named: 196ms -> 198ms [-1.48%, +4.2%]
  • ✔️V_named: 482ms -> 486ms [-2.52%, +4.33%]
  • ✔️all_simple_paths_named: 128ms -> 128ms [-0.74%, +0.98%]
  • ✔️as_adjacency_matrix: 204ms -> 205ms [-8.21%, +9.32%]
  • ✔️as_biadjacency_matrix: 201ms -> 204ms [-2.82%, +5.74%]
  • ✔️as_data_frame_both: 263ms -> 261ms [-2.84%, +0.98%]
  • ✔️as_long_data_frame: 192ms -> 188ms [-4.92%, +0.7%]
  • ✔️ego_order2_named: 149ms -> 147ms [-6.4%, +3.58%]
  • ✔️es_attr_assign: 214ms -> 211ms [-4.86%, +1.98%]
  • ✔️es_attr_filter: 206ms -> 204ms [-7.36%, +4.92%]
  • ✔️graph_from_adjacency_matrix: 224ms -> 225ms [-3.83%, +4.3%]
  • ✔️graph_from_data_frame: 276ms -> 277ms [-2.54%, +3.26%]
  • ✔️head_of_named: 166ms -> 166ms [-2.57%, +2.96%]
  • ✔️incident_edges: 212ms -> 213ms [-4.68%, +5.64%]
  • ✔️max_cliques_named: 25.4ms -> 24.6ms [-8.1%, +1.41%]
  • ✔️neighbors_by_name: 288ms -> 293ms [-5.12%, +8.03%]
  • ✔️union_named: 211ms -> 214ms [-1.51%, +4.14%]
  • ✔️vs_attr_filter: 234ms -> 235ms [-0.41%, +0.84%]
  • ✔️vs_by_name: 208ms -> 208ms [-0.64%, +0.28%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if efe5018 is merged into claude/issue-2788-subagents-faw1t1-9:

Status Name Current Incoming Interval
✔️ V_named 389.9ms 389.7ms [-0.5%, +0.44%]
✔️ graph_from_adjacency_matrix 230.2ms 230.4ms [-0.19%, +0.36%]
✔️ graph_from_data_frame 219.8ms 219.8ms [-0.82%, +0.84%]
✔️ as_biadjacency_matrix 200.3ms 200.7ms [-0.2%, +0.65%]
✔️ vs_subset_positional 196.2ms 197.4ms [-0.05%, +1.21%]
✔️ E_named 186.3ms 185.9ms [-1.99%, +1.54%]
✔️ es_attr_assign 185.8ms 185.6ms [-0.56%, +0.31%]
✔️ es_attr_filter 184.6ms 184.8ms [-0.28%, +0.52%]
✔️ vs_by_name 180.9ms 180.7ms [-0.55%, +0.38%]
🚀 as_adjacency_matrix 178.6ms 177.5ms [-1.17%, -0.05%]
✔️ max_cliques_sizes_named 168.7ms 169ms [-0.14%, +0.43%]
✔️ as_data_frame_both 161.8ms 160.8ms [-1.14%, 0%]
✔️ incident_edges 147.5ms 147.6ms [-0.77%, +0.85%]
✔️ union_named 146.6ms 147ms [-0.73%, +1.28%]
🚀 as_long_data_frame 146.3ms 145.2ms [-1.43%, -0.04%]
✔️ vs_attr_filter 144.7ms 144.4ms [-0.74%, +0.39%]
✔️ ego_order2_named 131ms 131.5ms [-0.64%, +1.48%]
✔️ head_of_named 127.5ms 127.7ms [-0.59%, +0.83%]
✔️ neighbors_by_name 110.4ms 110.1ms [-0.8%, +0.15%]
✔️ all_simple_paths_named 100.7ms 100.2ms [-1.02%, +0.01%]
✔️ vs_by_literal_name 79.9ms 80.5ms [-0.05%, +1.56%]
✔️ degree_few_vertices 71.6ms 71.7ms [-0.51%, +0.64%]
✔️ strength_weighted_named 24.1ms 23.9ms [-1.79%, +0.03%]
✔️ max_cliques_named 20.5ms 20.5ms [-0.99%, +0.83%]

Further explanation regarding interpretation and methodology can be found in the documentation.

Last updated for commit efe5018.

schochastics and others added 5 commits December 2, 2026 21:15
pa_age(pa.exp, aging.exp), sbm(pref.matrix) and chung_lu(in.weights) are
caught by their own `deprecated()` sentinels, separately from the
sample_*() functions, but the table only exercised the sample_*() side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-2788-subagents-faw1t1-10

# Conflicts:
#	tests/testthat/test-games.R
…-2788-subagents-faw1t1-10

# Conflicts:
#	R/degseq.R
#	R/games.R
#	R/make.R
@schochastics schochastics reopened this Dec 3, 2026
schochastics and others added 8 commits December 3, 2026 09:45
…-2788-subagents-faw1t1-10

# Conflicts:
#	R/games.R
#	tests/testthat/test-games.R
…-2788-subagents-faw1t1-10

# Conflicts:
#	tests/testthat/_snaps/structural-properties.md
…-2788-subagents-faw1t1-10

# Conflicts:
#	tests/testthat/_snaps/structural-properties.md
…-2788-subagents-faw1t1-10

# Conflicts:
#	tests/testthat/_snaps/structural-properties.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schochastics schochastics reopened this Dec 3, 2026
schochastics and others added 4 commits December 3, 2026 15:24
…-2788-subagents-faw1t1-10

# Conflicts:
#	R/games.R
The generator re-matches a call that uses an old head name against the old
signature, so the hand-written bridges for registered functions are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-2788-subagents-faw1t1-10

# Conflicts:
#	R/games.R
… values follow

These functions had hand-written bridges for their old argument names, so a
call naming the old one and passing the next argument positionally failed
with "supplied more than once". Their registry entries now let the generator
re-match such calls against the old signature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schochastics schochastics reopened this Dec 3, 2026
@schochastics schochastics reopened this Dec 3, 2026
@schochastics schochastics reopened this Dec 3, 2026
@schochastics
schochastics merged commit c5ca599 into main Dec 3, 2026
12 checks passed
@schochastics
schochastics deleted the claude/issue-2788-subagents-faw1t1-10 branch December 3, 2026 20:01
schochastics added a commit to schochastics/rigraph that referenced this pull request Dec 4, 2026
… degree-sequence functions (igraph#2946)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
Co-authored-by: schochastics <schochastics@users.noreply.github.com>
(cherry picked from commit c5ca599)
schochastics added a commit to schochastics/rigraph that referenced this pull request Dec 4, 2026
… degree-sequence functions (igraph#2946)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
Co-authored-by: schochastics <schochastics@users.noreply.github.com>
(cherry picked from commit c5ca599)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Algorithm-selection argument names: census of method/algorithm/algo/impl/implementation

2 participants