Skip to content

chore: pass explicit vertex-pair vectors in internal edge callers - #2954

Open
schochastics wants to merge 2 commits into
mainfrom
chore-1827-internal-edge-pairs
Open

schochastics wants to merge 2 commits into
mainfrom
chore-1827-internal-edge-pairs

Conversation

@schochastics

Copy link
Copy Markdown
Contributor

Summary

This holds the internal part of #2700, split out as requested there. It is meant to merge either way. #2700 is now stacked on top of it and contains only the user-facing change.

  • graph_from_edgelist(), graph_from_data_frame(), the sparse adjacency and incidence constructors, and [<- no longer pass 2 × n matrices to add_edges() / make_graph() / get_edge_ids().
    They pass interleaved vertex-pair vectors built with two small helpers, to_vertex_pairs(from, to) and edgelist_to_vertex_pairs(el).
    This means they keep working however matrix input to those functions is interpreted later.
  • el_to_vec() gains arg and fn, so its error and deprecation messages can name the caller.
    The defaults keep the current get_edge_ids(vp = ) wording, so no snapshots change.

No user-visible behavior change is intended.
A revdep4 run on this branch should confirm that.

Tests

Added tests for the helpers and for graph_from_edgelist() / graph_from_data_frame() with exactly two edges.

🤖 Generated with Claude Code

Internal callers of `add_edges()`, `make_graph()` and `get_edge_ids()` no longer pass 2 x n matrices.
They use `to_vertex_pairs()` / `edgelist_to_vertex_pairs()` instead, so they do not depend on how matrices are interpreted.
`el_to_vec()` gains `arg` and `fn` so its messages can name the calling function.
No user-visible behavior change.

Split out of #2700.

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 d9a4ef0 is merged into main:

  • ✔️E_named: 209ms -> 208ms [-1.13%, +0.17%]
  • ✔️V_named: 430ms -> 428ms [-0.94%, +0.32%]
  • ✔️all_simple_paths_named: 152ms -> 151ms [-0.71%, +0.32%]
  • ✔️as_adjacency_matrix: 242ms -> 243ms [-0.34%, +0.54%]
  • ✔️as_biadjacency_matrix: 254ms -> 255ms [-0.08%, +0.83%]
  • ✔️as_data_frame_both: 259ms -> 258ms [-1.12%, +0.19%]
  • ✔️as_long_data_frame: 211ms -> 211ms [-0.54%, +0.78%]
  • ✔️ego_order2_named: 155ms -> 155ms [-0.5%, +0.31%]
  • ✔️es_attr_assign: 238ms -> 239ms [-0.42%, +1.28%]
  • ✔️es_attr_filter: 244ms -> 244ms [-0.44%, +0.7%]
  • ✔️graph_from_adjacency_matrix: 276ms -> 277ms [-0.22%, +1.13%]
  • ❗🐌graph_from_data_frame: 282ms -> 284ms [+0.32%, +1.65%]
  • ✔️head_of_named: 179ms -> 179ms [-0.99%, +0.45%]
  • ✔️incident_edges: 216ms -> 215ms [-1.06%, +0.45%]
  • ✔️max_cliques_named: 26.3ms -> 26.2ms [-1.88%, +1.24%]
  • ✔️neighbors_by_name: 317ms -> 316ms [-1.27%, +0.65%]
  • ✔️union_named: 231ms -> 230ms [-0.92%, +0.06%]
  • ✔️vs_attr_filter: 330ms -> 331ms [-0.51%, +0.85%]
  • ✔️vs_by_name: 302ms -> 302ms [-0.5%, +0.76%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@krlmlr
krlmlr added this pull request to stack #2986 October 18, 2026 09:31

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.

1 participant