rigraph icon indicating copy to clipboard operation
rigraph copied to clipboard

fix: update wrapper functions for C API parameter changes

Open Copilot opened this issue 4 months ago • 0 comments

The autogenerated _impl functions changed their parameter signatures (e.g., loops boolean → allowed_edge_types enum, parameter names using underscores), but wrapper functions and tests weren't updated.

Parameter Type Changes

  • Graph generators: sample_gnp(), sample_gnm(), sbm_game(), rewire_each_edge() now map boolean loops/multiple to allowed_edge_types enum ("simple", "loops", "multi", "all")
  • Centrality functions: strength(), centralization_degree() convert boolean loops to enum ("twice", "none", "once")

Parameter Name Changes (dot → underscore)

Updated wrapper functions and tests:

  • similarity(): vit.from/vit.tofrom/to
  • community_label_propagation(): lpa.variantlpa_variant
  • community_leiden(): vertex_weightsvertex_out_weights/vertex_in_weights
  • community_infomap(): e_weights/v_weightsedge_weights/vertex_weights
  • biadjacency(): incidencebiadjmatrix
  • Cycle functions: bfs.cutoffbfs_cutoff, use.cycle.orderuse_cycle_order

Other Fixes

  • Added UNLIMITED = -1 constant for autogenerated function defaults
  • Fixed graph.isoclass.subgraph() double vertex ID offset (was subtracting 1 twice)
  • Removed sh and details parameters from automorphism_group() (no longer accepted by _impl)
  • Commented out unavailable loops/multiple attribute assignments in static_fitness_game_impl()

Example of typical change pattern:

# Before
sample_gnp(n, p, directed, loops = TRUE)
  → erdos_renyi_game_gnp_impl(n, p, directed, loops = TRUE)  # Error!

# After  
sample_gnp(n, p, directed, loops = TRUE)
  → erdos_renyi_game_gnp_impl(n, p, directed, 
      allowed_edge_types = if (loops) "loops" else "simple")
Original prompt

This section details on the original issue you should resolve

<issue_title>Fix tests on next branch</issue_title> <issue_description>Run tests only, ensure they pass. Do not worry about examples or devtools::check() as part of this task.</issue_description>

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

  • Fixes igraph/rigraph#2468

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Nov 01 '25 20:11 Copilot