Skip to content

chore: Use _impl variants instead of inline .Call() for five functions with changed C signatures#2429

Merged
krlmlr merged 4 commits intomainfrom
copilot/refactor-use-impl-variant
Oct 26, 2025
Merged

chore: Use _impl variants instead of inline .Call() for five functions with changed C signatures#2429
krlmlr merged 4 commits intomainfrom
copilot/refactor-use-impl-variant

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 26, 2025

Five functions (betweenness, edge_betweenness, cluster_infomap, sample_gnp, rewire_each_edge) were directly calling C functions whose argument counts changed in the new C core version. This caused compatibility issues.

Changes

  • betweenness(): Replace inline .Call(R_igraph_betweenness_cutoff, ...) with betweenness_cutoff_impl()
  • edge_betweenness(): Replace inline .Call(R_igraph_edge_betweenness_cutoff, ...) with edge_betweenness_cutoff_impl()
  • cluster_infomap(): Replace inline .Call(R_igraph_community_infomap, ...) with community_infomap_impl()
  • sample_gnp(): Replace inline .Call(R_igraph_erdos_renyi_game_gnp, ...) with erdos_renyi_game_gnp_impl()
  • rewire_each_edge(): Replace inline .Call(R_igraph_rewire_edges, ...) with rewire_edges_impl()

The _impl variants handle argument preprocessing and C signature changes, allowing wrapper functions to focus on post-processing logic (normalization, metadata, filtering). Eliminates 81 lines of duplicated preprocessing code.

Original prompt

This section details on the original issue you should resolve

<issue_title>Use _impl variant instead of inline .Call() for four specific functions</issue_title>
<issue_description>These have changed the number of arguments in the new version of the C core.

  • betweenness
  • cluster_infomap
  • sample_gnp
  • rewire_each_edge</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…rewire_each_edge

Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor to use _impl variant for specific functions Use _impl variants instead of inline .Call() for four functions with changed C signatures Oct 26, 2025
Copilot AI requested a review from krlmlr October 26, 2025 18:48
@krlmlr krlmlr changed the title Use _impl variants instead of inline .Call() for four functions with changed C signatures chore: Use _impl variants instead of inline .Call() for four functions with changed C signatures Oct 26, 2025
@krlmlr krlmlr marked this pull request as ready for review October 26, 2025 19:14
@krlmlr krlmlr enabled auto-merge (squash) October 26, 2025 19:14
@krlmlr krlmlr disabled auto-merge October 26, 2025 19:27
@krlmlr
Copy link
Copy Markdown
Contributor

krlmlr commented Oct 26, 2025

@copilot: Also add edge_betweenness() .

Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 26, 2025

@copilot: Also add edge_betweenness() .

Done in 962caec. edge_betweenness() now uses edge_betweenness_cutoff_impl().

Copilot AI changed the title chore: Use _impl variants instead of inline .Call() for four functions with changed C signatures chore: Use _impl variants instead of inline .Call() for five functions with changed C signatures Oct 26, 2025
@krlmlr krlmlr merged commit c4aa0d5 into main Oct 26, 2025
4 checks passed
@krlmlr krlmlr deleted the copilot/refactor-use-impl-variant branch October 26, 2025 20:05
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.

Use _impl variant instead of inline .Call() for four specific functions

2 participants