Skip to content

refactor: Rename index to vertices/edges in the attribute accessors - #2944

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

schochastics merged 31 commits into
claude/issue-2788-subagents-faw1t1-7from
claude/issue-2788-subagents-faw1t1-8

Conversation

@schochastics

@schochastics schochastics commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2788 (PR 8 of the stack, on top of #2943). It answers the question "Does index in the attribute accessors join the selector rename?" with yes (maelle: "Rename"), using the vertices/edges names from #2864 and #2943.

What this does

  • vertex_attr(), vertex_attr<-, set_vertex_attr(), set_vertex_attrs(): index → vertices
  • edge_attr(), edge_attr<-, set_edge_attr(): index → edges

The family covers both vertices and edges, but each function handles only one of them, so they don't need splitting by type.

set_vertex_attr(), set_edge_attr(), vertex_attr<- and edge_attr<- get registry entries (tools/migrations/attributes.R), so the generated block handles the rename (see #2859). index stays as a trailing deprecated() formal. A call that names it is matched again against the pre-3.0.0 signature (graph, name, index, value), so set_vertex_attr(g, "x", index = i, v) still gives v to value; it gets one soft-deprecation, and an error if both spellings are supplied. Reverse dependencies use that call shape (CurricularComplexity, martini, miloR). vertex_attr(), edge_attr() and set_vertex_attrs() have no registry entry and keep a hand-written bridge that warns and errors the same way.

  • The selector keeps its position, so vertex_attr(g, "name", 2:3) and set_vertex_attr(g, "x", 1:2, 1) work unchanged and without a warning.
  • In the setters the index formal comes after value, so a positional value still binds. Positional calls of that kind exist in package code, e.g. graph_from_data_frame().
  • In the replacement functions vertex_attr<-/edge_attr<-, the index formal sits just before value, because R requires value to be the last formal.

Internal calls between the accessors use the new names. The deprecated get.vertex.attribute()/set.vertex.attribute() and friends are untouched: they still forward index = , which is recovered.

The set_vertex_attrs() example about := now names vertices, the formal that now shadows a same-named attribute. index remains a formal, so index := is still needed for an attribute of that name.

Tests

There are new tests for every legacy spelling, including both replacement functions and the conflict error, plus a check that positional selectors and positional value still bind as before.

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 ← this PR
  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
  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

…sors

`vertex_attr()`, `vertex_attr<-`, `set_vertex_attr()` and `set_vertex_attrs()`
rename `index` to `vertices`; `edge_attr()`, `edge_attr<-` and `set_edge_attr()`
rename it to `edges`.
Named legacy calls are recovered with a soft-deprecation;
positional selectors and positional `value` keep working.

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 6430fe9 is merged into claude/issue-2788-subagents-faw1t1-7:

  • ✔️E_named: 213ms -> 212ms [-1.77%, +1.14%]
  • ❗🐌V_named: 429ms -> 443ms [+2.79%, +3.78%]
  • ✔️all_simple_paths_named: 152ms -> 152ms [-0.63%, +0.83%]
  • ✔️as_adjacency_matrix: 243ms -> 243ms [-0.71%, +0.33%]
  • ✔️as_biadjacency_matrix: 258ms -> 259ms [-0.88%, +1.64%]
  • ❗🐌as_data_frame_both: 259ms -> 266ms [+1.91%, +3.41%]
  • ❗🐌as_long_data_frame: 211ms -> 212ms [+0.1%, +0.96%]
  • ✔️ego_order2_named: 161ms -> 162ms [-0.33%, +1.73%]
  • ❗🐌es_attr_assign: 236ms -> 239ms [+0.59%, +1.33%]
  • ❗🐌es_attr_filter: 243ms -> 245ms [+0.43%, +1.14%]
  • ✔️graph_from_adjacency_matrix: 278ms -> 277ms [-1.8%, +1.19%]
  • ❗🐌graph_from_data_frame: 279ms -> 283ms [+0.94%, +1.89%]
  • ❗🐌head_of_named: 181ms -> 183ms [+0.62%, +2.52%]
  • ✔️incident_edges: 209ms -> 209ms [-0.43%, +1.04%]
  • ✔️max_cliques_named: 26.1ms -> 26.2ms [-0.03%, +0.95%]
  • ❗🐌neighbors_by_name: 319ms -> 332ms [+3.37%, +4.95%]
  • ❗🐌union_named: 232ms -> 234ms [+0.2%, +1.21%]
  • ❗🐌vs_attr_filter: 327ms -> 335ms [+2.01%, +2.95%]
  • ❗🐌vs_by_name: 299ms -> 307ms [+2.07%, +3.51%]
    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 bd22768 is merged into claude/issue-2788-subagents-faw1t1-7:

Status Name Current Incoming Interval
❗🐌 V_named 451ms 461.8ms [+1.61%, +3.15%]
❗🐌 vs_by_name 307.7ms 316.9ms [+2.44%, +3.51%]
✔️ graph_from_data_frame 300.5ms 298.1ms [-2.29%, +0.65%]
✔️ graph_from_adjacency_matrix 278.7ms 279.1ms [-0.42%, +0.68%]
🚀 vs_subset_positional 262.9ms 260.6ms [-1.65%, -0.1%]
❗🐌 vs_attr_filter 242.9ms 248.9ms [+1.56%, +3.39%]
✔️ as_biadjacency_matrix 242.6ms 243.9ms [-0.46%, +1.56%]
✔️ E_named 232.9ms 239.5ms [-0.89%, +6.55%]
❗🐌 es_attr_filter 236.9ms 238.7ms [+0.22%, +1.32%]
❗🐌 es_attr_assign 234.8ms 237.3ms [+0.14%, +2.02%]
❗🐌 as_data_frame_both 231.3ms 236.5ms [+1.44%, +3.05%]
✔️ as_adjacency_matrix 223.7ms 223.6ms [-1.05%, +0.97%]
✔️ incident_edges 216ms 217.6ms [-0.46%, +1.92%]
✔️ max_cliques_sizes_named 214.8ms 214.3ms [-1.1%, +0.68%]
✔️ as_long_data_frame 213ms 211.8ms [-2.36%, +1.2%]
❗🐌 neighbors_by_name 190.2ms 201ms [+4.53%, +6.85%]
❗🐌 head_of_named 192.9ms 196.2ms [+1.06%, +2.27%]
✔️ union_named 194.7ms 196.1ms [-0.78%, +2.15%]
✔️ ego_order2_named 177.9ms 176.3ms [-2.45%, +0.69%]
✔️ all_simple_paths_named 151.2ms 151ms [-1.16%, +0.94%]
❗🐌 vs_by_literal_name 140.5ms 146.5ms [+3.42%, +5.07%]
❗🐌 degree_few_vertices 129.5ms 130.7ms [+0.21%, +1.6%]
❗🐌 strength_weighted_named 41.5ms 43.4ms [+3.75%, +5.42%]
✔️ max_cliques_named 27.5ms 27.5ms [-0.86%, +0.68%]

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

Last updated for commit bd22768.

@schochastics schochastics reopened this Dec 3, 2026
schochastics and others added 4 commits December 3, 2026 15:21
… 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 merged commit 0a2706b into main Dec 3, 2026
12 checks passed
@schochastics
schochastics deleted the claude/issue-2788-subagents-faw1t1-8 branch December 3, 2026 20:01
schochastics added a commit to schochastics/rigraph that referenced this pull request Dec 4, 2026
…sors (igraph#2944)

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 0a2706b)
schochastics added a commit to schochastics/rigraph that referenced this pull request Dec 4, 2026
…sors (igraph#2944)

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 0a2706b)
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