Skip to content

refactor: Rename nodes to n in generators and centr_*_tmax() - #2860

Open
krlmlr wants to merge 1 commit into
claude/issue-2788-subagents-faw1t1from
claude/issue-2788-subagents-faw1t1-2
Open

refactor: Rename nodes to n in generators and centr_*_tmax()#2860
krlmlr wants to merge 1 commit into
claude/issue-2788-subagents-faw1t1from
claude/issue-2788-subagents-faw1t1-2

Conversation

@krlmlr

@krlmlr krlmlr commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Part of #2788 (PR 2 of the stack, on top of #2859); executes the nodesn row of the survey — the direction #692 recorded as essentially uncontested (62 functions already use n).

What this does

Renames the vertex-count argument nodes to n in 16 functions:

  • Game generators (11): sample_grg/grg, sample_pref/pref, sample_asym_pref/asym_pref, sample_traits/traits, sample_traits_callaway/traits_callaway, sample_forestfire.
  • Centralization (4): centr_betw_tmax, centr_clo_tmax, centr_degree_tmax, centr_eigen_tmax. The latter two had no registry entry and no ... yet, so they gain their standard 3.0.0 keyword-only migration here (loops stays required-with-no-default in the tail, unfold_tree() style; the existing loops/scale lifecycle guards are preserved).
  • graph_from_graphdb (1): nodes sits after ..., so this is a pure registry rename (bare-symbol nodes = n in old) — legacy nodes = calls are recovered by the generated block under the usual single soft-deprecation.

nodes is a head formal everywhere else, which the recovery machinery cannot rescue from ... — so those functions follow the as_adjacency_matrix() attr/weights precedent: positional calls bind n unchanged (no warning), and a surviving trailing nodes = deprecated() sentinel catches by-name legacy calls with a soft-deprecation and a conflict error when both spellings are supplied. Dot-case wrapper functions (grg.game() etc.) keep their frozen signatures and forward n = nodes.

Selector-nodes functions (ego() family, constraint(), alpha_centrality(), power_centrality()) are deliberately untouched — they rename to vertices in a later PR of this stack.

Notes for review

  • Abbreviated legacy spellings (node =, nod =) of the retired head name now fail loudly with the "spell out the full argument name" guidance instead of partial-matching — same trade-off the attrweights rename shipped.
  • tests/testthat/_snaps/foreign.md was updated by hand for the renamed error text because graph_from_graphdb() needs network access unavailable in the development sandbox; the offline-renderable messages were verified to match exactly.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RTPj4qNv2FWui6etixZeuR


Generated by Claude Code

…2788, #692)

Vertex-count arguments unify on `n`:
11 game generators and their spec twins,
the four `centr_*_tmax()` functions
(`centr_degree_tmax()` and `centr_eigen_tmax()` newly gain
their keyword-only migration on the way),
and `graph_from_graphdb()`.
Head positions keep working positionally;
named `nodes =` callers are soft-deprecated
via surviving sentinel formals or registry recovery.

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

Copy link
Copy Markdown
Contributor

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

  • ✔️as_adjacency_matrix: 759ms -> 762ms [-0.23%, +1.08%]
  • ✔️as_biadjacency_matrix: 765ms -> 765ms [-0.67%, +0.83%]
  • ✔️as_data_frame_both: 1.68ms -> 1.66ms [-3.9%, +1%]
  • ✔️as_long_data_frame: 4.06ms -> 4.08ms [-1.18%, +2.32%]
  • ✔️es_attr_filter: 2.76ms -> 2.73ms [-3.02%, +0.89%]
  • ✔️graph_from_adjacency_matrix: 123ms -> 124ms [-0.7%, +2.48%]
  • ✔️graph_from_data_frame: 3.71ms -> 3.74ms [-0.44%, +1.98%]
  • ✔️vs_attr_filter: 1.57ms -> 1.55ms [-2.55%, +0.98%]
  • ✔️vs_by_name: 1.02ms -> 1.03ms [-2.52%, +3.82%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

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