Skip to content

chore: Replace _impl function aliases with explicit wrappers in R/centrality.R#2362

Merged
krlmlr merged 4 commits intomainfrom
copilot/replace-impl-aliases-in-centrality
Oct 25, 2025
Merged

chore: Replace _impl function aliases with explicit wrappers in R/centrality.R#2362
krlmlr merged 4 commits intomainfrom
copilot/replace-impl-aliases-in-centrality

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 25, 2025

Direct function aliases to _impl functions obscure the API surface and make function signatures less discoverable. This replaces four aliases with explicit wrapper functions that forward arguments individually.

Changes

  • strength: Now explicitly wraps strength_impl with full signature (graph, vids, mode, loops, weights)
  • diversity: Now explicitly wraps diversity_impl with full signature (graph, weights, vids)
  • page_rank: Now explicitly wraps personalized_pagerank_impl with full signature (graph, algo, vids, directed, damping, personalized, weights, options)
  • harmonic_centrality: Now explicitly wraps harmonic_centrality_cutoff_impl with full signature (graph, vids, mode, weights, normalized, cutoff)

Each wrapper forwards arguments using explicit arg = arg notation, consistent with existing deprecated wrapper patterns in the file (e.g., graph.strength, page.rank).

Example

Before:

strength <- strength_impl

After:

strength <- function(graph, vids = V(graph), mode = c("all", "out", "in", "total"), loops = TRUE, weights = NULL) {
  strength_impl(
    graph = graph,
    vids = vids,
    mode = mode,
    loops = loops,
    weights = weights
  )
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Replace _impl aliases in R/centrality.R</issue_title>
<issue_description>Goal
Review the code in R/centrality.R and replace all direct _impl function aliases with explicit wrapper functions.

Functions to update:

  • strength <- strength_impl
  • diversity <- diversity_impl
  • page_rank <- personalized_pagerank_impl
  • harmonic_centrality <- harmonic_centrality_cutoff_impl

Instructions

  1. Review the code to understand the function signatures
  2. Create explicit wrapper functions that forward to the _impl functions
  3. Forward each argument individually and explicitly using arg = arg notation
  4. Do not use ... unless the _impl function itself uses ...

Pattern
Replace direct aliasing like:

func_name <- func_name_impl

With an explicit wrapper:

func_name <- function(arg1, arg2, ...) {
  func_name_impl(
    arg1 = arg1,
    arg2 = arg2,
    ...
  )
}

File
R/centrality.R</issue_description>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace _impl aliases with explicit wrapper functions in R/centrality.R Replace _impl function aliases with explicit wrappers in R/centrality.R Oct 25, 2025
Copilot AI requested a review from krlmlr October 25, 2025 15:39
@krlmlr krlmlr changed the title Replace _impl function aliases with explicit wrappers in R/centrality.R chore: Replace _impl function aliases with explicit wrappers in R/centrality.R Oct 25, 2025
@krlmlr krlmlr marked this pull request as ready for review October 25, 2025 16:25
@krlmlr krlmlr merged commit e3178fd into main Oct 25, 2025
1 check passed
@krlmlr krlmlr deleted the copilot/replace-impl-aliases-in-centrality branch October 25, 2025 17:33
krlmlr added a commit that referenced this pull request Oct 25, 2025
…centrality.R` (#2362)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Co-authored-by: Kirill Müller <krlmlr@users.noreply.github.com>
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.

Replace _impl aliases in R/centrality.R

2 participants