Skip to content

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

Open
schochastics wants to merge 22 commits into
claude/issue-2788-subagents-faw1t1-7from
claude/issue-2788-subagents-faw1t1-8
Open

schochastics wants to merge 22 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.

None of these functions has a registry entry. Each one gets a trailing index = deprecated() sentinel with a bridge: one soft-deprecation, the value forwarded, and an error if both spellings are supplied.

  • 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 sentinel 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 sentinel 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 the sentinel recovers.

The set_vertex_attrs() example about := now names vertices, the formal that now shadows a same-named attribute. index remains a formal as the sentinel, 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>
krlmlr and others added 3 commits October 15, 2026 19:32
…patch/` (#2934)

Co-authored-by: Claude <noreply@anthropic.com>
…r's series loop does (#2935)

Co-authored-by: Claude <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 Bot and others added 11 commits October 16, 2026 00:17
Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
…ing's setup (#2949)

Co-authored-by: Claude <noreply@anthropic.com>
…edit is vendored (#2956)

Co-authored-by: Claude <noreply@anthropic.com>
… them (#2957)

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
…s fixes in front of the vendor commits (#2959)

Co-authored-by: Claude <noreply@anthropic.com>
…-no-push-dev` (#2961)

Co-authored-by: Claude <noreply@anthropic.com>
… upstream function (#2966)

Co-authored-by: Claude <noreply@anthropic.com>
…s-land.sh --review --series` (#2970)

Co-authored-by: Claude <noreply@anthropic.com>
krlmlr and others added 4 commits October 18, 2026 11:12
…n the tree (#2968)

Co-authored-by: Claude <noreply@anthropic.com>
…ync (#2958)

Co-authored-by: Claude <noreply@anthropic.com>
… fold applied (#2965)

Co-authored-by: Claude <noreply@anthropic.com>
@krlmlr
krlmlr added this pull request to stack #2872 October 18, 2026 09:34
schochastics and others added 3 commits October 18, 2026 11:35
…d input

`igraph_match_arg()` eagerly computed `rlang::caller_arg()` and went
through `rlang::arg_match()` on every call, costing ~19 us even when the
value is valid. It now returns early for the two cases `arg_match()`
accepts (the untouched default, or a single exact match) and only pays
for the error machinery when it has to report one.

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

This branch has not been deployed

No deployments
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.

2 participants